Repository navigation
Checker rewrite R3: design of pattern mode, equations and instance_poly - #347
Conversation
…ns 53 to 57) Section 8.6 gets what the reviews of the fifth skeleton turn and of the two slices built from it put on record: the join that split_univars puts off (53), the two gained ranges lowered each on its own (54), the descriptor package_end reads (55), the contexts of free_univar (56) and the bench record of R3g with the rule that no prompt prescribes a remedy for a figure that moves (57). Section 8.1: R3g and R3p merged, and the instance_poly slice as a row of its own (R3q). Co-authored-by: Jaap Frolich <jfrolich@gmail.com> Session: https://os.submodule.nl/session/bks-9da31a3c-0d3b-7546-bc8e-f1fd3a9270ee Signed-off-by: open-session-submodule[bot] <341020755+open-session-submodule[bot]@users.noreply.github.com>
…he reviews left owed (decisions 58 to 60) What two Reither fields gain is decided before the types that hold a universal variable are unified (compiler/ml/ctype.ml:2685-2706): the kept types are written after the pair's record and the second run of join_either reads them back. OCaml keeps a type those unifications made a duplicate; the kernel dropped it. free_univar opens no context for a polymorphic type without bound variables (ctype.ml:1587-1589). With one, a type shared between the inside and the outside of such a type was visited again at every level: 2^(n+1) - 1 visits on a chain of n, where OCaml and now the kernel make 2n + 1. The arguments of a row's name are children only of the innermost row (iter_row, compiler/ml/btype.ml:229-241): unify_row rewrites the home node of a named row that gained a variant tail. Tests, all running: the old checker's side of the first and the third, one hand-built case per walk, a row walked by free_univar, the split with passive variants, and the step relations of free_univar and univars_escape at 1,000 and 10,000. Co-authored-by: Jaap Frolich <jfrolich@gmail.com> Session: https://os.submodule.nl/session/bks-9da31a3c-0d3b-7546-bc8e-f1fd3a9270ee Signed-off-by: open-session-submodule[bot] <341020755+open-session-submodule[bot]@users.noreply.github.com>
…ker does in it (decisions 61 and 62) A plan bit PATTERN: programs with two locally abstract types of two newtype levels, an abstract type with a parameter and a data type; Op::Gadt for one pattern unification with the two flags of set_mode_pattern; both sides print the equations in force. The skeleton of R3h's entry: Checker::unify_pattern (unify_gadt calls it), the equations log, the supplier of declarations LocalDecls, the LOCAL flag with TypeTable::instantiable. Bodies are R3h's. Running tests record what the old checker does: which pairs get an equation and in which direction, what reify makes, what a failure leaves, rows that clash and are compatible. It links two structures a pattern unification unifies, where OCaml records an assumed equality: old_judges cuts a case before such an operation. Co-authored-by: Jaap Frolich <jfrolich@gmail.com> Session: https://os.submodule.nl/session/bks-9da31a3c-0d3b-7546-bc8e-f1fd3a9270ee Signed-off-by: open-session-submodule[bot] <341020755+open-session-submodule[bot]@users.noreply.github.com>
…eir acceptance tests and build prompts (section 8.9, decisions 63 to 71)
Section 8.9: the state of pattern mode and what a unit that never
types a pattern pays; what replaces the link in each arm of unify3;
the arm of unify for two locally abstract types; an equation as a
manifest whose body is a generic copy, its log and its cut; reify;
the two arms that try and fall back as frames, not recursion; mcomp
with a supplier that compares declarations, and a clash without one.
Two slices: R3h (state, equations, reify, the arms without a
backtrack) and R3r (mcomp and the two arms that try). Skeleton:
FrameKind::{Flags, Try}, Try, Checker::{cut_equations, recover, tries,
compatible, duplicate, non_recursive_abbrev, find_newtype_level,
push_compatible}, TypeTable::{injective, injective_bits}; reify can
fail. Bodies are todo.
Fourteen ignored tests: eleven hand-built, two step tests at 1,000 and
10,000, and the generated cases of the pattern plan. No prototype was
made: they compile and the check of the ignored tests passes.
Co-authored-by: Jaap Frolich <jfrolich@gmail.com>
Session: https://os.submodule.nl/session/bks-9da31a3c-0d3b-7546-bc8e-f1fd3a9270ee
Signed-off-by: open-session-submodule[bot] <341020755+open-session-submodule[bot]@users.noreply.github.com>
Co-authored-by: Jaap Frolich <jfrolich@gmail.com> Session: https://os.submodule.nl/session/bks-9da31a3c-0d3b-7546-bc8e-f1fd3a9270ee Signed-off-by: open-session-submodule[bot] <341020755+open-session-submodule[bot]@users.noreply.github.com>
Co-authored-by: Jaap Frolich <jfrolich@gmail.com> Session: https://os.submodule.nl/session/bks-9da31a3c-0d3b-7546-bc8e-f1fd3a9270ee Signed-off-by: open-session-submodule[bot] <341020755+open-session-submodule[bot]@users.noreply.github.com>
…esigned Co-authored-by: Jaap Frolich <jfrolich@gmail.com> Session: https://os.submodule.nl/session/bks-9da31a3c-0d3b-7546-bc8e-f1fd3a9270ee Signed-off-by: open-session-submodule[bot] <341020755+open-session-submodule[bot]@users.noreply.github.com>
Co-authored-by: Jaap Frolich <jfrolich@gmail.com> Session: https://os.submodule.nl/session/bks-9da31a3c-0d3b-7546-bc8e-f1fd3a9270ee Signed-off-by: open-session-submodule[bot] <341020755+open-session-submodule[bot]@users.noreply.github.com>
|
First-pass checklist review at df56d4a (a checklist for the final reviewer, not an approval). First-pass review (checklist, not an approval): Setup: 1. Scope: PASS
2. Default path: PASS (not applicable: design PR)No build calls the new kernel under 3. Engineering standard (added production lines of rows.rs, unify.rs, expand.rs)
4. Tests and oracles: PASS
5. New scripts and fixtures: not applicableNone was added. 6. Privacy: PASS
7. Changelog: PASS
8. Numbers in the body: UNCLEAR
9. Focused tests: not run (host review)CI results are in section 22. 10. Where I would look hardest
11. Files: PASS
12. E1, the three corrections: PASS (one note on 60)58:
59:
60: the arguments of a stale row name.
13. What a unit without the feature pays: PASS (with omissions noted)Added production lines and their path class:
Decision 71 (doc.md:5371-5380) lists the future R3h reads: none in
14. The skeleton(a)
There are also R3i/R3j (b)
(c) Step tests for the cost of R3h/R3r functions. UNCLEAR.
(d) Items a
(e) Sizes. FAIL: (f) Changed signatures. 15. No pinned counts: PASSAdded asserts on counts:
No count of ignored tests or pinned seeds. 16. OCaml citations: UNCLEAR (several drift)Read on the branch ( Right:
Off by about 3 lines, and the cut-off lines are the fallback itself. The R3r prompt hands the builder these ranges.
Per test: 17. Pattern-mode design against OCaml: UNCLEAR
18. The harness: PASS
Observation tests. Each says "observed" (what today's Rust checker does), cites OCaml lines, and says whether it is a judge:
Plus three harness tests: 19. The build prompts (doc.md:3030-3146): UNCLEAR
20. Decisions 53–57 against the review comments: PASS (one nuance)
Decisions 58–71, one line each:
21. Old-checker differences reported: PASS
22. CI: PASS
|
…d owed, and the two prompts held until they are made The review read the design of pattern mode against compiler/ml/ctype.ml and ran four source programs through both compilers. Section 8.9 gets the list of corrections a design turn makes before either slice is built: the rule of local_non_recursive_abbrev (the test a_recursive_equation_is_not_added expects the opposite of what OCaml does), the occurrence test of a variable in pattern mode, the stale row name in pattern mode, two size tests, the visibility mcomp's marker needs, a step test that does not test its table, three step tests, line ranges, and the prompts' rules. The prompts of both slices say they are not issued as they stand. No code changes: one comment in the test. Co-authored-by: Jaap Frolich <jfrolich@gmail.com> Session: https://os.submodule.nl/session/os-01a1c9fa-0c5d-7912-a93b-3e7f38e53547 Signed-off-by: open-session-submodule[bot] <341020755+open-session-submodule[bot]@users.noreply.github.com>
|
Coordinator review, final, at 2e50e18 (the author did not write this review). The first-pass checklist (comment 6964023996) was read whole. I read the three corrections of built code (commit c801437) against the OCaml lines myself, checked the first-pass findings on the design against Verdict: merged as a partly finished design that says so, with a reviewer commit (2e50e18). The corrections of built code and the harness are accepted. The design of pattern mode is accepted in outline and is not ready to build: the two build prompts are held until a design turn has made the corrections listed in section 8.9. Accepted
Not accepted as written (all in the reviewer commit's list, section 8.9, "Corrections owed after review")
What the reviewer commit does: adds that list to 8.9, puts "not issued as it stands" before both prompts in 8.4, and a comment in the one test whose expectation is wrong. No code. Confirmed from outside this pull request
On record
|
Sixth skeleton (design) turn of slice R3 of the checker rewrite (
compiler-rust/docs/CHECKER_REWRITE.md, section 8). It records the reviews of R3g and R3p, corrects three faults in built code, adds the harness for pattern mode, and designs pattern mode as two slices with acceptance tests and build prompts.Not done: E5, the
instance_polyslice (R3q). It has its row in 8.1 and no design. E0 to E4 are complete.cargo test --lib tc::: 265 passed, 0 ignored on the starting trunk; 281 passed, 0 failed, 15 ignored at the end (ten for "R3h build", five for "R3r build"). That run was made on the tree before the default branch was merged in; the merge touches onlycompiler-rust/src/bir.cargo clippy --all-targetsandcargo docwith warnings denied are clean.Per deliverable
PATTERN,Op::Gadt, both sides print the equations,Fault::ExpressionMode; nine running testsignored_tests_name_the_slices_they_reachpassesE1(f): the explaining mode stays out of
univar_plan_agrees_on_generated_cases; nothing changed there.E1: corrections of built code
split_univarsdropped a type OCaml keeps (decision 58). What twoReitherfields gain is decided before the types that hold a universal variable are unified (compiler/ml/ctype.ml:2685-2706). The kept types are now written after the pair's record and read back by the second run ofjoin_either. Tests:differential::tests::old_checker_gains_a_type_the_holders_made_a_duplicate,r3_tests::a_field_gains_what_it_lacked_before_the_holders_were_unified(2 types instead of 3 without the fix).free_univarwas exponential (decision 59). A polymorphic type without bound variables opened a context, so a chain of n took 2^(n+1) − 1 visits (observed 2047, 4095, 2097151 for n = 10, 11, 20). It now takes exactly 2n + 1, as OCaml (ctype.ml:1587-1589). Test:r3_tests::the_walks_for_universal_variables_at_ten_thousand.iter_rowreaches them only for the innermost row (compiler/ml/btype.ml:229-241). NewChecker::drop_name_children, called byunify_row. Test:r3_tests::the_arguments_of_a_stale_row_name_are_not_children, one block per walk.free_univar, andsplit_univarswithpassive_variantsset and holders on both sides.Skeleton signatures, costs and tests changed
Checker::reifyreturnsResult<(), Clash>: it can fail (ctype.ml:1837-1839).Checker::unify_gadtnow delegates to the newChecker::unify_pattern(newtype_level, generate, injective, left, right).Checker:newtype_level,equations,locals,tries,compatible;cut_equations,recover,duplicate,non_recursive_abbrev,find_newtype_level,push_compatible,drop_name_children.rows::{Equation, DeclMatch, LocalDecls},unify::Try,FrameKind::{Flags, Try}.expand.rs: flagLOCAL(bit 7),TypeTable::{set_local, non_aliasable, instantiable, injective, injective_bits}.from_segmentdoes not setLOCAL.unify_rowmakes two more compares per pair of rows;free_univarwent from exponential to linear on the chain above.compareruns aPATTERNcase only on the prefix the old checker is a judge of (old_judges).ignored_tests_name_the_slices_they_reachknows R3q and R3r.Old-checker differences from OCaml met
ctype.ml:176-201, 1220-1227, 2289-2298(int, int);[#A(n0) | #B]against[#A(int) | #B]ctype.ml:2327-2331unifyfor two locally abstract types (expand the newer one once) is missingctype.ml:2258-2270lower_scopeddoes not drop the name of a row whose path escapes (new kernel, not the old checker)ctype.ml:618-623OCaml: "This instance of int is ambiguous: it would escape the scope of its equation". The Rust compiler accepts it.
Not established: for decision 58's source program OCaml's diagnostic prints two types where an instrumented build showed three in the field; the cause was not found.
Arms no hand-built test reaches
The object-type arm of
reify(not built: no kernel type has such a path);mcompof two fields; a parameter past the 32nd ofinjective_bits;LocalDecls::compareansweringMembersfor two open types; a reified variable with a name printing as$'a(the supplier is asked with the name, the spelling is the supplier's); objects and arrows with labels in pattern mode; the package fallback of decision 63.Open questions, with a recommended answer
old_judges; the hand-built tests judge a structure pair that succeeds.free_univarrevisits a node per context of a polymorphic type with bound variables, as OCaml. Recommended: accept.lower_scopedand the escaping row name. Recommended: a correction with a hand-built test in the turn that designs R3q.duplicateisgeneralizepluscopyunder a speculation, which holds only ifgeneralizewrites nothing but levels through the trail. Recommended: the builder of R3h reports; otherwise a copy-everything flag inGraph::copy_ref.Decisions for review to confirm
split_univarswrites the kept types for the second join.PATTERNharness.old_judgescut.package_endis unchanged; pattern mode reifies where a completion is missing.patternloaded once inunify_expanded; the two swap tests stay identity tests.unify_pairand costs one load for two nullary constructors of different types.LOCAL,injective_bits, andexpands_to_datatyperead as theDATATYPEflag of the head's row.Tryrecord; a backtrack does not cut equations.mcomp, its own table, and a clash for two data types without a supplier.Also to confirm: the cut into R3h and R3r (a slice name has one letter because the check of ignored tests reads three characters).
Uncertain, and said in the prompts: whether
unify_rowand its frames read the left node as a link (they were built with it linked;rows_that_clash_are_reified_and_comparedis the test), and where a callee's trace pair goes inMode::Explainforreify's clash.Started by Jaap Frolich in this Assistant session