@@ -63,8 +63,8 @@
63:: finds each node's end from the tokens alone, matching each opener
63:: finds each node's end from the tokens alone, matching each opener
64:: with its closer on the line, so a node that stops at a child where
64:: with its closer on the line, so a node that stops at a child where
65:: its closer follows fails it, and +check-spans-test plants such
65:: its closer follows fails it, and +check-spans-test plants such
66−:: wrong ends to show that it does (the jibb-check-spans test suite
66+:: wrong ends to show that it does (tools/hoon check-spans-test prints
67−:: runs it).
67+:: the empty list, <<>>, when it passes).
69:: ===================================================================
69:: ===================================================================
70:: 2. The layout pass (+layout)
70:: 2. The layout pass (+layout)
@@ -206,11 +206,9 @@
206:: token holds the text after @. An aura starting @s or
206:: token holds the text after @. An aura starting @s or
207:: @r is an error at 2nd: "signed and floating-point
207:: @r is an error at 2nd: "signed and floating-point
208:: auras are left out of Jibb"
208:: auras are left out of Jibb"
209−:: A-Z type variable [A-Z][a-z0-9]*: a capital, then
209+:: A-Z type variable: one capital. A letter or digit right
210−:: lowercase letters and digits, as M, Msg or T2. Right
211−:: after it, which is emitted first, a capital, _ or -
212−:: is an error there, "a type variable is a capital,
210+:: after it is an error there, "a type variable is one
213−:: then lowercase letters and digits"
211+:: capital letter", after the type variable's token
214:: a-z name [a-z][a-z0-9-]*, or a wing: two or more names
212:: a-z name [a-z][a-z0-9-]*, or a wing: two or more names
215:: joined by dots. Right after the name or wing, which
213:: joined by dots. Right after the name or wing, which
216:: is emitted first, a capital or _ is an error there,
214:: is emitted first, a capital or _ is an error there,
@@ -407,7 +405,6 @@
407:: Why: after the layout pass the grammar is LL(2). Each choice is made by
405:: Why: after the layout pass the grammar is LL(2). Each choice is made by
408:: the next token, at most with the one after it and whether it is tight:
406:: the next token, at most with the one after it and whether it is tight:
409:: name, then = tight a face (items, lines, fields, samples)
407:: name, then = tight a face (items, lines, fields, samples)
410−:: wing, then = tight a change's item or line, wing=value
411:: name, then + tight a pair
408:: name, then + tight a pair
412:: name or wing, then ( tight a change
409:: name or wing, then ( tight a change
413:: |=, then a term tight a constructor; else, where an
410:: |=, then a term tight a constructor; else, where an
@@ -415,9 +412,6 @@
415:: ++ or +$ a definition; else a body's final expr
412:: ++ or +$ a definition; else a body's final expr
416:: INDENT a body, an open bracket's lines, arms
413:: INDENT a body, an open bracket's lines, arms
417:: or cases; else the expression goes on
414:: or cases; else the expression goes on
418−:: NEWLINE, after a rune's head the rest of the body, on a body's
419−:: or ?-'s subject final line (The rest of a body);
421:: So the parser never backtracks, its first failure is its furthest, and
415:: So the parser never backtracks, its first failure is its furthest, and
422:: "expected X, found Y" falls out of each arm without tracking failures
416:: "expected X, found Y" falls out of each arm without tracking failures
423:: across alternatives. Hoon's combinators read tapes of characters and
417:: across alternatives. Hoon's combinators read tapes of characters and
@@ -461,9 +455,7 @@
461:: cases below -> %mold; one case is that mold, several
455:: cases below -> %mold; one case is that mold, several
462:: are %union. The optional generic wraps either in %generic.
456:: are %union. The optional generic wraps either in %generic.
463:: ++ name expr or body -> %value (a body becomes a %body expr)
457:: ++ name expr or body -> %value (a body becomes a %body expr)
464−:: body INDENT rest DEDENT; rest is { definition NEWLINE } last
458+:: body INDENT { definition NEWLINE } expr DEDENT -> %body
465−:: -> %body, and last is expr, or the rest of a body that
466−:: a rune on its final line took (The rest of a body)
467:: call one operand is that operand; more -> %call head args
459:: call one operand is that operand; more -> %call head args
468:: operand literal -> %lit or %str; pathlit -> %path, as a path
460:: operand literal -> %lit or %str; pathlit -> %path, as a path
469:: literal is an expression (Decisions); !! -> %crash, as
461:: literal is an expression (Decisions); !! -> %crash, as
@@ -480,9 +472,7 @@
480:: that line, as () is no group. A ( followed by a rune is
472:: that line, as () is no group. A ( followed by a rune is
481:: the closed form. Lines of an open group or list take no
473:: the closed form. Lines of an open group or list take no
482:: name= (doc question)
474:: name= (doc question)
483−:: change every item and line has name= or wing=, as open.cart=
475+:: change every item and line has name= (the EBNF's "items named")
484−:: (the EBNF's edit) -> %change of edits, each with its
485−:: names as written; a tuple's item takes no wing=
486:: rune |= -> %gate; ^- -> %cast; ~& -> %trace; ?- -> %branch.
476:: rune |= -> %gate; ^- -> %cast; ~& -> %trace; ?- -> %branch.
487:: !! is an operand, not a rune (Decisions): alone where an
477:: !! is an operand, not a rune (Decisions): alone where an
488:: expression goes it is a call of one operand, and !! a
478:: expression goes it is a call of one operand, and !! a
@@ -563,23 +553,7 @@
563:: - Local definitions: at the start of any body, a gate's, an arm's,
553:: - Local definitions: at the start of any body, a gate's, an arm's,
564:: a ^-'s, a ~&'s or a ++'s, as the EBNF's body takes them
554:: a ^-'s, a ~&'s or a ++'s, as the EBNF's body takes them
565:: (Decisions); +$ as well as ++, as the Runes prose's "likewise"
555:: (Decisions); +$ as well as ++, as the Runes prose's "likewise"
566−:: says. The rest of a body is a body too, so it takes them.
556+:: says.
567−:: - The rest of a body (decided 2026-11-03, syntax review S2): a
568−:: body's final line is read with a flag, fin (+read-last), that
569−:: passes down the chain of runes on the line, as ^- @ud ~& x, while
570−:: nothing on the line is left open. A rune whose last child would
571−:: go next, and finds NEWLINE there, takes the lines after it at its
572−:: depth as that child, a body of its own (+read-rest); a ?- that
573−:: begins the line takes them as its arms (+read-branch). The flag
574−:: is off everywhere else: in a bracket, on an arm's line, for a
575−:: definition's own expression, and for a ?- after a rune on the
576−:: line, so ^- @ud ?- x keeps its arms deeper. A line nothing takes
577−:: is an error as before. A rest ends at its body's DEDENT, which
578−:: +read-rest leaves for whatever opened the body, so one DEDENT
579−:: ends every rest nested on that body's lines. Each rest is a level
580−:: of nesting, so the stack grows with them, as with brackets: a
581−:: body of 20.000 ~& x lines at one depth parses, and one of 40.000
582−:: runs out of memory, where 40.000 nested parentheses don't.
583:: - Where errors point: the doc says only "line, column and an
557:: - Where errors point: the doc says only "line, column and an
584:: excerpt"; 2.0 and Errors below say where.
558:: excerpt"; 2.0 and Errors below say where.
@@ -630,12 +604,11 @@
630:: found the end of the line" (+fail-space). No later line can give
604:: found the end of the line" (+fail-space). No later line can give
631:: a tight form its next token. A wing and a ( after a space are no
605:: a tight form its next token. A wing and a ( after a space are no
632:: error: that is a call; nor is / or %/ alone, a whole path. A
606:: error: that is a call; nor is / or %/ alone, a whole path. A
633−:: change's item is name= or wing=, so a name or a wing there with
607+:: change's item is name=, so a name there with no = right after it
634−:: no = right after it fails just past it, whatever follows: `m(b c)`
608+:: fails just past the name, whatever follows: `m(b c)` at the
635−:: and `m(a.b 1)` at the space, `m(b)` at the ), `m(a"x)` at the "
609+:: space, `m(b)` at the ), `m(a"x)` at the " with the layout pass's
636−:: with the layout pass's message after the parser's (+unnamed,
610+:: message after the parser's (+unnamed, +moved). `m(a==1)` has its
637−:: +moved). `m(a==1)` has its =, and fails at the second, where the
611+:: =, and fails at the second, where the layout pass does.
639:: - Where the place needs text on its own line and the line ends,
612:: - Where the place needs text on its own line and the line ends,
640:: whatever line comes next: at the end of that line, just past its
613:: whatever line comes next: at the end of that line, just past its
641:: last token, "found the end of the line" (+fail-line), as no later
614:: last token, "found the end of the line" (+fail-line), as no later
@@ -801,40 +774,39 @@
801:: (face 2:11 items
774:: (face 2:11 items
802:: (apply 2:17 list (aura 2:23 @t)))
775:: (apply 2:17 list (aura 2:23 @t)))
803:: (face 2:27 open (flag 2:32))))
776:: (face 2:27 open (flag 2:32))))
804−:: (mold 3:1 poke
777+:: (mold 3:1 cart-action
805:: (union 4:3
778:: (union 4:3
806:: (cell 4:3
779:: (cell 4:3
807:: (const 4:4 %add)
780:: (const 4:4 %add)
808:: (face 4:9 item (aura 4:14 @t)))
781:: (face 4:9 item (aura 4:14 @t)))
809:: (const 5:3 %toggle)))
782:: (const 5:3 %toggle)))
783+:: (mold 6:1 poke (ref 6:9 cart-action))
810−:: (value 7:1 main
784+:: (value 8:1 main
811−:: (group 7:9
785+:: (group 8:9
812−:: (call 7:10 (wing 7:10 store) (wing 7:16 init) (wing 7:21 update))))
786+:: (call 8:10 (wing 8:10 store) (wing 8:16 init) (wing 8:21 update))))
813−:: (value 8:1 init
787+:: (value 9:1 init
814−:: (cast 8:9
788+:: (cast 9:9
815−:: (ref 8:12 state)
789+:: (ref 9:12 state)
816−:: (tuple 8:18
790+:: (tuple 9:18 (lit 9:19 ~) (lit 9:21 %.n))))
817−:: (face 8:19 items (lit 8:25 ~))
818−:: (face 8:27 open (lit 8:32 %.n)))))
819−:: (value 9:1 update
791+:: (value 10:1 update
820−:: (gate 9:11
792+:: (gate 10:11
821−:: (cell 9:14
793+:: (cell 10:14
822−:: (face 9:15 a (ref 9:17 poke))
794+:: (face 10:15 a (ref 10:17 cart-action))
823−:: (face 9:22 s (ref 9:24 state)))
795+:: (face 10:29 s (ref 10:31 state)))
824−:: (body 10:3
796+:: (body 11:3
825−:: (branch 10:3
797+:: (branch 11:3
826−:: (wing 10:6 a)
798+:: (wing 11:6 a)
827−:: (arm 11:3
799+:: (arm 12:5
828−:: (cell 11:3 (lit 11:4 %add) (bind 11:9 item))
800+:: (cell 12:5 (lit 12:6 %add) (bind 12:11 item))
829−:: (change 11:16 s
801+:: (change 12:18 s
830−:: (edit 11:18 items
802+:: (edit 12:20 items
831−:: (tuple 11:24 (wing 11:25 item) (wing 11:30 items.s)))))
803+:: (tuple 12:26 (wing 12:27 item) (wing 12:32 items.s)))))
832−:: (arm 12:3
804+:: (arm 13:5
833−:: (lit 12:3 %toggle)
805+:: (lit 13:5 %toggle)
834−:: (change 12:16 s
806+:: (change 13:18 s
835−:: (edit 12:18 open
807+:: (edit 13:20 open
836−:: (group 12:23
808+:: (group 13:25
837−:: (call 12:24 (wing 12:24 not) (wing 12:28 open.s)))))))))))
809+:: (call 13:26 (wing 13:26 not) (wing 13:30 open.s)))))))))))
839:: 4.3 Errors (+show-error): "<file>:<line>:<col>: <message>", then the
811:: 4.3 Errors (+show-error): "<file>:<line>:<col>: <message>", then the
840:: source line, then a caret under the column (col - 1 spaces, then ^).
812:: source line, then a caret under the column (col - 1 spaces, then ^).
@@ -845,93 +817,9 @@
845:: prints as a space, so the caret stays under its column and golden
817:: prints as a space, so the caret stays under its column and golden
846:: files hold no raw control bytes.
818:: files hold no raw control bytes.
848−:: /ui/basket.jibb:22:3: msg has no case %submitt
820+:: /ui/basket.jibb:22:5: msg has no case %submitt
849−:: %submitt [m(note="") ~]
821+:: %submitt [m(note="") ~]
852−:: ===================================================================
853−:: 5. General checker core (design; not implemented yet)
854−:: ===================================================================
856−:: The existing inference and recovery paths are described in
857−:: docs/compiler.md. This section is a plan for replacing them, not a
858−:: claim that the current checker implements these rules. The Grammar and
859−:: Decisions are authoritative if this design needs adjustment.
861−:: 5.1 State and unification. Give each inference variable an identity and
862−:: a union-find entry: parent or binding, rank, level, source, rigidity,
863−:: and the atom, arithmetic-atom and gate-free obligations it carries.
864−:: Hoon's immutable maps hold the entries; operations return the updated
865−:: state. Find compresses paths in that returned state. Bind only after an
866−:: occurs check, merge obligations at roots, and lower levels throughout
867−:: the bound type to the root's level. A rigid written capital may acquire
868−:: allowed constraints but cannot be forced to a concrete type or a
869−:: different written capital. Keep origins for both sides of each fit so
870−:: a failure can show both excerpts. Recursive named molds retain their
871−:: identity; the occurs check is for inference variables, not a ban on
872−:: declared recursion.
874−:: A scheme quantifies eligible variables above the enclosing level;
875−:: instantiate with fresh variables and copy their obligations. Written
876−:: capitals respect their lexical scope, including sharing with a local
877−:: definition when the enclosing definition uses the same name. Retain
878−:: aura variables and directional aura fits, rather than turning every
879−:: fit into symmetric equality. At a faced position a capital binds the
880−:: type under the face; joining an unnamed position with a faced one keeps
881−:: the face, independently of the order of the inputs. Different explicit
882−:: faces conflict. No gate may hide inside a gate-free type, including in
883−:: a container; propagate the obligation through its arguments.
885−:: 5.2 Work queue. A constraint owns its source span, the types and
886−:: expression shape it depends on, and the information needed to report
887−:: failure. Tags and constructors, null, decimal and cell literals,
888−:: wings, changes, unface and unknown match subjects enter the same queue.
889−:: Index waiting constraints by the roots they read. Binding or merging a
890−:: root wakes its dependants; a retry either solves, fails with its sites,
891−:: or registers the roots still needed. Run to a fixed point, without
892−:: losing constraints when a root is redirected. Check patterns once the
893−:: subject is known. Contextual tags inspect case shapes and noun-equal
894−:: heads, retaining the named union and its site in diagnostics.
896−:: Variables reachable from an open tag constraint remain monomorphic
897−:: across definitions, so a later use, including main, can fix them.
898−:: Other eligible variables can generalize, with their atom and gate-free
899−:: obligations intact. At each definition boundary resolve its holes and
900−:: apply the specified decimal and cell defaults, without defaulting a
901−:: decimal whose definition is generic over its aura. A decimal fits @ud,
902−:: @u, @ and *; other concrete auras need their own literal. At module
903−:: completion retry the queue and report each still-open constraint at its
904−:: source; an unresolved tag asks for a ^-, never a guessed union.
906−:: 5.3 Definition order and kinds. Use the existing dependency graph's
907−:: strongly connected components in dependency order. Give a recursive
908−:: group of gates monomorphic placeholders, infer all members in one state,
909−:: solve what can be solved, then generalize together. Reject a cycle
910−:: involving a non-gate value, including one through a gate, and show the
911−:: cycle. Check a named definition's holes before later uses can fix them.
912−:: Infer main as an ordinary expression against ordinary prelude schemes;
913−:: only its resulting type determines library, page, island or store.
914−:: Afterwards check kind-specific invariants: recursively find the field
915−:: containing a gate in island data or a model, and inspect subscriptions
916−:: for watchability only at %watch. A page load may be any gate to ask,
917−:: including pure and typed paths. Preserve request provenance needed for
918−:: a watchability proof through ordinary calls and aliases.
920−:: 5.4 Matches and migration. A reusable usefulness matrix over noun
921−:: constructors, constants, cells and wildcards checks nested patterns;
922−:: loobeans, lists and units expand to their cases. Test an arm against
923−:: previous rows for usefulness, then test a wildcard for exhaustiveness;
924−:: keep a witness for a missing case and the covering arm's site for a
925−:: dead one. Recursive types require memoized specialization and a
926−:: terminating treatment of recursive states. The same matrix can later
927−:: drive lowering. The bare-name/tag spelling rule is checked against the
928−:: subject and the cases the rest of the pattern can match.
930−:: Migrate in small stages with eval and ship goldens for every change.
931−:: Keep diagnostics and source sites in the single full result; types.txt
932−:: is a rendering of that result. As general inference covers an existing
933−:: recovery or source-proven slice, remove that slice and retain its tests.
934−:: An unsupported construct fails closed at its own site until then.
937+| %positions
825+| %positions
@@ -1077,10 +965,9 @@
1078+$ item $~([*span ~ *expr] [at=span face=(unit term) val=expr])
966+$ item $~([*span ~ *expr] [at=span face=(unit term) val=expr])
1080−:: +edit: a change's item or line, name=value or wing=value; names
968+:: +edit: a change's item or line, name=value
1081−:: as written, as a %wing's: open.cart is ~[%open %cart]
1083−+$ edit $~([*span ~ *expr] [at=span names=(list term) val=expr])
970++$ edit $~([*span %$ *expr] [at=span name=term val=expr])
1085:: +arm: a ?- arm, a pattern and an expression or body
972:: +arm: a ?- arm, a pattern and an expression or body
@@ -1469,10 +1356,10 @@
1469 =? n &(?=(^ rest) (is-upper i.rest)) +(n)
1356 =? n &(?=(^ rest) (is-upper i.rest)) +(n)
1470 (emit +(n) [%aura (@ta (crip (scag n t.cs)))])
1357 (emit +(n) [%aura (@ta (crip (scag n t.cs)))])
1471 ?: (is-upper a)
1358 ?: (is-upper a)
1472− =/ n=@ud (run-len t.cs tvar-mask)
1473− => (emit +(n) [%tvar (crip [a (scag n t.cs)])])
1359+ => (emit 1 [%tvar a])
1474− ?. &(?=(^ cs) |((is-upper i.cs) =('_' i.cs) =('-' i.cs))) cor
1360+ ?. &(?=(^ cs) |((is-lower i.cs) (is-upper i.cs) (is-digit i.cs)))
1475− (err col "a type variable is a capital, then lowercase letters and digits")
1362+ (err col "a type variable is one capital letter")
1476 ?: =(':' a)
1363 ?: =(':' a)
1477 ?. =(0 dep) (err col "a comment can't start inside `\{…}`")
1364 ?. =(0 dep) (err col "a comment can't start inside `\{…}`")
1478 ?: =(':' b) comment
1365 ?: =(':' b) comment
@@ -1747,14 +1634,9 @@
1748:: +bad-char: the error for a character that no text may hold (2.2)
1635:: +bad-char: the error for a character that no text may hold (2.2)
1750−:: The line feed ends a line and is no such character, so an escape
1751−:: cut off by the end of its line gets the same error as one cut off
1752−:: by the end of the text.
1754++ bad-char
1637++ bad-char
1756 ^- (unit tape)
1639 ^- (unit tape)
1758 ?: =(9 c) `"a tab: Jibb uses spaces only"
1640 ?: =(9 c) `"a tab: Jibb uses spaces only"
1759 ?: =(13 c) `"a carriage return: Jibb lines end with a line feed alone"
1641 ?: =(13 c) `"a carriage return: Jibb lines end with a line feed alone"
1760 ?: |((lth c 32) =(127 c)) `"a control character"
1642 ?: |((lth c 32) =(127 c)) `"a control character"
@@ -1776,7 +1658,6 @@
1776++ digit-mask 0x3ff.0000.0000.0000 :: 0-9
1658++ digit-mask 0x3ff.0000.0000.0000 :: 0-9
1777++ hex-mask 0x7e.0000.0000.03ff.0000.0000.0000 :: 0-9 a-f
1659++ hex-mask 0x7e.0000.0000.03ff.0000.0000.0000 :: 0-9 a-f
1778++ name-mask 0x7ff.fffe.0000.0000.03ff.2000.0000.0000 :: a-z 0-9 -
1660++ name-mask 0x7ff.fffe.0000.0000.03ff.2000.0000.0000 :: a-z 0-9 -
1779−++ tvar-mask 0x7ff.fffe.0000.0000.03ff.0000.0000.0000 :: a-z 0-9
1780++ knot-mask 0x47ff.fffe.8000.0000.03ff.6000.0000.0000 :: and . ~ _
1661++ knot-mask 0x47ff.fffe.8000.0000.03ff.6000.0000.0000 :: and . ~ _
1781++ number-mask 0x7ff.fffe.07ff.fffe.03ff.4000.0000.0000 :: a-z A-Z 0-9 .
1662++ number-mask 0x7ff.fffe.07ff.fffe.03ff.4000.0000.0000 :: a-z A-Z 0-9 .
1782++ bad-mask 0x8000.0000.0000.0000.0000.0000.ffff.fbff :: 2.2
1663++ bad-mask 0x8000.0000.0000.0000.0000.0000.ffff.fbff :: 2.2
@@ -2395,7 +2276,7 @@
2395++ sexp-edit
2276++ sexp-edit
2396 |= e=edit
2277 |= e=edit
2398− (nod "edit" at.e (show-names names.e) ~[(sexp-expr val.e)])
2279+ (nod "edit" at.e (trip name.e) ~[(sexp-expr val.e)])
2400++ sexp-arm
2281++ sexp-arm
2401 |= a=arm
2282 |= a=arm
@@ -2804,32 +2685,24 @@
2804 ?~ t.els i.els
2685 ?~ t.els i.els
2805 [%call [beg:(span-of i.els) end:(span-of (rear t.els))] i.els t.els]
2686 [%call [beg:(span-of i.els) end:(span-of (rear t.els))] i.els t.els]
2807−:: +slot: a bracket's item or line as read, before +bracket-node
2808−:: makes it an item or an edit: its name=, or a change's wing=, else ~
2810−+$ slot [at=span face=(list term) val=expr]
2812:: +bracket-node: a tuple, list or change from its items, ending at fin
2688:: +bracket-node: a tuple, list or change from its items, ending at fin
2814++ bracket-node
2690++ bracket-node
2815 |= $: kind=?(%tuple %list %change)
2691 |= $: kind=?(%tuple %list %change)
2816 op=token
2692 op=token
2817 target=(unit [t=token names=(list term)])
2693 target=(unit [t=token names=(list term)])
2818− its=(list slot)
2694+ its=(list item)
2824− :+ %tuple [beg.at.op fin]
2699+ %tuple [%tuple [beg.at.op fin] its]
2825− (turn its |=(i=slot ^-(item [at.i ?~(face.i ~ `i.face.i) val.i])))
2827− %list [%list [beg.at.op fin] (turn its |=(i=slot val.i))]
2700+ %list [%list [beg.at.op fin] (turn its |=(i=item val.i))]
2830 =/ beg=loc ?~(target beg.at.op beg.at.t.u.target)
2703 =/ beg=loc ?~(target beg.at.op beg.at.t.u.target)
2831 :^ %change [beg fin] ?~(target ~ names.u.target)
2704 :^ %change [beg fin] ?~(target ~ names.u.target)
2832− (turn its |=(i=slot ^-(edit [at.i face.i val.i])))
2705+ (turn its |=(i=item ^-(edit [at.i ?~(face.i %$ u.face.i) val.i])))
2835+| %parser
2708+| %parser
@@ -3050,22 +2923,23 @@
3051 :: +unnamed: a change's item or line without its name=
2924 :: +unnamed: a change's item or line without its name=
3053− :: A name or a wing could still begin one, so the error is just
2926+ :: A name could still begin one, so the error is just past it, as
3054− :: past it, as a tight form's is (+fail-space): `m(b c)` and
2927+ :: a tight form's is (+fail-space): `m(b c)` at the space, `m(b)`
3055− :: `m(a.b 1)` at the space, `m(b)` at the ). So is an error token's
2928+ :: at the ). So is an error token's text there, unless it begins
3056− :: text there, unless it begins with the =: `m(a"x)` at the ", with
2929+ :: with the =: `m(a"x)` at the ", with the layout pass's message
3057− :: the layout pass's message after the parser's (+moved), but
2930+ :: after the parser's (+moved), but `m(a==1)` at the lexer's error,
3058− :: `m(a==1)` at the lexer's error, the second =. At an error token
2931+ :: the second =. So is a wing's first name: `m(a.b=1)` fails at the
2932+ :: dot (+fail-in). At an error token whose text can't begin a name,
3059− :: whose text can't begin a name, at that text, as `m( @sd` at the
2933+ :: at that text, as `m( @sd` at the @ (+fail-in).
3062 ++ unnamed
2935 ++ unnamed
3063 |= ts=(list token)
2936 |= ts=(list token)
3064 ^- [%| p=error]
2937 ^- [%| p=error]
3065 =/ why=tape "a change's items are named, as in m(done=%.y)"
2938 =/ why=tape "a change's items are named, as in m(done=%.y)"
3066 ?: ?=([[* * [%error *]] *] ts) (bad-in ts "a named item" lower-mask)
2939 ?: ?=([[* * [%error *]] *] ts) (bad-in ts "a named item" lower-mask)
3067− ?. ?=([[* * ?([%name *] [%wing *])] *] ts)
2940+ ?: ?=([[* * [%wing *]] *] ts)
2941+ (bad-in-why ts "a named item" lower-mask why)
3068− (bad-why ts "a named item" why)
2942+ ?. ?=([[* * [%name *]] *] ts) (bad-why ts "a named item" why)
3069 =/ want=tape "`=` right after {(show-found i.ts)}"
2943 =/ want=tape "`=` right after {(show-found i.ts)}"
3070 ?: ?& ?=([* [* * [%error *]] *] ts)
2944 ?: ?& ?=([* [* * [%error *]] *] ts)
3071 =(end.at.i.ts from.lex.i.t.ts)
2945 =(end.at.i.ts from.lex.i.t.ts)
@@ -3083,10 +2957,9 @@
3083 :: closes on its line (2.9). A bracket that needs none of these
2957 :: closes on its line (2.9). A bracket that needs none of these
3084 :: closes with the deeper lines instead (+shut). No later line can
2958 :: closes with the deeper lines instead (+shut). No later line can
3085 :: give it that, so the error is at the end of the line that took
2959 :: give it that, so the error is at the end of the line that took
3086− :: them (section 3, Errors). want is what it needs. It looks only when
2960+ :: them (section 3, Errors). want is what it needs. Only an error path
2961+ :: calls this, and it looks only when after begins with NEWLINE or
3087− :: after begins with NEWLINE or DEDENT, so it costs nothing on the way
2962+ :: DEDENT, so it costs nothing on the way to a tree.
3088− :: to a tree, except where a rune takes the rest of a body (+read-last):
3089− :: a look at that rune's line.
3091 ++ doomed
2964 ++ doomed
3092 |= [ts=(list token) after=(list token) want=tape]
2965 |= [ts=(list token) after=(list token) want=tape]
@@ -3243,7 +3116,7 @@
3243 ?: =(%'++' lex.rune)
3116 ?: =(%'++' lex.rune)
3244 ;< [nam=term after=(list token)] then (read-def-name rune t.ts)
3117 ;< [nam=term after=(list token)] then (read-def-name rune t.ts)
3245 ;< [e=expr more=(list token)] then
3118 ;< [e=expr more=(list token)] then
3246− (read-expr-or-body | "the name" after)
3119+ (read-expr-or-body "the name" after)
3247 [%& [%value [beg.at.rune end:(span-of e)] nam e] more]
3120 [%& [%value [beg.at.rune end:(span-of e)] nam e] more]
3248 ?: (is-closer rune)
3121 ?: (is-closer rune)
3249 %^ bad-why ts "a definition"
3122 %^ bad-why ts "a definition"
@@ -3323,36 +3196,20 @@
3323 [%& p.lex.i.ts t.ts]
3196 [%& p.lex.i.ts t.ts]
3325 :: +read-expr-or-body: a space and an expression on the line, or a
3198 :: +read-expr-or-body: a space and an expression on the line, or a
3326− :: body on deeper lines; what names what comes before, for errors.
3199+ :: body on deeper lines; what names what comes before, for errors
3327− :: On a body's final line (fin, +read-last), a line at the same depth
3328− :: is the rest of the body instead, and the expression on the line
3329− :: goes on with fin, except a ?-, which keeps its arms deeper
3331 ++ read-expr-or-body
3201 ++ read-expr-or-body
3332− |= [fin=? what=tape ts=(list token)]
3202+ |= [what=tape ts=(list token)]
3333 ^- (pare expr)
3203 ^- (pare expr)
3334 ?: ?=([[* * %indent] *] ts) (read-body t.ts)
3204 ?: ?=([[* * %indent] *] ts) (read-body t.ts)
3335− ?: &(fin ?=([[* * %newline] *] ts)) (read-rest t.ts)
3336 ?: ?=([[* * ?(%newline %dedent)] *] ts)
3205 ?: ?=([[* * ?(%newline %dedent)] *] ts)
3337 (bad ts "an expression, or a body on deeper lines")
3206 (bad ts "an expression, or a body on deeper lines")
3338 ?: &(?=(^ ts) tight.i.ts) (no-gap ts "a space after {what}")
3207 ?: &(?=(^ ts) tight.i.ts) (no-gap ts "a space after {what}")
3339− (read-last &(fin !?=([[* * %'?-'] *] ts)) ts)
3208+ (read-expr ts)
3341− :: +read-body: after its INDENT, the rest of a body, then its DEDENT
3210+ :: +read-body: after its INDENT, { definition NEWLINE } expr DEDENT
3343 ++ read-body
3212 ++ read-body
3346− ;< [e=expr after=(list token)] then (read-rest ts)
3347− ?> ?=([[* * %dedent] *] after)
3350− :: +read-rest: { definition NEWLINE } last, up to the DEDENT that ends
3351− :: a body, which it leaves for whatever opened the body: its INDENT's
3352− :: reader, or the rune on the final line that took the rest of it
3356 |= ts=(list token)
3213 |= ts=(list token)
3357 ^- (pare expr)
3214 ^- (pare expr)
3358 =| defs=(list def)
3215 =| defs=(list def)
@@ -3366,15 +3223,12 @@
3366 %: bad-in-why ts "a definition or an expression" plus-mask
3223 %: bad-in-why ts "a definition or an expression" plus-mask
3367 "`+` begins `++` or `+$`"
3224 "`+` begins `++` or `+$`"
3369− ;< [e=expr after=(list token)] then (read-last & ts)
3226+ ;< [e=expr after=(list token)] then (read-expr ts)
3370 ?: ?=([[* * %dedent] *] after)
3227 ?: ?=([[* * %dedent] *] after)
3371 =/ ds=(list def) (flop defs)
3228 =/ ds=(list def) (flop defs)
3372 =/ beg=loc ?~(ds beg:(span-of e) beg:(span-of i.ds))
3229 =/ beg=loc ?~(ds beg:(span-of e) beg:(span-of i.ds))
3373− [%& [%body [beg end:(span-of e)] ds e] after]
3230+ [%& [%body [beg end:(span-of e)] ds e] t.after]
3374 ?. ?=([[* * %newline] *] after) (bad-end-in after (tail-can e))
3231 ?. ?=([[* * %newline] *] after) (bad-end-in after (tail-can e))
3375− ?: &(?=(%branch -.e) !?=([* [* * ?(%'++' %'+$')] *] after))
3376− %^ bad-why after "the end of the body"
3377− "this `?-`'s arms are on deeper lines, so this one goes there too"
3378 %^ bad-why after "the end of the body"
3232 %^ bad-why after "the end of the body"
3379 "a body's final expression is its last line"
3233 "a body's final expression is its last line"
@@ -3383,24 +3237,13 @@
3383 ++ read-expr
3237 ++ read-expr
3384 |= ts=(list token)
3238 |= ts=(list token)
3385 ^- (pare expr)
3239 ^- (pare expr)
3388− :: +read-last: +read-expr, where fin says the expression is a body's
3389− :: final line or goes on one, with no bracket open before it: then
3390− :: the rune that ends the line may take the rest of the body at the
3391− :: same depth as its last child, and a ?- that begins the line its
3392− :: arms (section 3, The rest of a body)
3395− |= [fin=? ts=(list token)]
3397 ?~ ts (bad ts "an expression")
3240 ?~ ts (bad ts "an expression")
3398 =* t i.ts
3241 =* t i.ts
3399 ?+ lex.t (read-call ts)
3242 ?+ lex.t (read-call ts)
3400− %'|=' ?:((is-ctor ts) (read-call ts) (read-gate fin t t.ts))
3243+ %'|=' ?:((is-ctor ts) (read-call ts) (read-gate t t.ts))
3401− %'^-' (read-cast fin t t.ts)
3244+ %'^-' (read-cast t t.ts)
3402− %'~&' (read-trace fin t t.ts)
3245+ %'~&' (read-trace t t.ts)
3403− %'?-' (read-branch fin t t.ts)
3246+ %'?-' (read-branch t t.ts)
3406 :: +read-call: operand { operand }; one operand alone is itself
3249 :: +read-call: operand { operand }; one operand alone is itself
@@ -3615,9 +3458,9 @@
3615 (unclosed par ")" after)
3458 (unclosed par ")" after)
3616 ;< [els=(list expr) after=(list token)] then (read-operands ts)
3459 ;< [els=(list expr) after=(list token)] then (read-operands ts)
3617 ?: ?=([[* * %indent] *] after)
3460 ?: ?=([[* * %indent] *] after)
3618− ;< [ls=(list slot) more=(list token)] then
3461+ ;< [ls=(list item) more=(list token)] then
3619 (read-lines %group t.after)
3462 (read-lines %group t.after)
3620− =/ inner=expr (call-of (weld els (turn ls |=(i=slot val.i))))
3463+ =/ inner=expr (call-of (weld els (turn ls |=(i=item val.i))))
3621 [%& [%group [beg.at.par end:(span-of inner)] inner] more]
3464 [%& [%group [beg.at.par end:(span-of inner)] inner] more]
3623 ?: ?=([[* * ?(%newline %dedent)] *] after)
3466 ?: ?=([[* * ?(%newline %dedent)] *] after)
@@ -3642,7 +3485,7 @@
3643 ^- (pare expr)
3486 ^- (pare expr)
3644 =/ close=?(%')' %']') ?:(?=(%change kind) %')' %']')
3487 =/ close=?(%')' %']') ?:(?=(%change kind) %')' %']')
3645− =| its=(list slot)
3488+ =| its=(list item)
3646 |- ^- (pare expr)
3489 |- ^- (pare expr)
3647 ?~ ts (bad ts "an item")
3490 ?~ ts (bad ts "an item")
3648 =* t i.ts
3491 =* t i.ts
@@ -3650,8 +3493,8 @@
3650 [%& (bracket-node kind op target (flop its) end.at.t) t.ts]
3493 [%& (bracket-node kind op target (flop its) end.at.t) t.ts]
3651 ?: (is-closer t) (unclosed op (trip close) ts)
3494 ?: (is-closer t) (unclosed op (trip close) ts)
3652 ?: ?=(%indent lex.t)
3495 ?: ?=(%indent lex.t)
3653− ;< [ls=(list slot) more=(list token)] then (read-lines kind t.ts)
3496+ ;< [ls=(list item) more=(list token)] then (read-lines kind t.ts)
3654− =/ every=(list slot) (weld (flop its) ls)
3497+ =/ every=(list item) (weld (flop its) ls)
3655 =/ fin=loc ?~(every end.at.op end.at:(rear every))
3498 =/ fin=loc ?~(every end.at.op end.at:(rear every))
3656 [%& (bracket-node kind op target every fin) more]
3499 [%& (bracket-node kind op target every fin) more]
3657 ?: &(?=(^ its) (shut op `at.i.its ts))
3500 ?: &(?=(^ its) (shut op `at.i.its ts))
@@ -3659,21 +3502,21 @@
3659 ?: ?=(?(%newline %dedent) lex.t)
3502 ?: ?=(?(%newline %dedent) lex.t)
3660 (unclosed-open op (trip close) "an item" ts)
3503 (unclosed-open op (trip close) "an item" ts)
3661 ?: &(tight.t ?=(^ its)) (no-space ts)
3504 ?: &(tight.t ?=(^ its)) (no-space ts)
3662− ;< [i=slot more=(list token)] then (read-item kind ts)
3505+ ;< [i=item more=(list token)] then (read-item kind ts)
3663 $(its [i its], ts more)
3506 $(its [i its], ts more)
3665 :: +read-item: [ name= ] operand; a tuple's item may be named, a
3508 :: +read-item: [ name= ] operand; a tuple's item may be named, a
3666− :: change's must be, by a name or a wing, a list's is not
3509+ :: change's must be, a list's is not
3668 ++ read-item
3511 ++ read-item
3669 |= [kind=?(%tuple %list %change) ts=(list token)]
3512 |= [kind=?(%tuple %list %change) ts=(list token)]
3670− ^- (pare slot)
3513+ ^- (pare item)
3671− ?: &(?=([* * *] ts) (named-item kind ts))
3514+ ?: &(!?=(%list kind) ?=([[* * [%name *]] [* %& %'='] *] ts))
3672 =* nam i.ts
3515 =* nam i.ts
3673 =/ rest=(list token) t.t.ts
3516 =/ rest=(list token) t.t.ts
3674 ?: |(?=(~ rest) !tight.i.rest) (bad-space i.t.ts rest "a value")
3517 ?: |(?=(~ rest) !tight.i.rest) (bad-space i.t.ts rest "a value")
3675 ;< [v=expr after=(list token)] then (read-operand rest)
3518 ;< [v=expr after=(list token)] then (read-operand rest)
3676− [%& [[beg.at.nam end:(span-of v)] (names-of lex.nam) v] after]
3519+ [%& [[beg.at.nam end:(span-of v)] `p.lex.nam v] after]
3677 ?: ?=(%change kind) (unnamed ts)
3520 ?: ?=(%change kind) (unnamed ts)
3678 ?: &(?=(^ ts) (is-rune i.ts))
3521 ?: &(?=(^ ts) (is-rune i.ts))
3679 %: bad-in-why ts "an expression" operand-mask
3522 %: bad-in-why ts "an expression" operand-mask
@@ -3682,25 +3525,15 @@
3682 ;< [v=expr after=(list token)] then (read-operand ts)
3525 ;< [v=expr after=(list token)] then (read-operand ts)
3683 [%& [(span-of v) ~ v] after]
3526 [%& [(span-of v) ~ v] after]
3685− :: +named-item: whether ts begins an item's or a line's name=: a
3686− :: tuple's or a change's name, or a change's wing, then = tight
3689− |= [kind=?(%tuple %list %change %group) ts=(list token)]
3691− ?. ?=([* [* %& %'='] *] ts) |
3692− ?: ?=([[* * [%name *]] *] ts) ?=(?(%tuple %change) kind)
3693− &(?=(%change kind) ?=([[* * [%wing *]] *] ts))
3695 :: +read-lines: after an open bracket's INDENT, its lines, an item
3528 :: +read-lines: after an open bracket's INDENT, its lines, an item
3696 :: each, to its DEDENT
3529 :: each, to its DEDENT
3698 ++ read-lines
3531 ++ read-lines
3699 |= [kind=?(%tuple %list %change %group) ts=(list token)]
3532 |= [kind=?(%tuple %list %change %group) ts=(list token)]
3700− ^- (pare (list slot))
3533+ ^- (pare (list item))
3701− =| ls=(list slot)
3534+ =| ls=(list item)
3702− |- ^- (pare (list slot))
3535+ |- ^- (pare (list item))
3703− ;< [l=slot after=(list token)] then (read-line kind ts)
3536+ ;< [l=item after=(list token)] then (read-line kind ts)
3704 ?: ?=([[* * %newline] *] after) $(ls [l ls], ts t.after)
3537 ?: ?=([[* * %newline] *] after) $(ls [l ls], ts t.after)
3705 ?: ?=([[* * %dedent] *] after) [%& (flop [l ls]) t.after]
3538 ?: ?=([[* * %dedent] *] after) [%& (flop [l ls]) t.after]
3706 ?. ?=([[* * ?(%')' %']')] *] after) (bad-end-in after (tail-can val.l))
3539 ?. ?=([[* * ?(%')' %']')] *] after) (bad-end-in after (tail-can val.l))
@@ -3727,20 +3560,22 @@
3727 "its items end at the first line that isn't deeper"
3560 "its items end at the first line that isn't deeper"
3729 :: +read-line: an open bracket's line, [ name= ] expr; a tuple's may
3562 :: +read-line: an open bracket's line, [ name= ] expr; a tuple's may
3730− :: be named, a change's must be, by a name or a wing, a list's and a
3563+ :: be named, a change's must be, a list's and a group's are not
3731− :: group's are not (doc question)
3564+ :: (doc question)
3733 ++ read-line
3566 ++ read-line
3734 |= [kind=?(%tuple %list %change %group) ts=(list token)]
3567 |= [kind=?(%tuple %list %change %group) ts=(list token)]
3735− ^- (pare slot)
3568+ ^- (pare item)
3736 =/ cf (closer-first ts "an item")
3569 =/ cf (closer-first ts "an item")
3737 ?^ cf u.cf
3570 ?^ cf u.cf
3738− ?: &(?=([* * *] ts) (named-item kind ts))
3571+ ?: ?& ?=(?(%tuple %change) kind)
3572+ ?=([[* * [%name *]] [* %& %'='] *] ts)
3739 =* nam i.ts
3574 =* nam i.ts
3740 =/ rest=(list token) t.t.ts
3575 =/ rest=(list token) t.t.ts
3741 ?: |(?=(~ rest) !tight.i.rest) (bad-space i.t.ts rest "a value")
3576 ?: |(?=(~ rest) !tight.i.rest) (bad-space i.t.ts rest "a value")
3742 ;< [v=expr after=(list token)] then (read-expr rest)
3577 ;< [v=expr after=(list token)] then (read-expr rest)
3743− [%& [[beg.at.nam end:(span-of v)] (names-of lex.nam) v] after]
3578+ [%& [[beg.at.nam end:(span-of v)] `p.lex.nam v] after]
3744 ?: ?=(%change kind) (unnamed ts)
3579 ?: ?=(%change kind) (unnamed ts)
3745 ;< [v=expr after=(list token)] then (read-expr ts)
3580 ;< [v=expr after=(list token)] then (read-expr ts)
3746 [%& [(span-of v) ~ v] after]
3581 [%& [(span-of v) ~ v] after]
@@ -3777,11 +3612,10 @@
3777 %^ bad-why more (closing op ")")
3612 %^ bad-why more (closing op ")")
3778 "the wide gate's body is one operand, so a call goes in parentheses"
3613 "the wide gate's body is one operand, so a call goes in parentheses"
3780− :: +read-gate: |= sample, then an expression or a body; fin as for
3615+ :: +read-gate: |= sample, then an expression or a body
3783 ++ read-gate
3617 ++ read-gate
3784− |= [fin=? bar=token ts=(list token)]
3618+ |= [bar=token ts=(list token)]
3785 ^- (pare expr)
3619 ^- (pare expr)
3786 ?: &(?=(^ ts) tight.i.ts)
3620 ?: &(?=(^ ts) tight.i.ts)
3787 :: a % could begin a constructor's term, as |=%got
3621 :: a % could begin a constructor's term, as |=%got
@@ -3793,14 +3627,13 @@
3793 =/ dm (doomed ts after "an expression, or a body on deeper lines")
3627 =/ dm (doomed ts after "an expression, or a body on deeper lines")
3794 ?^ dm u.dm
3628 ?^ dm u.dm
3795 ;< [e=expr more=(list token)] then
3629 ;< [e=expr more=(list token)] then
3796− (read-expr-or-body fin "the sample" after)
3630+ (read-expr-or-body "the sample" after)
3797 [%& [%gate [beg.at.bar end:(span-of e)] s e] more]
3631 [%& [%gate [beg.at.bar end:(span-of e)] s e] more]
3799− :: +read-cast: ^- mold, then an expression or a body; fin as for
3633+ :: +read-cast: ^- mold, then an expression or a body
3802 ++ read-cast
3635 ++ read-cast
3803− |= [fin=? ket=token ts=(list token)]
3636+ |= [ket=token ts=(list token)]
3804 ^- (pare expr)
3637 ^- (pare expr)
3805 ?: &(?=(^ ts) tight.i.ts) (wide-rune "^-" ts)
3638 ?: &(?=(^ ts) tight.i.ts) (wide-rune "^-" ts)
3806 ;< [s=shape after=(list token)] then (read-mold ts)
3639 ;< [s=shape after=(list token)] then (read-mold ts)
@@ -3809,65 +3642,41 @@
3809 =/ dm (doomed ts after "an expression, or a body on deeper lines")
3642 =/ dm (doomed ts after "an expression, or a body on deeper lines")
3810 ?^ dm u.dm
3643 ?^ dm u.dm
3811 ;< [e=expr more=(list token)] then
3644 ;< [e=expr more=(list token)] then
3812− (read-expr-or-body fin "the mold" after)
3645+ (read-expr-or-body "the mold" after)
3813 [%& [%cast [beg.at.ket end:(span-of e)] s e] more]
3646 [%& [%cast [beg.at.ket end:(span-of e)] s e] more]
3815− :: +read-trace: ~& expr, then its body below, or, on a body's final
3648+ :: +read-trace: ~& expr, then its body below
3816− :: line (fin, +read-last), the rest of the body
3818 ++ read-trace
3650 ++ read-trace
3819− |= [fin=? sig=token ts=(list token)]
3651+ |= [sig=token ts=(list token)]
3820 ^- (pare expr)
3652 ^- (pare expr)
3821 ?: &(?=(^ ts) tight.i.ts) (wide-rune "~&" ts)
3653 ?: &(?=(^ ts) tight.i.ts) (wide-rune "~&" ts)
3822 ;< [v=expr after=(list token)] then (read-expr ts)
3654 ;< [v=expr after=(list token)] then (read-expr ts)
3655+ ?. ?=([[* * %indent] *] after)
3823− =/ dm (doomed ts after "`~&`'s body on deeper lines")
3656+ =/ dm (doomed ts after "`~&`'s body on deeper lines")
3824− ?^ dm u.dm
3657+ ?^ dm u.dm
3825− ;< [b=expr more=(list token)] then
3826− ?: ?=([[* * %indent] *] after) (read-body t.after)
3827− ?: &(fin ?=([[* * %newline] *] after)) (read-rest t.after)
3828 (bad after "`~&`'s body on deeper lines")
3658 (bad after "`~&`'s body on deeper lines")
3659+ ;< [b=expr more=(list token)] then (read-body t.after)
3829 [%& [%trace [beg.at.sig end:(span-of b)] v b] more]
3660 [%& [%trace [beg.at.sig end:(span-of b)] v b] more]
3831− :: +read-branch: ?- expr, then its arms below, one per line; or, when
3662+ :: +read-branch: ?- expr, then its arms below, one per line
3832− :: it begins a body's final line (fin, +read-last), at its own depth
3833− :: to the end of the body, whose DEDENT it leaves (+read-rest)
3835 ++ read-branch
3664 ++ read-branch
3836− |= [fin=? wut=token ts=(list token)]
3665+ |= [wut=token ts=(list token)]
3837 ^- (pare expr)
3666 ^- (pare expr)
3838 ?: &(?=(^ ts) tight.i.ts) (wide-rune "?-" ts)
3667 ?: &(?=(^ ts) tight.i.ts) (wide-rune "?-" ts)
3839 ;< [s=expr after=(list token)] then (read-expr ts)
3668 ;< [s=expr after=(list token)] then (read-expr ts)
3669+ ?. ?=([[* * %indent] *] after)
3840− =/ dm (doomed ts after "`?-`'s arms on deeper lines")
3670+ =/ dm (doomed ts after "`?-`'s arms on deeper lines")
3841− ?^ dm u.dm
3671+ ?^ dm u.dm
3842− ?. ?=([[* * ?(%indent %newline)] *] after)
3843 (bad after "`?-`'s arms on deeper lines")
3672 (bad after "`?-`'s arms on deeper lines")
3844− =/ flat=? ?=(%newline lex.i.after)
3845− ?: &(flat !fin) (bad after "`?-`'s arms on deeper lines")
3846 =| arms=(list arm)
3673 =| arms=(list arm)
3847 =/ rest=(list token) t.after
3674 =/ rest=(list token) t.after
3848 |- ^- (pare expr)
3675 |- ^- (pare expr)
3849− ;< [a=arm more=(list token)] then
3676+ ;< [a=arm more=(list token)] then (read-arm rest)
3850− ?:(flat (read-flat-arm rest) (read-arm rest))
3851 ?: ?=([[* * %newline] *] more) $(arms [a arms], rest t.more)
3677 ?: ?=([[* * %newline] *] more) $(arms [a arms], rest t.more)
3852 ?. ?=([[* * %dedent] *] more) (bad-end-in more (tail-can val.a))
3678 ?. ?=([[* * %dedent] *] more) (bad-end-in more (tail-can val.a))
3853− =/ at=span [beg.at.wut end.at.a]
3679+ [%& [%branch [beg.at.wut end.at.a] s (flop [a arms])] t.more]
3854− [%& [%branch at s (flop [a arms])] ?:(flat more t.more)]
3856− :: +read-flat-arm: +read-arm at its ?-'s depth, where a line that
3857− :: could begin the body's other lines gets a hint
3862− ?: ?=([[* * ?(%'++' %'+$')] *] ts)
3863− %: bad-in-why ts "a pattern" pattern-mask
3864− "a body's local definitions come before its final expression"
3866− ?: ?=([[* * ?(%'~&' %'^-')] *] ts)
3867− %: bad-in-why ts "a pattern" pattern-mask
3868− "a trace or cast goes in the arm's body"
3872 :: +read-arm: a pattern, then an expression or a body
3681 :: +read-arm: a pattern, then an expression or a body
@@ -3882,7 +3691,7 @@
3882 %^ bad-why after "a space after the pattern"
3691 %^ bad-why after "a space after the pattern"
3883 "patterns take no `name=`: a bare name binds, as [a b]"
3692 "patterns take no `name=`: a bare name binds, as [a b]"
3884 ;< [e=expr more=(list token)] then
3693 ;< [e=expr more=(list token)] then
3885− (read-expr-or-body | "the pattern" after)
3694+ (read-expr-or-body "the pattern" after)
3886 [%& [[beg:(span-of p) end:(span-of e)] p e] more]
3695 [%& [[beg:(span-of p) end:(span-of e)] p e] more]
3888 :: +read-pattern: a term, number, string, ship, loobean, ~, * or name,
3697 :: +read-pattern: a term, number, string, ship, loobean, ~, * or name,
@@ -4624,7 +4433,7 @@
4624++ outline-edit
4433++ outline-edit
4625 |= e=edit
4434 |= e=edit
4626 ^- outline
4435 ^- outline
4627− [%edit at.e ~[%name %wing] %kid ~[(outline-expr val.e)]]
4436+ [%edit at.e ~[%name] %kid ~[(outline-expr val.e)]]
4629++ outline-arm
4438++ outline-arm
4630 |= a=arm
4439 |= a=arm
@@ -4697,9 +4506,9 @@
4698:: Each case parses a source, checks that its spans pass, then moves
4507:: Each case parses a source, checks that its spans pass, then moves
4699:: the span of every node of a kind that starts at a place, as a
4508:: the span of every node of a kind that starts at a place, as a
4700−:: parser bug would, and checks that +check-spans says so.
4509+:: parser bug would, and checks that +check-spans says so. Run it as
4701−:: tests/lib/jibb-check-spans.hoon runs it, under eval with
4510+:: tools/hoon check-spans-test, which prints <<>> when every case
4702−:: tools/test-arms and on the ship.
4511+:: passes.
4704++ check-spans-test
4513++ check-spans-test
4705 ^- (list tape)
4514 ^- (list tape)
@@ -4798,13 +4607,8 @@
4798:: Atom constraints tied to an explicit capital or an inferred sample
4607:: Atom constraints tied to an explicit capital or an inferred sample
4799:: are generalized and printed. Other aura variables remain unsupported until
4608:: are generalized and printed. Other aura variables remain unsupported until
4800:: their defaulting and inferred generalization are implemented.
4609:: their defaulting and inferred generalization are implemented.
4801−:: Restricted-number promotion considers written capitals only; if there
4802−:: are none, it skips the otherwise unnecessary environment traversal.
4803:: Bare @ is a separate unrestricted atom type. A directional fit check
4610:: Bare @ is a separate unrestricted atom type. A directional fit check
4804−:: permits concrete atoms to widen to it, never the reverse. A bare
4611+:: permits concrete atoms to widen to it, never the reverse. A fit that
4805−:: decimal is a @ud: its variable binds only @ud or @u, it fits @ and *,
4806−:: and +decimal-misfit names it where it meets another aura (S4); a
4807−:: ++ generic over its aura generalizes it to any aura. A fit that
4808:: needs a not-yet-implemented constraint remains unsupported. Named unions
4612:: needs a not-yet-implemented constraint remains unsupported. Named unions
4809:: retain origin and ordered arguments, including phantom arguments, apart
4613:: retain origin and ordered arguments, including phantom arguments, apart
4810:: from their display name. Generic cases must be disjoint for all arguments.
4614:: from their display name. Generic cases must be disjoint for all arguments.
@@ -4824,14 +4628,6 @@
4824:: proofs to fewer than 1,024 cells; the projection planner has a separate
4628:: proofs to fewer than 1,024 cells; the projection planner has a separate
4825:: 4,096-step bound. These are inference limits, not language limits.
4629:: 4,096-step bound. These are inference limits, not language limits.
4827−:: `unface` is reserved with proj (+reserved-name) and is also handled by
4828−:: type: (unface e) has e's type with every face removed, through cells,
4829−:: gates and collection arguments, keeping unions and recursive molds
4830−:: whole (+itype-unface). It is not a value, it takes one argument, and
4831−:: a bare type variable is unsupported, as field access on one is. A ++
4832−:: whose body is (unface |= …) is a gate for recursion (+unfaced-gate).
4833−:: It lowers to its argument; no lowering is implemented yet.
4835:: Supported API imports derive request-gate types atomically for multiple
4631:: Supported API imports derive request-gate types atomically for multiple
4836:: paths, including one typed segment or one diff fold per case. Their checked
4632:: paths, including one typed segment or one diff fold per case. Their checked
4837:: ordinary definitions, mark molds and supported poke constructor are also
4633:: ordinary definitions, mark molds and supported poke constructor are also
@@ -4860,8 +4656,7 @@
4862 $~ [%var 0]
4658 $~ [%var 0]
4863− $% [%var id=@ud]
4659+ $% [%var id=@ud]
4865 [%avar id=@ud]
4660 [%avar id=@ud]
4866 [%rvar id=@ud]
4661 [%rvar id=@ud]
4867 [%nvar id=@ud]
4662 [%nvar id=@ud]
@@ -4870,13 +4665,11 @@
4870 [%any-atom ~]
4665 [%any-atom ~]
4871 [%flag ~]
4666 [%flag ~]
4872 [%noun ~]
4667 [%noun ~]
4874 [%tag id=@ud literal=lit constructor=?]
4668 [%tag id=@ud literal=lit constructor=?]
4875 [%const literal=lit]
4669 [%const literal=lit]
4876 [%collection name=term args=(list itype)]
4670 [%collection name=term args=(list itype)]
4877 [%recursive module=term name=term label=(unit @t)]
4671 [%recursive module=term name=term label=(unit @t)]
4878 [%jrec at=path name=term label=(unit @t) head=term aura=@ta tail=term]
4672 [%jrec at=path name=term label=(unit @t) head=term aura=@ta tail=term]
4879− [%grec at=path name=term label=(unit @t) proof=shape args=(list itype)]
4880 [%union cases=(list itype) origin=(unit [at=path name=term]) label=(unit @t) args=(list itype)]
4673 [%union cases=(list itype) origin=(unit [at=path name=term]) label=(unit @t) args=(list itype)]
4881 [%face name=term body=itype]
4674 [%face name=term body=itype]
4882 [%fn sample=itype product=itype]
4675 [%fn sample=itype product=itype]
@@ -4884,7 +4677,7 @@
4885+$ ibinding [id=@ud val=itype]
4678+$ ibinding [id=@ud val=itype]
4886+$ isub (list ibinding)
4679+$ isub (list ibinding)
4887−+$ ipending [id=@ud literal=lit at=span]
4680++$ ipending [id=@ud literal=lit]
4889++ itype-lookup
4682++ itype-lookup
4890 |= [n=@ud sub=isub]
4683 |= [n=@ud sub=isub]
@@ -4897,128 +4690,44 @@
4897 |= [t=itype sub=isub]
4690 |= [t=itype sub=isub]
4898 ^- itype
4691 ^- itype
4899 ?+ -.t t
4692 ?+ -.t t
4900− ?(%var %fvar)
4693+ %var
4901 =/ found=(unit itype) (itype-lookup id.t sub)
4694 =/ found=(unit itype) (itype-lookup id.t sub)
4902 ?~ found t
4695 ?~ found t
4903− ?: &(|(?=(%fvar -.u.found) ?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4696+ ?: &(|(?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4904 $(t u.found)
4697 $(t u.found)
4906 =/ found=(unit itype) (itype-lookup id.t sub)
4699 =/ found=(unit itype) (itype-lookup id.t sub)
4907 ?~ found t
4700 ?~ found t
4908− ?: &(|(?=(%fvar -.u.found) ?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4701+ ?: &(|(?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4909 $(t u.found)
4702 $(t u.found)
4911 =/ found=(unit itype) (itype-lookup id.t sub)
4704 =/ found=(unit itype) (itype-lookup id.t sub)
4912 ?~ found t
4705 ?~ found t
4913− ?: &(|(?=(%fvar -.u.found) ?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4706+ ?: &(|(?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4914 $(t u.found)
4707 $(t u.found)
4916 =/ found=(unit itype) (itype-lookup id.t sub)
4709 =/ found=(unit itype) (itype-lookup id.t sub)
4917 ?~ found t
4710 ?~ found t
4918− ?: &(|(?=(%fvar -.u.found) ?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4711+ ?: &(|(?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4919 $(t u.found)
4712 $(t u.found)
4921 =/ found=(unit itype) (itype-lookup id.t sub)
4714 =/ found=(unit itype) (itype-lookup id.t sub)
4922 ?~ found t
4715 ?~ found t
4923− ?: &(|(?=(%fvar -.u.found) ?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4716+ ?: &(|(?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4924 $(t u.found)
4717 $(t u.found)
4926 =/ found=(unit itype) (itype-lookup id.t sub)
4719 =/ found=(unit itype) (itype-lookup id.t sub)
4927 ?~ found t
4720 ?~ found t
4928− ?: &(|(?=(%fvar -.u.found) ?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4721+ ?: &(|(?=(%rvar -.u.found) ?=(%rnvar -.u.found)) =(id.t +.u.found)) u.found
4929 $(t u.found)
4722 $(t u.found)
4932−:: Prove only emptiness; unknown types are never treated as empty.
4933−:: A shared node budget bounds each proof attempt.
4934−++ itype-empty-cases
4935− |= [xs=(list itype) sub=isub fuel=@ud]
4936− ^- (unit [empty=? left=@ud])
4938− =/ first=(unit [empty=? left=@ud]) (itype-empty-proof i.xs sub fuel)
4940− ?. empty.u.first `[| left.u.first]
4941− $(xs t.xs, fuel left.u.first)
4942−++ itype-empty-proof
4943− |= [typ=itype sub=isub fuel=@ud]
4944− ^- (unit [empty=? left=@ud])
4947− =. typ (itype-walk typ sub)
4950− %face $(typ body.typ)
4952− =/ left=(unit [empty=? left=@ud]) $(typ hed.typ)
4954− ?: empty.u.left `[& left.u.left]
4955− $(typ tal.typ, fuel left.u.left)
4956− %union (itype-empty-cases cases.typ sub fuel)
4959−:: Prove reachability separately from emptiness. An unresolved fixed
4960−:: recursive type is not presumed inhabited. A written, still-unconstrained
4961−:: capital is existentially inhabited for pattern reachability; the normal
4962−:: definition-boundary checks reject subsequently constrained capitals.
4963−++ itype-inhabited-cases
4964− |= [xs=(list itype) sub=isub caps=icaps fuel=@ud pending=?]
4965− ^- (unit [result=?(%yes %no %unknown) left=@ud])
4966− ?~ xs `[?:(pending %unknown %no) fuel]
4967− =/ first=(unit [result=?(%yes %no %unknown) left=@ud])
4968− (itype-inhabited-proof i.xs sub caps fuel)
4970− ?: =(%yes result.u.first) first
4971− $(xs t.xs, fuel left.u.first, pending |(pending =(%unknown result.u.first)))
4972−++ itype-inhabited-proof
4973− |= [typ=itype sub=isub caps=icaps fuel=@ud]
4974− ^- (unit [result=?(%yes %no %unknown) left=@ud])
4977− =. typ (itype-walk typ sub)
4980− ?(%atom %any-atom %flag %const %noun %avar %rvar %nvar %rnvar %fn %jrec) `[%yes fuel]
4981− %fvar `[%unknown fuel]
4983− ?: (lien caps |=(c=icap (hole-same-variable typ (itype-walk [%var id.c] sub)))) `[%yes fuel]
4985− %face $(typ body.typ)
4987− =/ head=(unit [result=?(%yes %no %unknown) left=@ud]) $(typ hed.typ)
4989− ?: =(%no result.u.head) head
4990− =/ tail=(unit [result=?(%yes %no %unknown) left=@ud]) $(typ tal.typ, fuel left.u.head)
4992− ?: =(%no result.u.tail) tail
4993− ?: |(=(%unknown result.u.head) =(%unknown result.u.tail)) `[%unknown left.u.tail]
4994− `[%yes left.u.tail]
4995− %union (itype-inhabited-cases cases.typ sub caps fuel |)
4997− ?. &(|(=(%list name.typ) =(%unit name.typ)) ?=([* ~] args.typ)) `[%unknown fuel]
4999− %grec ?:((grec-tree-proof name.typ proof.typ) `[%yes fuel] `[%unknown fuel])
5003− |= [xs=(list itype) sub=isub caps=icaps fuel=@ud]
5004− ^- (unit (list itype))
5006− =/ first=(unit [result=?(%yes %no %unknown) left=@ud])
5007− (itype-inhabited-proof i.xs sub caps fuel)
5009− ?: =(%unknown result.u.first) ~
5010− =/ rest=(unit (list itype)) $(xs t.xs, fuel left.u.first)
5012− ?: =(%no result.u.first) rest
5015++ itype-occurs
4725++ itype-occurs
5016 |= [n=@ud t=itype sub=isub]
4726 |= [n=@ud t=itype sub=isub]
5018 =. t (itype-walk t sub)
4728 =. t (itype-walk t sub)
5020 %var =(n id.t)
4730 %var =(n id.t)
5022 %avar =(n id.t)
4731 %avar =(n id.t)
5023 %rvar =(n id.t)
4732 %rvar =(n id.t)
5024 %nvar =(n id.t)
4733 %nvar =(n id.t)
@@ -5027,13 +4736,11 @@
5027 %any-atom |
4736 %any-atom |
5031 %tag =(n id.t)
4739 %tag =(n id.t)
5032 %const |
4740 %const |
5033 %union |((lien cases.t |=(c=itype (itype-occurs n c sub))) (lien args.t |=(c=itype (itype-occurs n c sub))))
4741 %union |((lien cases.t |=(c=itype (itype-occurs n c sub))) (lien args.t |=(c=itype (itype-occurs n c sub))))
5034 %recursive |
4742 %recursive |
5036− %grec (lien args.t |=(c=itype (itype-occurs n c sub)))
5037 %collection (lien args.t |=(c=itype (itype-occurs n c sub)))
4744 %collection (lien args.t |=(c=itype (itype-occurs n c sub)))
5038 %face $(t body.t)
4745 %face $(t body.t)
5039 %fn |($(t sample.t) $(t product.t))
4746 %fn |($(t sample.t) $(t product.t))
@@ -5043,8 +4750,7 @@
5043:: +itype-unify: consistent substitutions, or ~ for a mismatch
4750:: +itype-unify: consistent substitutions, or ~ for a mismatch
5045:: Different concrete auras conflict. A variable may become an atom or
4752:: Different concrete auras conflict. A variable may become an atom or
5046−:: a function, but cannot contain itself. A decimal's variable binds
4753+:: a function, but cannot contain itself. Aura-only variables and faces
5047−:: only @ud or @u (+decimal-aura). Aura-only variables and faces
5048:: require further distinctions before this supports general Jibb.
4754:: require further distinctions before this supports general Jibb.
5050++ itype-unify
4756++ itype-unify
@@ -5053,9 +4759,6 @@
5053 =. a (itype-walk a sub)
4759 =. a (itype-walk a sub)
5054 =. b (itype-walk b sub)
4760 =. b (itype-walk b sub)
5055 ?: =(a b) `sub
4761 ?: =(a b) `sub
5056− ?: &(?=(%grec -.a) ?=(%grec -.b))
5057− ?. &(=(at.a at.b) =(name.a name.b)) ~
5058− (itype-unify-args args.a args.b sub)
5059 ?: &(?=(%jrec -.a) ?=(%jrec -.b))
4762 ?: &(?=(%jrec -.a) ?=(%jrec -.b))
5060 ?:(&(=(at.a at.b) =(name.a name.b) =(head.a head.b) =(aura.a aura.b) =(tail.a tail.b)) `sub ~)
4763 ?:(&(=(at.a at.b) =(name.a name.b) =(head.a head.b) =(aura.a aura.b) =(tail.a tail.b)) `sub ~)
5061 ?: &(?=(%recursive -.a) ?=(%recursive -.b))
4764 ?: &(?=(%recursive -.a) ?=(%recursive -.b))
@@ -5074,12 +4777,6 @@
5074 ?: ?=(%var -.b)
4777 ?: ?=(%var -.b)
5075 ?: (itype-occurs id.b a sub) ~
4778 ?: (itype-occurs id.b a sub) ~
5076 `[[id.b a] sub]
4779 `[[id.b a] sub]
5078− ?: (itype-occurs id.a b sub) ~
5079− (itype-bind-gate-free id.a b sub)
5081− ?: (itype-occurs id.b a sub) ~
5082− (itype-bind-gate-free id.b a sub)
5083 :: Arithmetic's aura variable excludes loobeans; decimal literals
4780 :: Arithmetic's aura variable excludes loobeans; decimal literals
5084 :: remain defaultable until a later constraint makes them concrete.
4781 :: remain defaultable until a later constraint makes them concrete.
5085 ?: &(?=(%nvar -.a) ?=(%rvar -.b))
4782 ?: &(?=(%nvar -.a) ?=(%rvar -.b))
@@ -5093,10 +4790,10 @@
5093 ?: &(?=(%rnvar -.a) ?=(%avar -.b)) `[[id.b a] sub]
4790 ?: &(?=(%rnvar -.a) ?=(%avar -.b)) `[[id.b a] sub]
5094 ?: &(?=(%avar -.a) ?=(%rnvar -.b)) `[[id.a b] sub]
4791 ?: &(?=(%avar -.a) ?=(%rnvar -.b)) `[[id.a b] sub]
5095 ?: ?=(%rnvar -.a)
4792 ?: ?=(%rnvar -.a)
5096− ?. |(?=(%rnvar -.b) &(?=(%atom -.b) (decimal-aura aura.b))) ~
4793+ ?. |(?=(%rnvar -.b) ?=(%atom -.b)) ~
5097 `[[id.a b] sub]
4794 `[[id.a b] sub]
5098 ?: ?=(%rnvar -.b)
4795 ?: ?=(%rnvar -.b)
5099− ?. &(?=(%atom -.a) (decimal-aura aura.a)) ~
4796+ ?. ?=(%atom -.a) ~
5100 `[[id.b a] sub]
4797 `[[id.b a] sub]
5101 ?: &(?=(%avar -.a) ?=(%rvar -.b)) `[[id.a b] sub]
4798 ?: &(?=(%avar -.a) ?=(%rvar -.b)) `[[id.a b] sub]
5102 ?: &(?=(%rvar -.a) ?=(%avar -.b)) `[[id.b a] sub]
4799 ?: &(?=(%rvar -.a) ?=(%avar -.b)) `[[id.b a] sub]
@@ -5107,15 +4804,14 @@
5107 ?. ?=(%atom -.a) ~
4804 ?. ?=(%atom -.a) ~
5108 `[[id.b a] sub]
4805 `[[id.b a] sub]
5109 :: The narrower decimal constraint survives a match with an atom
4806 :: The narrower decimal constraint survives a match with an atom
5110− :: variable; decimal syntax alone does not make it a loobean. A
4807+ :: variable; decimal syntax alone does not make it a loobean.
5111− :: concrete aura takes a decimal only if it is @ud or @u.
5112 ?: &(?=(%nvar -.a) ?=(%avar -.b)) `[[id.b a] sub]
4808 ?: &(?=(%nvar -.a) ?=(%avar -.b)) `[[id.b a] sub]
5113 ?: &(?=(%avar -.a) ?=(%nvar -.b)) `[[id.a b] sub]
4809 ?: &(?=(%avar -.a) ?=(%nvar -.b)) `[[id.a b] sub]
5114 ?: ?=(%nvar -.a)
4810 ?: ?=(%nvar -.a)
5115− ?. |(?=(%nvar -.b) &(?=(%atom -.b) (decimal-aura aura.b))) ~
4811+ ?. |(?=(%nvar -.b) ?=(%atom -.b)) ~
5116 `[[id.a b] sub]
4812 `[[id.a b] sub]
5117 ?: ?=(%nvar -.b)
4813 ?: ?=(%nvar -.b)
5118− ?. &(?=(%atom -.a) (decimal-aura aura.a)) ~
4814+ ?. ?=(%atom -.a) ~
5119 `[[id.b a] sub]
4815 `[[id.b a] sub]
5120 ?: ?=(%avar -.a)
4816 ?: ?=(%avar -.a)
5121 ?. |(?=(%avar -.b) ?=(%atom -.b) ?=(%any-atom -.b) ?=(%flag -.b)) ~
4817 ?. |(?=(%avar -.b) ?=(%atom -.b) ?=(%any-atom -.b) ?=(%flag -.b)) ~
@@ -5139,98 +4835,6 @@
5139 $(a tal.a, b tal.b, sub u.first)
4835 $(a tal.a, b tal.b, sub u.first)
5142−:: +itype-unface: t with every face removed, for (unface e)
5144−:: It strips through cells, through a gate's sample and product and
5145−:: through a built-in collection's arguments, the prelude's unit
5146−:: included, walking bound variables. Other unions and recursive
5147−:: molds are compared by name or by their exact cases, so stripping
5148−:: inside them would stop them from fitting their own name: they are
5149−:: kept whole. An unbound variable stays, so faces it is bound to
5150−:: later are kept. The unit keeps its own u=, as a list keeps i= and
5154− |= [t=itype sub=isub]
5156− =. t (itype-walk t sub)
5159− %cell [%cell $(t hed.t) $(t tal.t)]
5160− %fn [%fn $(t sample.t) $(t product.t)]
5161− %collection [%collection name.t (turn args.t |=(a=itype ^$(t a)))]
5163− ?. =(origin.t `[/lib/jibb/prelude/jibb %unit]) t
5164− ?. ?=([* ~] args.t) t
5165− =/ nil=itype [%const [%null %n 0 '~']]
5166− ?. =(cases.t ~[nil [%cell nil [%face %u i.args.t]]]) t
5167− =/ arg=itype $(t i.args.t)
5168− t(cases ~[nil [%cell nil [%face %u arg]]], args ~[arg])
5171−+$ igf-form [typ=itype sub=isub left=@ud]
5172−+$ igf-forms [types=(list itype) sub=isub left=@ud]
5173−++ itype-gate-free-forms
5174− |= [xs=(list itype) sub=isub fuel=@ud]
5175− ^- (unit igf-forms)
5176− ?~ xs `[~ sub fuel]
5177− =/ head=(unit igf-form) (itype-gate-free-form i.xs sub fuel)
5179− =/ tail=(unit igf-forms) $(xs t.xs, sub sub.u.head, fuel left.u.head)
5181− `[[typ.u.head types.u.tail] sub.u.tail left.u.tail]
5183−++ itype-gate-free-form
5184− |= [t=itype sub=isub fuel=@ud]
5188− =. t (itype-walk t sub)
5191− =/ free=itype [%fvar id.t]
5192− `[free [[id.t free] sub] fuel]
5193− %fvar `[t sub fuel]
5194− ?(%atom %any-atom %flag %const %empty %avar %rvar %nvar %rnvar %jrec) `[t sub fuel]
5196− =/ body=(unit igf-form) $(t body.t, sub sub, fuel fuel)
5198− `[[%face name.t typ.u.body] sub.u.body left.u.body]
5200− =/ head=(unit igf-form) $(t hed.t, sub sub, fuel fuel)
5202− =/ tail=(unit igf-form) $(t tal.t, sub sub.u.head, fuel left.u.head)
5204− `[[%cell typ.u.head typ.u.tail] sub.u.tail left.u.tail]
5206− =/ args=(unit igf-forms) (itype-gate-free-forms args.t sub fuel)
5208− `[[%collection name.t types.u.args] sub.u.args left.u.args]
5210− =/ cases=(unit igf-forms) (itype-gate-free-forms cases.t sub fuel)
5212− =/ args=(unit igf-forms) (itype-gate-free-forms args.t sub.u.cases left.u.cases)
5214− `[[%union types.u.cases origin.t label.t types.u.args] sub.u.args left.u.args]
5218−++ itype-collection-keys
5219− |= [name=term args=(list itype) sub=isub]
5220− ^- (unit [types=(list itype) sub=isub])
5222− ?. |(?=(?(%set %map %mop %jar %jug) name)) `[args sub]
5223− =/ key=(unit igf-form) (itype-gate-free-form i.args sub 256)
5225− `[[typ.u.key t.args] sub.u.key]
5227−++ itype-bind-gate-free
5228− |= [n=@ud t=itype sub=isub]
5230− =/ constrained=(unit igf-form) (itype-gate-free-form t sub 256)
5232− `[[n typ.u.constrained] sub.u.constrained]
5234++ itype-unify-args
4838++ itype-unify-args
5235 |= [as=(list itype) bs=(list itype) sub=isub]
4839 |= [as=(list itype) bs=(list itype) sub=isub]
5236 ^- (unit isub)
4840 ^- (unit isub)
@@ -5252,22 +4856,19 @@
5252 =. t (itype-walk t sub)
4856 =. t (itype-walk t sub)
5259− %rnvar |
4862+ %rnvar |
5261 %any-atom &
4864 %any-atom &
5266 %const |
4868 %const |
5267 %union |((lien cases.t |=(c=itype (itype-has-any-atom c sub))) (lien args.t |=(c=itype (itype-has-any-atom c sub))))
4869 %union |((lien cases.t |=(c=itype (itype-has-any-atom c sub))) (lien args.t |=(c=itype (itype-has-any-atom c sub))))
5268 %recursive |
4870 %recursive |
5270− %grec (lien args.t |=(c=itype (itype-has-any-atom c sub)))
5271 %collection (lien args.t |=(c=itype (itype-has-any-atom c sub)))
4872 %collection (lien args.t |=(c=itype (itype-has-any-atom c sub)))
5272 %face $(t body.t)
4873 %face $(t body.t)
5273 %fn |($(t sample.t) $(t product.t))
4874 %fn |($(t sample.t) $(t product.t))
@@ -5289,16 +4890,6 @@
5289 ?. =(i.a i.b) |
4890 ?. =(i.a i.b) |
5290 $(a t.a, b t.b)
4891 $(a t.a, b t.b)
5292−:: +decimal-aura: whether a bare decimal fits an atom of this aura
5294−:: A decimal is a @ud, so as in Hoon it fits @ud and its ancestors
5295−:: @u and @; every other aura takes its own literal (S4).
5300− (aura-prefix aura %ud)
5302:: Related auras in a structural unification need a common-type rule;
4893:: Related auras in a structural unification need a common-type rule;
5303:: until that rule is implemented, report an unknown rather than error.
4894:: until that rule is implemented, report an unknown rather than error.
@@ -5339,7 +4930,6 @@
5340 ?- -.typ
4931 ?- -.typ
@@ -5348,13 +4938,11 @@
5348 %any-atom &
4938 %any-atom &
5353 %const &
4942 %const &
5354 %union |((lien cases.typ |=(c=itype (itype-has-fixed-atom c))) (lien args.typ |=(c=itype (itype-has-fixed-atom c))))
4943 %union |((lien cases.typ |=(c=itype (itype-has-fixed-atom c))) (lien args.typ |=(c=itype (itype-has-fixed-atom c))))
5355 %recursive |
4944 %recursive |
5357− %grec (lien args.typ |=(c=itype (itype-has-fixed-atom c)))
5358 %collection (lien args.typ |=(c=itype (itype-has-fixed-atom c)))
4946 %collection (lien args.typ |=(c=itype (itype-has-fixed-atom c)))
5359 %face $(typ body.typ)
4947 %face $(typ body.typ)
5360 %fn |($(typ sample.typ) $(typ product.typ))
4948 %fn |($(typ sample.typ) $(typ product.typ))
@@ -5370,84 +4958,10 @@
5370 ?: (aura-prefix aura.a aura.b) `a
4958 ?: (aura-prefix aura.a aura.b) `a
5371 ?: (aura-prefix aura.b aura.a) `b
4959 ?: (aura-prefix aura.b aura.a) `b
5373− ?: &(?=(%any-atom -.a) |(?=(%atom -.b) ?=(%flag -.b) ?=(%const -.b) ?=(%avar -.b) ?=(%rvar -.b) ?=(%nvar -.b) ?=(%rnvar -.b))) `a
4961+ ?: &(?=(%any-atom -.a) |(?=(%atom -.b) ?=(%flag -.b))) `a
5374− ?: &(?=(%any-atom -.b) |(?=(%atom -.a) ?=(%flag -.a) ?=(%const -.a) ?=(%avar -.a) ?=(%rvar -.a) ?=(%nvar -.a) ?=(%rnvar -.a))) `b
4962+ ?: &(?=(%any-atom -.b) |(?=(%atom -.a) ?=(%flag -.a))) `b
5377−++ itype-branch-join
5378− |= [a=itype b=itype sub=isub]
5379− ^- (unit [typ=itype sub=isub])
5380− =/ unified=(unit isub) (itype-unify a b sub)
5381− ?^ unified `[(itype-normalize a u.unified) u.unified]
5382− =/ common=(unit itype) (itype-concrete-join a b sub)
5386−++ itype-branch-join-with
5387− |= [candidate=itype types=(list itype) sub=isub]
5388− ^- (unit [typ=itype sub=isub])
5389− ?~ types `[(itype-normalize candidate sub) sub]
5390− =/ joined=(unit [typ=itype sub=isub]) (itype-branch-join candidate i.types sub)
5392− $(candidate typ.u.joined, types t.types, sub sub.u.joined)
5394−++ itype-branch-unify-list
5395− |= [types=(list itype) sub=isub]
5396− ^- (unit [typ=itype sub=isub])
5398− =/ candidate=itype i.types
5399− =/ rest=(list itype) t.types
5401− ?~ rest `[(itype-normalize candidate sub) sub]
5402− =/ unified=(unit isub) (itype-unify candidate i.rest sub)
5404− $(candidate (itype-normalize candidate u.unified), rest t.rest, sub u.unified)
5406−++ itype-branch-any-atom
5407− |= [types=(list itype) sub=isub]
5410− =/ typ=itype (itype-walk i.types sub)
5411− ?: ?=(%any-atom -.typ) `typ
5414−++ itype-branch-atom-parent
5415− |= [candidate=itype types=(list itype) sub=isub]
5417− ?~ types `candidate
5418− =/ typ=itype (itype-walk i.types sub)
5419− ?. ?=(%atom -.typ) $(types t.types)
5420− =/ joined=(unit itype) (itype-concrete-join candidate typ sub)
5422− $(candidate u.joined, types t.types)
5424−++ itype-branch-atom-candidates
5425− |= [candidates=(list itype) types=(list itype) sub=isub]
5428− =/ candidate=itype (itype-walk i.candidates sub)
5429− ?. ?=(%atom -.candidate) $(candidates t.candidates)
5430− =/ parent=(unit itype) (itype-branch-atom-parent candidate types sub)
5432− $(candidates t.candidates)
5434−++ itype-branch-parent
5435− |= [types=(list itype) sub=isub]
5437− =/ unrestricted=(unit itype) (itype-branch-any-atom types sub)
5438− ?^ unrestricted unrestricted
5439− (itype-branch-atom-candidates types types sub)
5441−++ itype-branch-join-list
5442− |= [types=(list itype) sub=isub]
5443− ^- (unit [typ=itype sub=isub])
5445− =/ unified=(unit [typ=itype sub=isub]) (itype-branch-unify-list types sub)
5447− =/ parent=(unit itype) (itype-branch-parent types sub)
5449− (itype-branch-join-with u.parent types sub)
5451:: Unifying an already-bound tuple with a faced position would need to
4965:: Unifying an already-bound tuple with a faced position would need to
5452:: update the bound type. Until substitutions can retain that information,
4966:: update the bound type. Until substitutions can retain that information,
5453:: variable-dependent face merges stay unresolved.
4967:: variable-dependent face merges stay unresolved.
@@ -5457,7 +4971,6 @@
5458 =. t (itype-walk t sub)
4972 =. t (itype-walk t sub)
5460− %grec (lien args.t |=(c=itype (itype-has-face c sub)))
5461 %collection (lien args.t |=(c=itype (itype-has-face c sub)))
4974 %collection (lien args.t |=(c=itype (itype-has-face c sub)))
5463 %cell |($(t hed.t) $(t tal.t))
4976 %cell |($(t hed.t) $(t tal.t))
@@ -5514,15 +5027,12 @@
5515 =. a (itype-walk a sub)
5028 =. a (itype-walk a sub)
5516 =. b (itype-walk b sub)
5029 =. b (itype-walk b sub)
5517− ?: &(?=(%grec -.a) ?=(%grec -.b))
5518− ?. &(=(at.a at.b) =(name.a name.b)) |
5519− (itype-face-asym-collection-args args.a args.b sub)
5520 ?: &(?=(%collection -.a) ?=(%collection -.b))
5030 ?: &(?=(%collection -.a) ?=(%collection -.b))
5521 ?. =(name.a name.b) |
5031 ?. =(name.a name.b) |
5522 (itype-face-asym-collection-args args.a args.b sub)
5032 (itype-face-asym-collection-args args.a args.b sub)
5523 ?: &(?=(%face -.a) ?=(%face -.b)) $(a body.a, b body.b)
5033 ?: &(?=(%face -.a) ?=(%face -.b)) $(a body.a, b body.b)
5524− ?: ?=(%face -.a) !|(?=(%var -.b) ?=(%fvar -.b) ?=(%avar -.b) ?=(%rvar -.b) |(?=(%nvar -.b) ?=(%rnvar -.b)))
5034+ ?: ?=(%face -.a) !|(?=(%var -.b) ?=(%avar -.b) ?=(%rvar -.b) |(?=(%nvar -.b) ?=(%rnvar -.b)))
5525− ?: ?=(%face -.b) !|(?=(%var -.a) ?=(%fvar -.a) ?=(%avar -.a) ?=(%rvar -.a) |(?=(%nvar -.a) ?=(%rnvar -.a)))
5035+ ?: ?=(%face -.b) !|(?=(%var -.a) ?=(%avar -.a) ?=(%rvar -.a) |(?=(%nvar -.a) ?=(%rnvar -.a)))
5526 ?: &(?=(%cell -.a) ?=(%cell -.b)) |($(a hed.a, b hed.b) $(a tal.a, b tal.b))
5036 ?: &(?=(%cell -.a) ?=(%cell -.b)) |($(a hed.a, b hed.b) $(a tal.a, b tal.b))
5527 ?: &(?=(%fn -.a) ?=(%fn -.b)) |($(a sample.a, b sample.b) $(a product.a, b product.b))
5037 ?: &(?=(%fn -.a) ?=(%fn -.b)) |($(a sample.a, b sample.b) $(a product.a, b product.b))
@@ -5579,7 +5089,6 @@
5579 %union &
5089 %union &
5580 %recursive &
5090 %recursive &
5584 %collection &
5093 %collection &
5585 %face $(t body.t)
5094 %face $(t body.t)
@@ -5594,13 +5103,6 @@
5594 ?~ (itype-lookup id.i.tags sub) &
5103 ?~ (itype-lookup id.i.tags sub) &
5595 $(tags t.tags)
5104 $(tags t.tags)
5597−++ pending-tag-diagnostic
5598− |= [tags=(list ipending) sub=isub]
5599− ^- (unit [at=span msg=tape])
5601− ?^ (itype-lookup id.i.tags sub) $(tags t.tags)
5602− `[at.i.tags (weld "nothing fixes the union of " (show-lit literal.i.tags))]
5604++ pending-null
5106++ pending-null
5605 |= [tags=(list ipending) sub=isub]
5107 |= [tags=(list ipending) sub=isub]
@@ -5616,7 +5118,6 @@
5619− %grec (lien args.t |=(c=itype (itype-has-tag c)))
5620 %collection (lien args.t |=(c=itype (itype-has-tag c)))
5121 %collection (lien args.t |=(c=itype (itype-has-tag c)))
5621 %face $(t body.t)
5122 %face $(t body.t)
5622 %fn |($(t sample.t) $(t product.t))
5123 %fn |($(t sample.t) $(t product.t))
@@ -5630,7 +5131,6 @@
5632 %union &
5133 %union &
5633− %grec (lien args.t |=(c=itype (itype-has-union c)))
5634 %collection (lien args.t |=(c=itype (itype-has-union c)))
5134 %collection (lien args.t |=(c=itype (itype-has-union c)))
5635 %face $(t body.t)
5135 %face $(t body.t)
5636 %fn |($(t sample.t) $(t product.t))
5136 %fn |($(t sample.t) $(t product.t))
@@ -5649,7 +5149,6 @@
5650 ?: &(?=(~ label.t) ?=(^ args.t)) &
5150 ?: &(?=(~ label.t) ?=(^ args.t)) &
5651 (lien (weld args.t cases.t) |=(c=itype (itype-has-hidden-generic c)))
5151 (lien (weld args.t cases.t) |=(c=itype (itype-has-hidden-generic c)))
5652− %grec |(?=(~ label.t) (lien args.t |=(c=itype (itype-has-hidden-generic c))))
5653 %collection (lien args.t |=(c=itype (itype-has-hidden-generic c)))
5152 %collection (lien args.t |=(c=itype (itype-has-hidden-generic c)))
5654 %face $(t body.t)
5153 %face $(t body.t)
5655 %fn |($(t sample.t) $(t product.t))
5154 %fn |($(t sample.t) $(t product.t))
@@ -5663,7 +5162,6 @@
5664 %recursive &
5163 %recursive &
5667 %collection (lien args.t |=(c=itype (itype-has-recursive c)))
5165 %collection (lien args.t |=(c=itype (itype-has-recursive c)))
5668 %union (lien (weld args.t cases.t) |=(c=itype (itype-has-recursive c)))
5166 %union (lien (weld args.t cases.t) |=(c=itype (itype-has-recursive c)))
5669 %face $(t body.t)
5167 %face $(t body.t)
@@ -5678,7 +5176,6 @@
5679 %recursive ?=(~ label.t)
5177 %recursive ?=(~ label.t)
5680 %jrec ?=(~ label.t)
5178 %jrec ?=(~ label.t)
5681− %grec |(?=(~ label.t) (lien args.t |=(c=itype (itype-has-hidden-recursive c))))
5682 %collection (lien args.t |=(c=itype (itype-has-hidden-recursive c)))
5179 %collection (lien args.t |=(c=itype (itype-has-hidden-recursive c)))
5683 %union (lien (weld args.t cases.t) |=(c=itype (itype-has-hidden-recursive c)))
5180 %union (lien (weld args.t cases.t) |=(c=itype (itype-has-hidden-recursive c)))
5684 %face $(t body.t)
5181 %face $(t body.t)
@@ -5724,7 +5221,7 @@
5724 ?: ?=(%var -.raw)
5221 ?: ?=(%var -.raw)
5725 $(cases t.cases, pending &)
5222 $(cases t.cases, pending &)
5726 =/ c=itype (itype-walk raw sub)
5223 =/ c=itype (itype-walk raw sub)
5727− ?: ?=(?(%var %tag %recursive %jrec %grec %union %face) -.c)
5224+ ?: ?=(?(%var %tag %recursive %jrec %union %face) -.c)
5728 $(cases t.cases, pending &)
5225 $(cases t.cases, pending &)
5729 ?. ?=(%cell -.c) $(cases t.cases)
5226 ?. ?=(%cell -.c) $(cases t.cases)
5730 =/ raw-head=itype hed.c
5227 =/ raw-head=itype hed.c
@@ -5737,7 +5234,7 @@
5737 ?: ?=(?(%atom %any-atom %flag %avar %rvar %nvar %rnvar) -.body.head)
5234 ?: ?=(?(%atom %any-atom %flag %avar %rvar %nvar %rnvar) -.body.head)
5738 $(cases t.cases)
5235 $(cases t.cases)
5739 $(cases t.cases, pending &)
5236 $(cases t.cases, pending &)
5740− ?: ?=(?(%var %tag %recursive %jrec %grec %union) -.head)
5237+ ?: ?=(?(%var %tag %recursive %jrec %union) -.head)
5741 $(cases t.cases, pending &)
5238 $(cases t.cases, pending &)
5742 ?. ?=(%const -.head) $(cases t.cases)
5239 ?. ?=(%const -.head) $(cases t.cases)
5743 ?. =(val.literal.head val.tag) $(cases t.cases)
5240 ?. =(val.literal.head val.tag) $(cases t.cases)
@@ -5755,14 +5252,7 @@
5755++ itype-fit
5252++ itype-fit
5756 |= [actual=itype expected=itype sub=isub next=@ud]
5253 |= [actual=itype expected=itype sub=isub next=@ud]
5758− =/ result=ifit (itype-fit-inner actual expected sub next | |)
5255+ (itype-fit-inner actual expected sub next | |)
5759− ?: ?=(%ok -.result) result
5760− =/ source=itype (itype-walk actual sub)
5761− ?. ?=(?(%empty %face %cell %union) -.source) result
5762− =/ empty=(unit [empty=? left=@ud]) (itype-empty-proof actual sub 256)
5763− ?~ empty [%unknown ~]
5764− ?: empty.u.empty [%ok sub next]
5766++ itype-fit-inner
5256++ itype-fit-inner
5767 |= [actual=itype expected=itype sub=isub next=@ud skip-width=? spine-proof=?]
5257 |= [actual=itype expected=itype sub=isub next=@ud skip-width=? spine-proof=?]
@@ -5775,13 +5265,12 @@
5775 ?: too-wide [%unknown ~]
5265 ?: too-wide [%unknown ~]
5776 =/ spine-checked=? |(spine-proof ?=(^ known))
5266 =/ spine-checked=? |(spine-proof ?=(^ known))
5777 =/ uncertain=?
5267 =/ uncertain=?
5778− |(?=(%var -.actual) ?=(%fvar -.actual) ?=(%avar -.actual) ?=(%rvar -.actual) |(?=(%nvar -.actual) ?=(%rnvar -.actual)) ?=(%var -.expected) ?=(%fvar -.expected) ?=(%avar -.expected) ?=(%rvar -.expected) |(?=(%nvar -.expected) ?=(%rnvar -.expected)))
5268+ |(?=(%var -.actual) ?=(%avar -.actual) ?=(%rvar -.actual) |(?=(%nvar -.actual) ?=(%rnvar -.actual)) ?=(%var -.expected) ?=(%avar -.expected) ?=(%rvar -.expected) |(?=(%nvar -.expected) ?=(%rnvar -.expected)))
5779 =/ actual-open=?
5269 =/ actual-open=?
5780− |(?=(%var -.actual) ?=(%fvar -.actual) ?=(%avar -.actual) ?=(%rvar -.actual) |(?=(%nvar -.actual) ?=(%rnvar -.actual)))
5270+ |(?=(%var -.actual) ?=(%avar -.actual) ?=(%rvar -.actual) |(?=(%nvar -.actual) ?=(%rnvar -.actual)))
5781 =. actual (itype-walk actual sub)
5271 =. actual (itype-walk actual sub)
5782 =. expected (itype-walk expected sub)
5272 =. expected (itype-walk expected sub)
5783 ?: =(actual expected) [%ok sub next]
5273 ?: =(actual expected) [%ok sub next]
5784− ?: &(?=(%empty -.expected) |(?=(%cell -.actual) ?=(%face -.actual) ?=(%union -.actual) ?=(%grec -.actual) ?=(%recursive -.actual))) [%unknown ~]
5785 :: The relation of the source loobean mold to explicit @f is not yet
5274 :: The relation of the source loobean mold to explicit @f is not yet
5786 :: established. Keep it unsupported rather than asserting a mismatch.
5275 :: established. Keep it unsupported rather than asserting a mismatch.
5787 ?: &(?=(%flag -.actual) ?=(%atom -.expected) =(%f aura.expected)) [%unknown ~]
5276 ?: &(?=(%flag -.actual) ?=(%atom -.expected) =(%f aura.expected)) [%unknown ~]
@@ -5794,14 +5283,6 @@
5794 [%ok sub next]
5283 [%ok sub next]
5795 :: An arbitrary noun is not known to fit a narrower type.
5284 :: An arbitrary noun is not known to fit a narrower type.
5796 ?: &(?=(%noun -.actual) !?=(%var -.expected)) [%unknown ~]
5285 ?: &(?=(%noun -.actual) !?=(%var -.expected)) [%unknown ~]
5797− ?: &(!uncertain ?=(%grec -.actual) ?=(%face -.expected)) $(expected body.expected)
5798− ?: &(!uncertain ?=(%face -.actual) ?=(%grec -.expected)) $(actual body.actual)
5799− ?: &(?=(%grec -.actual) ?=(%grec -.expected))
5800− ?. &(=(at.actual at.expected) =(name.actual name.expected)) [%unknown ~]
5801− =/ matched=(unit isub) (itype-unify-args args.actual args.expected sub)
5802− ?~ matched [%unknown ~]
5803− [%ok u.matched next]
5804− ?: &(|(?=(%grec -.actual) ?=(%grec -.expected)) !|(?=(%var -.actual) ?=(%var -.expected))) [%unknown ~]
5805 ?: &(!uncertain ?=(%jrec -.actual) ?=(%face -.expected)) $(expected body.expected)
5286 ?: &(!uncertain ?=(%jrec -.actual) ?=(%face -.expected)) $(expected body.expected)
5806 ?: &(!uncertain ?=(%face -.actual) ?=(%jrec -.expected)) $(actual body.actual)
5287 ?: &(!uncertain ?=(%face -.actual) ?=(%jrec -.expected)) $(actual body.actual)
5807 ?: &(?=(%jrec -.actual) ?=(%jrec -.expected))
5288 ?: &(?=(%jrec -.actual) ?=(%jrec -.expected))
@@ -5832,7 +5313,7 @@
5832 ?: &(!uncertain ?=(%union -.actual) ?=(%face -.expected))
5313 ?: &(!uncertain ?=(%union -.actual) ?=(%face -.expected))
5833 $(expected body.expected)
5314 $(expected body.expected)
5834 ?: ?=(%union -.actual) [%unknown ~]
5315 ?: ?=(%union -.actual) [%unknown ~]
5835− ?: &(?=(%union -.expected) |(?=(%fvar -.actual) ?=(%avar -.actual) ?=(%rvar -.actual) |(?=(%nvar -.actual) ?=(%rnvar -.actual)))) [%unknown ~]
5316+ ?: &(?=(%union -.expected) |(?=(%avar -.actual) ?=(%rvar -.actual) |(?=(%nvar -.actual) ?=(%rnvar -.actual)))) [%unknown ~]
5836 ?: &(?=(%union -.expected) !?=(%var -.actual))
5317 ?: &(?=(%union -.expected) !?=(%var -.actual))
5837 (itype-fit-cases actual cases.expected sub next)
5318 (itype-fit-cases actual cases.expected sub next)
5838 ?: ?=(%tag -.actual)
5319 ?: ?=(%tag -.actual)
@@ -5840,7 +5321,7 @@
5840 =/ u=(unit isub) (itype-unify actual expected sub)
5321 =/ u=(unit isub) (itype-unify actual expected sub)
5841 ?~ u [%bad ~]
5322 ?~ u [%bad ~]
5842 [%ok u.u next]
5323 [%ok u.u next]
5843− ?: |(?=(%fvar -.expected) ?=(%avar -.expected) ?=(%rvar -.expected) |(?=(%nvar -.expected) ?=(%rnvar -.expected))) [%unknown ~]
5324+ ?: |(?=(%avar -.expected) ?=(%rvar -.expected) |(?=(%nvar -.expected) ?=(%rnvar -.expected))) [%unknown ~]
5844 ?: ?=(%face -.expected) $(expected body.expected)
5325 ?: ?=(%face -.expected) $(expected body.expected)
5845 ?: constructor.actual
5326 ?: constructor.actual
5846 ?. ?=(%fn -.expected) [%bad ~]
5327 ?. ?=(%fn -.expected) [%bad ~]
@@ -5868,7 +5349,7 @@
5868 =/ u=(unit isub) (itype-unify actual expected sub)
5349 =/ u=(unit isub) (itype-unify actual expected sub)
5869 ?~ u [%bad ~]
5350 ?~ u [%bad ~]
5870 [%ok u.u next]
5351 [%ok u.u next]
5871− ?: |(?=(%fvar -.expected) ?=(%avar -.expected) ?=(%rvar -.expected) |(?=(%nvar -.expected) ?=(%rnvar -.expected))) [%unknown ~]
5352+ ?: |(?=(%avar -.expected) ?=(%rvar -.expected) |(?=(%nvar -.expected) ?=(%rnvar -.expected))) [%unknown ~]
5872 ?: ?=(%face -.expected) $(expected body.expected)
5353 ?: ?=(%face -.expected) $(expected body.expected)
5873 ?: &(?=(%collection -.expected) =(%list name.expected) =(0 val.literal.actual))
5354 ?: &(?=(%collection -.expected) =(%list name.expected) =(0 val.literal.actual))
5874 [%unknown ~]
5355 [%unknown ~]
@@ -5885,13 +5366,6 @@
5885 ?:(|(=(0 val.literal.actual) =(1 val.literal.actual)) [%ok sub next] [%bad ~])
5366 ?:(|(=(0 val.literal.actual) =(1 val.literal.actual)) [%ok sub next] [%bad ~])
5886 ?: ?=(%any-atom -.expected) [%ok sub next]
5367 ?: ?=(%any-atom -.expected) [%ok sub next]
5887 [%bad ~]
5368 [%bad ~]
5888− :: A field on an expected sample slot labels the value's type; it does
5889− :: not become a face on the actual argument. Unify with the slot body
5890− :: rather than binding either variable to the face around the other.
5891− ?: &(?=(%var -.actual) ?=(%face -.expected))
5892− =/ unified=(unit isub) (itype-unify actual body.expected sub)
5893− ?~ unified [%unknown ~]
5894− [%ok u.unified next]
5895 ?: &(uncertain (itype-face-asym actual expected sub)) [%unknown ~]
5369 ?: &(uncertain (itype-face-asym actual expected sub)) [%unknown ~]
5896 :: A known face labels the same noun. Peel it before applying the
5370 :: A known face labels the same noun. Peel it before applying the
5897 :: directional unrestricted-atom rule, preserving raw-variable guards.
5371 :: directional unrestricted-atom rule, preserving raw-variable guards.
@@ -5911,7 +5385,7 @@
5911 =/ unified=(unit isub) (itype-unify actual expected sub)
5385 =/ unified=(unit isub) (itype-unify actual expected sub)
5912 ?~ unified [%bad ~]
5386 ?~ unified [%bad ~]
5913 [%ok u.unified next]
5387 [%ok u.unified next]
5914− ?: |(?=(%fvar -.expected) ?=(%avar -.expected) ?=(%rvar -.expected) |(?=(%nvar -.expected) ?=(%rnvar -.expected))) [%unknown ~]
5388+ ?: |(?=(%avar -.expected) ?=(%rvar -.expected) |(?=(%nvar -.expected) ?=(%rnvar -.expected))) [%unknown ~]
5915 [%bad ~]
5389 [%bad ~]
5916 ?: &(?=(%atom -.actual) ?=(%atom -.expected))
5390 ?: &(?=(%atom -.actual) ?=(%atom -.expected))
5917 ?: (aura-prefix aura.expected aura.actual) [%ok sub next]
5391 ?: (aura-prefix aura.expected aura.actual) [%ok sub next]
@@ -5921,10 +5395,18 @@
5921 =/ first=ifit $(actual hed.actual, expected hed.expected, skip-width |, spine-proof |)
5395 =/ first=ifit $(actual hed.actual, expected hed.expected, skip-width |, spine-proof |)
5922 ?. ?=(%ok -.first) first
5396 ?. ?=(%ok -.first) first
5923 $(actual tal.actual, expected tal.expected, sub sub.first, next next.first, skip-width spine-checked, spine-proof spine-checked)
5397 $(actual tal.actual, expected tal.expected, sub sub.first, next next.first, skip-width spine-checked, spine-proof spine-checked)
5398+ :: A field may add a face to an occurrence of the very same type
5399+ :: variable. Binding that variable to a face around itself would fail
5400+ :: the occurs check, but its underlying type has already matched.
5401+ ?: &(?=(%var -.actual) ?=(%face -.expected) =(actual (itype-walk body.expected sub)))
5403+ :: Differing variables and faces need propagation that is not yet
5404+ :: represented. Binding one to the face can create a false mismatch.
5405+ ?: &(?=(%var -.actual) ?=(%face -.expected)) [%unknown ~]
5924 ?: &(?=(%face -.actual) ?=(%var -.expected)) [%unknown ~]
5406 ?: &(?=(%face -.actual) ?=(%var -.expected)) [%unknown ~]
5925 ?: &(?=(%var -.actual) (itype-has-any-atom expected sub))
5407 ?: &(?=(%var -.actual) (itype-has-any-atom expected sub))
5926 [%unknown ~]
5408 [%unknown ~]
5927− ?: |(?=(%var -.actual) ?=(%var -.expected) ?=(%fvar -.expected))
5409+ ?: |(?=(%var -.actual) ?=(%var -.expected))
5928 =/ unified=(unit isub) (itype-unify actual expected sub)
5410 =/ unified=(unit isub) (itype-unify actual expected sub)
5929 ?~ unified
5411 ?~ unified
5930 ?: |(?=(%face -.actual) ?=(%face -.expected)) [%unknown ~]
5412 ?: |(?=(%face -.actual) ?=(%face -.expected)) [%unknown ~]
@@ -6004,54 +5486,6 @@
6004 (itype-fit [%collection %list ~[a]] list-t ~[[0 recursive]] 1)
5486 (itype-fit [%collection %list ~[a]] list-t ~[[0 recursive]] 1)
6005 =? problems !?=(%unknown -.nested-fit)
5487 =? problems !?=(%unknown -.nested-fit)
6006 ["recursive types behind substitutions should remain uncertain" problems]
5488 ["recursive types behind substitutions should remain uncertain" problems]
6007− =/ free=itype [%fvar 40]
6008− =/ open-cell=itype [%cell [%var 41] [%face %x [%var 42]]]
6009− =/ constrained=(unit isub) (itype-unify free open-cell ~)
6010− =/ expected-cell=itype [%cell [%fvar 41] [%face %x [%fvar 42]]]
6011− =? problems !=(constrained [~ [[40 expected-cell] [[42 [%fvar 42]] [[41 [%fvar 41]] ~]]]])
6012− ["gate-free constraints should propagate through cells and faces" problems]
6013− =? problems ?=(^ (itype-unify free open-cell ~[[41 [%fn txt txt]]]))
6014− ["an existing nested gate substitution should be rejected" problems]
6015− =/ shared-sub=isub [[42 [%fvar 42]] [[41 [%fvar 41]] ~]]
6016− =? problems ?=(^ (itype-unify [%var 41] [%fn txt txt] shared-sub))
6017− ["a later nested gate substitution should be rejected" problems]
6018− =? problems ?=(^ (itype-unify free [%fn txt txt] ~))
6019− ["a gate-free variable should reject a gate" problems]
6020− =? problems ?=(^ (itype-unify free [%noun ~] ~))
6021− ["a gate-free variable should reject an opaque noun" problems]
6022− =/ atom-strong=(unit isub) (itype-unify [%avar 43] free ~)
6023− =? problems !=(atom-strong [~ [[40 [%avar 43]] ~]])
6024− ["the atom constraint should be stronger than gate-free" problems]
6025− =/ free-fit=ifit (itype-fit txt free ~ 44)
6026− =? problems !?=(%ok -.free-fit)
6027− ["a concrete atom should fit a gate-free variable" problems]
6028− =/ gate-fit=ifit (itype-fit [%fn txt txt] free ~ 44)
6029− =? problems !?=(%bad -.gate-fit)
6030− ["a gate should not fit a gate-free variable" problems]
6031− =/ free-scheme=ischeme [[%fn free free] ~[40]]
6032− =/ canonical-free=itype (canonical-itype typ.free-scheme vars.free-scheme)
6033− =? problems !=(canonical-free [%fn [%fvar 0] [%fvar 0]])
6034− ["canonicalization should retain gate-free variables" problems]
6035− =? problems !=((show-atom-constraint canonical-free) " where A contains no gates")
6036− ["the printer should show gate-free constraints" problems]
6037− =/ decimal=itype [%nvar 50]
6038− =? problems ?=(~ (itype-unify decimal num ~))
6039− ["a decimal should unify with @ud" problems]
6040− =? problems ?=(~ (itype-unify [%atom %u] decimal ~))
6041− ["a decimal should unify with @u" problems]
6042− =? problems ?=(^ (itype-unify decimal [%atom %dr] ~))
6043− ["a decimal should not unify with @dr" problems]
6044− =? problems ?=(^ (itype-unify [%atom %ux] decimal ~))
6045− ["a decimal should not unify with @ux" problems]
6046− =/ restricted=(unit isub) (itype-unify decimal [%rvar 51] ~)
6047− =? problems |(?=(~ restricted) ?=(^ (itype-unify [%rvar 51] [%atom %p] u.restricted)))
6048− ["arithmetic should keep a decimal's aura rule" problems]
6049− =/ decimal-any=ifit (itype-fit decimal [%any-atom ~] ~ 52)
6050− =? problems !?=(%ok -.decimal-any)
6051− ["a decimal should fit @" problems]
6052− =/ decimal-noun=ifit (itype-fit decimal [%noun ~] ~ 52)
6053− =? problems !?=(%ok -.decimal-noun)
6054− ["a decimal should fit a noun" problems]
6055 problems
5489 problems
6057:: The expression inference below is deliberately a fragment: bindings,
5491:: The expression inference below is deliberately a fragment: bindings,
@@ -6068,14 +5502,10 @@
6068:: of an arbitrary ask value. Reader graphs and source inputs are trusted.
5502:: of an arbitrary ask value. Reader graphs and source inputs are trusted.
6069+$ irequest-evidence
5503+$ irequest-evidence
6070 [api-at=path name=term path=iapi-path-typed api-source=@t public-source=@t internal-source=@t prelude-values=(list term) prelude-molds=(list term) externals=iexternals marks=imark-externals]
5504 [api-at=path name=term path=iapi-path-typed api-source=@t public-source=@t internal-source=@t prelude-values=(list term) prelude-molds=(list term) externals=iexternals marks=imark-externals]
6071−:: Store requests have their own source-bound evidence. In particular, an
6072−:: API path certificate cannot make a store state member watchable, or vice versa.
6073−+$ istore-request-evidence
6074− [store-at=path source=@t state=itype action-name=term action=itype]
6075:: A unit distinguishes a verified empty closure from a detached legacy file.
5505:: A unit distinguishes a verified empty closure from a detached legacy file.
6076:: The opaque prelude is an exact trusted input, not a recursive interface mold.
5506:: The opaque prelude is an exact trusted input, not a recursive interface mold.
6077+$ irequest-graph
5507+$ irequest-graph
6078− [paths=(set path) requests=(list irequest-evidence) stores=(list istore-request-evidence) bundle-input=* prelude-input=* prelude-values=(list term) prelude-molds=(list term) externals=iexternals marks=imark-externals]
5508+ [paths=(set path) requests=(list irequest-evidence) bundle-input=* prelude-input=* prelude-values=(list term) prelude-molds=(list term) externals=iexternals marks=imark-externals]
6079+$ ifile [values=ienv molds=imold-types at=path derived=(list iderived) elaborations=(list iwidth-definition) dependencies=(list iwidth-dependency) source=(unit @t) graph=(unit irequest-graph)]
5509+$ ifile [values=ienv molds=imold-types at=path derived=(list iderived) elaborations=(list iwidth-definition) dependencies=(list iwidth-dependency) source=(unit @t) graph=(unit irequest-graph)]
6080+$ ijimports (list [face=term interface=ifile])
5510+$ ijimports (list [face=term interface=ifile])
6081+$ icap [name=@t id=@ud at=span]
5511+$ icap [name=@t id=@ud at=span]
@@ -6221,7 +5651,6 @@
6221 =/ head=igate-free $(typ hed.typ, path [[%head ~] path])
5651 =/ head=igate-free $(typ hed.typ, path [[%head ~] path])
6222 =/ tail=igate-free $(typ tal.typ, fuel left.head, path [[%tail ~] path])
5652 =/ tail=igate-free $(typ tal.typ, fuel left.head, path [[%tail ~] path])
6223 =/ inhabited=? &(inhabited.head inhabited.tail)
5653 =/ inhabited=? &(inhabited.head inhabited.tail)
6224− ?: |(&(=(%yes verdict.head) !inhabited.head) &(=(%yes verdict.tail) !inhabited.tail)) [%yes | left.tail ~]
6225 ?: &(=(%no verdict.head) inhabited.tail) head(left left.tail)
5654 ?: &(=(%no verdict.head) inhabited.tail) head(left left.tail)
6226 ?: &(=(%no verdict.tail) inhabited.head) tail
5655 ?: &(=(%no verdict.tail) inhabited.head) tail
6227 ?: |(!=(%yes verdict.head) !=(%yes verdict.tail)) [%unknown inhabited left.tail ~]
5656 ?: |(!=(%yes verdict.head) !=(%yes verdict.tail)) [%unknown inhabited left.tail ~]
@@ -6235,9 +5664,7 @@
6235 ?~ cases.typ [%unknown | fuel ~]
5664 ?~ cases.typ [%unknown | fuel ~]
6236 (gate-free-types cases.typ fuel path 0)
5665 (gate-free-types cases.typ fuel path 0)
6237 %noun [%unknown & fuel ~]
5666 %noun [%unknown & fuel ~]
6238− %empty [%yes | fuel ~]
6239 %var [%unknown | fuel ~]
5667 %var [%unknown | fuel ~]
6240− %fvar [%yes & fuel ~]
6241 %avar [%yes & fuel ~]
5668 %avar [%yes & fuel ~]
6242 %rvar [%yes & fuel ~]
5669 %rvar [%yes & fuel ~]
6243 %nvar [%yes & fuel ~]
5670 %nvar [%yes & fuel ~]
@@ -6245,12 +5672,10 @@
6245 %tag [%unknown | fuel ~]
5672 %tag [%unknown | fuel ~]
6246 %recursive [%unknown | fuel ~]
5673 %recursive [%unknown | fuel ~]
6247 %jrec [%yes & fuel ~]
5674 %jrec [%yes & fuel ~]
6248− %grec [%unknown | fuel ~]
6251+$ igate-prelude-evidence [iface=ifile gates=(map term def)]
5677+$ igate-prelude-evidence [iface=ifile gates=(map term def)]
6252−+$ dgo [left=itype right=itype at=span context=span]
6253−+$ istate [next=@ud sub=isub caps=icaps binders=(list @ud) molds=imolds globals=(list term) externals=iexternals surs=(list term) mark-externals=imark-externals marks=(list term) jimports=ijimports reserved-molds=(list term) params=iparams active=(list term) tags=(list ipending) in-mold=? at=path top-molds=(list term) prelude=(unit ifile) holes=(list ihole) jrec-fuel=@ud projections=(list iwprojection) gate-defs=(map term def) head-evidence=(unit igate-prelude-evidence) grec-index=(unit [at=path source=@t prelude=ifile shapes=(map term shape)]) defer=(unit ~) obligations=(list dgo)]
5678++$ istate [next=@ud sub=isub caps=icaps binders=(list @ud) molds=imolds globals=(list term) externals=iexternals surs=(list term) mark-externals=imark-externals marks=(list term) jimports=ijimports reserved-molds=(list term) params=iparams active=(list term) tags=(list ipending) in-mold=? at=path top-molds=(list term) prelude=(unit ifile) holes=(list ihole) jrec-fuel=@ud projections=(list iwprojection) gate-defs=(map term def) head-evidence=(unit igate-prelude-evidence)]
6254+$ idiag [msg=tape sites=(list [at=span note=tape])]
5679+$ idiag [msg=tape sites=(list [at=span note=tape])]
6255+$ iresult (each [typ=itype state=istate] idiag)
5680+$ iresult (each [typ=itype state=istate] idiag)
6256+$ isample-result (each [typ=itype env=ienv state=istate] tape)
5681+$ isample-result (each [typ=itype env=ienv state=istate] tape)
@@ -6270,7 +5695,6 @@
6270 |= [t=itype sub=isub]
5695 |= [t=itype sub=isub]
6271 ^- itype
5696 ^- itype
6272 =. t (itype-walk t sub)
5697 =. t (itype-walk t sub)
6273− ?: ?=(%grec -.t) t(args (turn args.t |=(c=itype (itype-normalize c sub))))
6274 ?: ?=(%collection -.t) [%collection name.t (turn args.t |=(c=itype (itype-normalize c sub)))]
5698 ?: ?=(%collection -.t) [%collection name.t (turn args.t |=(c=itype (itype-normalize c sub)))]
6275 ?: ?=(%union -.t)
5699 ?: ?=(%union -.t)
6276 [%union (turn cases.t |=(c=itype (itype-normalize c sub))) origin.t label.t (turn args.t |=(c=itype (itype-normalize c sub)))]
5700 [%union (turn cases.t |=(c=itype (itype-normalize c sub))) origin.t label.t (turn args.t |=(c=itype (itype-normalize c sub)))]
@@ -6297,23 +5721,20 @@
6297 %cell |($(t hed.t) $(t tal.t))
5721 %cell |($(t hed.t) $(t tal.t))
6298 %recursive |
5722 %recursive |
6301 %collection (lien args.t |=(c=itype (itype-has-gate c)))
5724 %collection (lien args.t |=(c=itype (itype-has-gate c)))
6302 %face $(t body.t)
5725 %face $(t body.t)
6303 %union (lien cases.t |=(c=itype (itype-has-gate c)))
5726 %union (lien cases.t |=(c=itype (itype-has-gate c)))
6305 %const |
5728 %const |
6311− %rnvar |
5733+ %rnvar |
6313 %any-atom |
5735 %any-atom |
6319++ default-decimals
5740++ default-decimals
@@ -6323,7 +5744,6 @@
6324 %nvar [%atom %ud]
5745 %nvar [%atom %ud]
6325 %rnvar [%atom %ud]
5746 %rnvar [%atom %ud]
6326− %grec t(args (turn args.t |=(c=itype (default-decimals c))))
6327 %collection [%collection name.t (turn args.t |=(c=itype (default-decimals c)))]
5747 %collection [%collection name.t (turn args.t |=(c=itype (default-decimals c)))]
6328 %face [%face name.t $(t body.t)]
5748 %face [%face name.t $(t body.t)]
6329 %cell [%cell $(t hed.t) $(t tal.t)]
5749 %cell [%cell $(t hed.t) $(t tal.t)]
@@ -6339,7 +5759,6 @@
6339 ^- (unit @ud)
5759 ^- (unit @ud)
6341 %var `id.t
5761 %var `id.t
6343 %avar `id.t
5762 %avar `id.t
6344 %rvar `id.t
5763 %rvar `id.t
6345 %nvar `id.t
5764 %nvar `id.t
@@ -6360,13 +5779,12 @@
6361 =. t (itype-walk t sub.state)
5780 =. t (itype-walk t sub.state)
6363− ?(%var %fvar %avar %rvar %nvar %rnvar)
5782+ ?(%var %avar %rvar %nvar %rnvar)
6364 ?: (lien caps.state |=(c=icap (hole-same-variable t (itype-walk [%var id.c] sub.state)))) &
5783 ?: (lien caps.state |=(c=icap (hole-same-variable t (itype-walk [%var id.c] sub.state)))) &
6365 (lien params.state |=(p=[name=@t typ=itype] (hole-same-variable t (itype-walk typ.p sub.state))))
5784 (lien params.state |=(p=[name=@t typ=itype] (hole-same-variable t (itype-walk typ.p sub.state))))
6367 %any-atom &
5786 %any-atom &
6368 %union &((levy cases.t |=(c=itype (hole-known c state))) (levy args.t |=(c=itype (hole-known c state))))
5787 %union &((levy cases.t |=(c=itype (hole-known c state))) (levy args.t |=(c=itype (hole-known c state))))
6369− %grec (levy args.t |=(c=itype (hole-known c state)))
6370 %collection (levy args.t |=(c=itype (hole-known c state)))
5788 %collection (levy args.t |=(c=itype (hole-known c state)))
6371 %face $(t body.t)
5789 %face $(t body.t)
6372 %fn &($(t sample.t) $(t product.t))
5790 %fn &($(t sample.t) $(t product.t))
@@ -6376,8 +5794,6 @@
6376++ promote-restricted-numbers
5794++ promote-restricted-numbers
6377 |= [state=istate env=ienv]
5795 |= [state=istate env=ienv]
6378 ^- istate
5796 ^- istate
6379− :: With no written capitals, there is nothing to promote.
6380− ?~ caps.state state
6381 =/ ids=(list @ud) (turn caps.state |=(c=icap id.c))
5797 =/ ids=(list @ud) (turn caps.state |=(c=icap id.c))
6382 =/ free=(list @ud) (free-env-vars env sub.state)
5798 =/ free=(list @ud) (free-env-vars env sub.state)
@@ -6412,9 +5828,8 @@
6413 =. t (itype-walk t sub.state)
5829 =. t (itype-walk t sub.state)
6415− ?(%tag %nvar %rnvar %fvar %avar %rvar) !(hole-known t state)
5831+ ?(%tag %nvar %rnvar %avar %rvar) !(hole-known t state)
6416 %union |((lien cases.t |=(c=itype (hole-uncertain c state))) (lien args.t |=(c=itype (hole-uncertain c state))))
5832 %union |((lien cases.t |=(c=itype (hole-uncertain c state))) (lien args.t |=(c=itype (hole-uncertain c state))))
6417− %grec (lien args.t |=(c=itype (hole-uncertain c state)))
6418 %collection (lien args.t |=(c=itype (hole-uncertain c state)))
5833 %collection (lien args.t |=(c=itype (hole-uncertain c state)))
6419 %face $(t body.t)
5834 %face $(t body.t)
6420 %fn |($(t sample.t) $(t product.t))
5835 %fn |($(t sample.t) $(t product.t))
@@ -6430,19 +5845,14 @@
6430 ?~ work ~
5845 ?~ work ~
6431 ?: (hole-known [%var id.i.work] state) $(work t.work)
5846 ?: (hole-known [%var id.i.work] state) $(work t.work)
6432 ?: (hole-uncertain [%var id.i.work] state)
5847 ?: (hole-uncertain [%var id.i.work] state)
6433− `[uncertain-hole-msg ~[[at.i.work "type hole"]]]
5848+ `["type hole needs unsupported inference" ~[[at.i.work "type hole"]]]
6434 `["type hole needs a determined type" ~[[at.i.work "unresolved type hole"]]]
5849 `["type hole needs a determined type" ~[[at.i.work "unresolved type hole"]]]
6436−:: +uncertain-hole-msg: unsupported, though it names the hole's site
6438−++ uncertain-hole-msg "type hole needs unsupported inference"
6440++ itype-vars
5851++ itype-vars
6441 |= t=itype
5852 |= t=itype
6442 ^- (list @ud)
5853 ^- (list @ud)
6444 %var ~[id.t]
5855 %var ~[id.t]
6446 %avar ~[id.t]
5856 %avar ~[id.t]
6447 %rvar ~[id.t]
5857 %rvar ~[id.t]
6448 %nvar ~[id.t]
5858 %nvar ~[id.t]
@@ -6451,13 +5861,11 @@
6451 %any-atom ~
5861 %any-atom ~
6456 %const ~
5865 %const ~
6457 %union (zing (turn (weld args.t cases.t) |=(c=itype (itype-vars c))))
5866 %union (zing (turn (weld args.t cases.t) |=(c=itype (itype-vars c))))
6458 %recursive ~
5867 %recursive ~
6460− %grec (zing (turn args.t |=(c=itype (itype-vars c))))
6461 %collection (zing (turn args.t |=(c=itype (itype-vars c))))
5869 %collection (zing (turn args.t |=(c=itype (itype-vars c))))
6462 %face $(t body.t)
5870 %face $(t body.t)
6463 %fn (weld $(t sample.t) $(t product.t))
5871 %fn (weld $(t sample.t) $(t product.t))
@@ -6481,10 +5889,6 @@
6481 =/ found=(unit itype) (itype-lookup id.t ren)
5889 =/ found=(unit itype) (itype-lookup id.t ren)
6482 ?~ found t
5890 ?~ found t
6485− =/ found=(unit itype) (itype-lookup id.t ren)
6489 =/ found=(unit itype) (itype-lookup id.t ren)
5893 =/ found=(unit itype) (itype-lookup id.t ren)
6490 ?~ found t
5894 ?~ found t
@@ -6505,13 +5909,11 @@
6505 %any-atom t
5909 %any-atom t
6510 %const t
5913 %const t
6511 %union [%union (turn cases.t |=(c=itype (itype-rename c ren))) origin.t label.t (turn args.t |=(c=itype (itype-rename c ren)))]
5914 %union [%union (turn cases.t |=(c=itype (itype-rename c ren))) origin.t label.t (turn args.t |=(c=itype (itype-rename c ren)))]
6512 %recursive t
5915 %recursive t
6514− %grec t(args (turn args.t |=(c=itype (itype-rename c ren))))
6515 %collection [%collection name.t (turn args.t |=(c=itype (itype-rename c ren)))]
5917 %collection [%collection name.t (turn args.t |=(c=itype (itype-rename c ren)))]
6516 %face [%face name.t $(t body.t)]
5918 %face [%face name.t $(t body.t)]
6517 %fn [%fn $(t sample.t) $(t product.t)]
5919 %fn [%fn $(t sample.t) $(t product.t)]
@@ -6526,7 +5928,6 @@
6530 %avar =(n id.t)
5931 %avar =(n id.t)
6531 %rvar =(n id.t)
5932 %rvar =(n id.t)
6532 %nvar =(n id.t)
5933 %nvar =(n id.t)
@@ -6535,13 +5936,11 @@
6535 %any-atom |
5936 %any-atom |
6540 %const |
5940 %const |
6541 %union |((lien cases.t |=(c=itype (itype-var-is-atom n c))) (lien args.t |=(c=itype (itype-var-is-atom n c))))
5941 %union |((lien cases.t |=(c=itype (itype-var-is-atom n c))) (lien args.t |=(c=itype (itype-var-is-atom n c))))
6542 %recursive |
5942 %recursive |
6544− %grec (lien args.t |=(c=itype (itype-var-is-atom n c)))
6545 %collection (lien args.t |=(c=itype (itype-var-is-atom n c)))
5944 %collection (lien args.t |=(c=itype (itype-var-is-atom n c)))
6546 %face $(t body.t)
5945 %face $(t body.t)
6547 %fn |($(t sample.t) $(t product.t))
5946 %fn |($(t sample.t) $(t product.t))
@@ -6552,7 +5951,6 @@
6557 %rvar =(n id.t)
5955 %rvar =(n id.t)
@@ -6561,13 +5959,11 @@
6561 %any-atom |
5959 %any-atom |
6566 %const |
5963 %const |
6567 %union |((lien cases.t |=(c=itype (itype-var-is-restricted n c))) (lien args.t |=(c=itype (itype-var-is-restricted n c))))
5964 %union |((lien cases.t |=(c=itype (itype-var-is-restricted n c))) (lien args.t |=(c=itype (itype-var-is-restricted n c))))
6568 %recursive |
5965 %recursive |
6570− %grec (lien args.t |=(c=itype (itype-var-is-restricted n c)))
6571 %collection (lien args.t |=(c=itype (itype-var-is-restricted n c)))
5967 %collection (lien args.t |=(c=itype (itype-var-is-restricted n c)))
6572 %face $(t body.t)
5968 %face $(t body.t)
6573 %fn |($(t sample.t) $(t product.t))
5969 %fn |($(t sample.t) $(t product.t))
@@ -6577,89 +5973,15 @@
6577:: Canonical numbering makes printed variables independent of the order
5973:: Canonical numbering makes printed variables independent of the order
6578:: the unifier happened to allocate intermediates.
5974:: the unifier happened to allocate intermediates.
6580−++ itype-var-is-gate-free-fuel
6581− |= [n=@ud t=itype fuel=@ud]
6588− %union |((lien cases.t |=(c=itype (itype-var-is-gate-free-fuel n c fuel))) (lien args.t |=(c=itype (itype-var-is-gate-free-fuel n c fuel))))
6589− %grec (lien args.t |=(c=itype (itype-var-is-gate-free-fuel n c fuel)))
6590− %collection (lien args.t |=(c=itype (itype-var-is-gate-free-fuel n c fuel)))
6591− %face $(t body.t, fuel fuel)
6592− %fn |($(t sample.t, fuel fuel) $(t product.t, fuel fuel))
6593− %cell |($(t hed.t, fuel fuel) $(t tal.t, fuel fuel))
6597−++ itype-var-is-gate-free
6600− (itype-var-is-gate-free-fuel n t 256)
6602−:: +named-var: the ID of the nth type variable, written as name
6604−:: An ID counts in its low 64 bits. The name a variable was written
6605−:: with, as Msg, sits above them, or 0 for none, so the name travels
6606−:: with the variable through substitution, generalization and
6607−:: instantiation, and the printer can show it (+show-var). No two
6608−:: IDs share a count, so a name never makes two variables one.
6613− (add (lsh 6 name) (end 6 n))
6615−:: +var-name: the name in a type variable's ID, or 0 for none
6622−:: +var-count: a type variable's ID without its name
6629−:: +canonical-itype: t with the variables in vars renumbered to print
6631−:: A variable keeps its name unless one before it in vars has the same
6632−:: name. The others take numbers from 0, skipping any whose letter
6633−:: (+show-var) is a name in vars, so a printed type never shows one
6634−:: name for two variables.
6636++ canonical-itype
5976++ canonical-itype
6637 |= [t=itype vars=(list @ud)]
5977 |= [t=itype vars=(list @ud)]
6638 ^- itype
5978 ^- itype
6639− =/ names=(list @t) (turn vars var-name)
6640− =/ used=(list @t) ~
6641 =/ ren=isub ~
5979 =/ ren=isub ~
6642 =/ n=@ud 0
5980 =/ n=@ud 0
6644 ?~ vars (itype-rename t ren)
5982 ?~ vars (itype-rename t ren)
6645− =/ name=@t (var-name i.vars)
6646− =/ own=? &(!=(0 name) !(lien used |=(u=@t =(u name))))
6647− =? n !own (letter-free n names)
6648− =/ id=@ud ?:(own (named-var name 0) n)
6649− =/ replacement=itype ?:((itype-var-is-restricted i.vars t) [%rvar id] ?:((itype-var-is-atom i.vars t) [%avar id] ?:((itype-var-is-gate-free i.vars t) [%fvar id] [%var id])))
5983+ =/ replacement=itype ?:((itype-var-is-restricted i.vars t) [%rvar n] ?:((itype-var-is-atom i.vars t) [%avar n] [%var n]))
6650− $(vars t.vars, ren [[i.vars replacement] ren], n ?:(own n +(n)), used ?:(own [name used] used))
5984+ $(vars t.vars, ren [[i.vars replacement] ren], n +(n))
6652−:: +letter-free: the first number from n whose letter is none of names
6655− |= [n=@ud names=(list @t)]
6657− ?. (lien names |=(m=@t =(m (crip (show-var n))))) n
6660−:: +instantiate-scheme: a scheme's type with fresh quantified variables
6662−:: Each fresh variable keeps the name of the one it replaces.
6664++ instantiate-scheme
5986++ instantiate-scheme
6665 |= [scheme=ischeme state=istate]
5987 |= [scheme=ischeme state=istate]
@@ -6668,13 +5990,12 @@
6668 =/ vars=(list @ud) vars.scheme
5990 =/ vars=(list @ud) vars.scheme
6670 ?~ vars [(itype-rename typ.scheme ren) state]
5992 ?~ vars [(itype-rename typ.scheme ren) state]
6671− =/ fresh=@ud (named-var (var-name i.vars) next.state)
6672 =/ replacement=itype
5993 =/ replacement=itype
6673− ?:((itype-var-is-restricted i.vars typ.scheme) [%rvar fresh] ?:((itype-var-is-atom i.vars typ.scheme) [%avar fresh] ?:((itype-var-is-gate-free i.vars typ.scheme) [%fvar fresh] [%var fresh])))
5994+ ?:((itype-var-is-restricted i.vars typ.scheme) [%rvar next.state] ?:((itype-var-is-atom i.vars typ.scheme) [%avar next.state] [%var next.state]))
6674 :: A generalized atom variable is a valid origin for re-generalizing
5995 :: A generalized atom variable is a valid origin for re-generalizing
6675 :: an alias, just as a sample binder is.
5996 :: an alias, just as a sample binder is.
6676 =/ st=istate state(next +(next.state))
5997 =/ st=istate state(next +(next.state))
6677− =? binders.st |(?=(%fvar -.replacement) ?=(%avar -.replacement) ?=(%rvar -.replacement)) [fresh binders.state]
5998+ =? binders.st |(?=(%avar -.replacement) ?=(%rvar -.replacement)) [next.state binders.state]
6678 $(vars t.vars, ren [[i.vars replacement] ren], state st)
5999 $(vars t.vars, ren [[i.vars replacement] ren], state st)
6680++ icap-lookup
6001++ icap-lookup
@@ -6837,11 +6158,6 @@
6837++ import-to-itype
6158++ import-to-itype
6838 |= node=*
6159 |= node=*
6839 ^- (unit itype)
6160 ^- (unit itype)
6840− (import-to-itype-standard node ~)
6842−++ import-to-itype-standard
6843− |= [node=* standard=(unit ischeme)]
6845 ?@ node ~
6161 ?@ node ~
6846 ?+ -.node ~
6162 ?+ -.node ~
6847 %noun ?:(=(node [%noun ~]) `[%noun ~] ~)
6163 %noun ?:(=(node [%noun ~]) `[%noun ~] ~)
@@ -6883,24 +6199,16 @@
6883 ?: |(=(%map name) =(%mop name) =(%jar name) =(%jug name)) 2
6199 ?: |(=(%map name) =(%mop name) =(%jar name) =(%jug name)) 2
6885 ?: =(arity 0) ~
6201 ?: =(arity 0) ~
6886− =/ args=(unit (list itype)) (import-to-itypes-standard +>.node standard)
6202+ =/ args=(unit (list itype)) (import-to-itypes +>.node)
6887 ?~ args ~
6203 ?~ args ~
6888 ?. =(arity (lent u.args)) ~
6204 ?. =(arity (lent u.args)) ~
6889− =/ keyed=(unit [types=(list itype) sub=isub]) (itype-collection-keys name u.args ~)
6205+ `[%collection name u.args]
6892− ?. ?=([* ~] types.u.keyed) ~
6893− ?~ standard `[%collection name types.u.keyed]
6894− ?. (standard-unit-template u.standard /lib/jibb/prelude/jibb) ~
6895− =/ nil=itype [%const [%null %n 0 '~']]
6896− `[%union ~[nil [%cell nil [%face %u i.types.u.keyed]]] `[/lib/jibb/prelude/jibb %unit] `%unit types.u.keyed]
6897− `[%collection name types.u.keyed]
6899 :: Hoon's ordinary ? mold is the fork of its two %f singletons.
6207 :: Hoon's ordinary ? mold is the fork of its two %f singletons.
6900 =/ raw=* +.node
6208 =/ raw=* +.node
6901 ?: |(=(raw ~[[%atom %f `0] [%atom %f `1]]) =(raw ~[[%atom %f `1] [%atom %f `0]]))
6209 ?: |(=(raw ~[[%atom %f `0] [%atom %f `1]]) =(raw ~[[%atom %f `1] [%atom %f `0]]))
6902 `[%flag ~]
6210 `[%flag ~]
6903− =/ cases=(unit (list itype)) (import-to-itypes-standard raw standard)
6211+ =/ cases=(unit (list itype)) (import-to-itypes raw)
6904 ?~ cases ~
6212 ?~ cases ~
6905 ?~ u.cases ~
6213 ?~ u.cases ~
6906 ?~ t.u.cases ~
6214 ?~ t.u.cases ~
@@ -6940,15 +6248,10 @@
6940++ import-to-itypes
6248++ import-to-itypes
6941 |= nodes=*
6249 |= nodes=*
6942 ^- (unit (list itype))
6250 ^- (unit (list itype))
6943− (import-to-itypes-standard nodes ~)
6945−++ import-to-itypes-standard
6946− |= [nodes=* standard=(unit ischeme)]
6947− ^- (unit (list itype))
6948 ?@ nodes ?:(=(nodes 0) `~ ~)
6251 ?@ nodes ?:(=(nodes 0) `~ ~)
6949− =/ first (import-to-itype-standard -.nodes standard)
6252+ =/ first (import-to-itype -.nodes)
6950 ?~ first ~
6253 ?~ first ~
6951− =/ rest $(nodes +.nodes, standard standard)
6254+ =/ rest $(nodes +.nodes)
6952 ?~ rest ~
6255 ?~ rest ~
6953 `[u.first u.rest]
6256 `[u.first u.rest]
@@ -6957,7 +6260,6 @@
6958 ?- -.typ
6261 ?- -.typ
6959 %noun [%all ~]
6262 %noun [%all ~]
6961 %atom [%atom ~]
6263 %atom [%atom ~]
6962 %flag [%or ~[[%atom `0] [%atom `1]]]
6264 %flag [%or ~[[%atom `0] [%atom `1]]]
6963 %const [%atom `val.literal.typ]
6265 %const [%atom `val.literal.typ]
@@ -6975,10 +6277,9 @@
6975 ?. (levy t.cases |=(t=itype =(%disjoint (union-relate first (import-type-pattern t))))) |
6277 ?. (levy t.cases |=(t=itype =(%disjoint (union-relate first (import-type-pattern t))))) |
6976 $(cases t.cases)
6278 $(cases t.cases)
6978−++ find-imported-mold-prelude
6280+++ find-imported-mold
6979− |= [module=term name=term externals=iexternals surs=(list term) prelude=ifile]
6281+ |= [module=term name=term externals=iexternals surs=(list term)]
6980 ^- (unit itype)
6282 ^- (unit itype)
6981− =/ standard=(unit ischeme) (find-jibb-mold %unit prelude)
6982 ?. (lien surs |=(n=term =(n module))) ~
6283 ?. (lien surs |=(n=term =(n module))) ~
6983 =/ found=iexternals
6284 =/ found=iexternals
6984 (skim externals |=(e=[module=term name=term result=*] &(=(module module.e) =(name name.e))))
6285 (skim externals |=(e=[module=term name=term result=*] &(=(module module.e) =(name name.e))))
@@ -6989,17 +6290,13 @@
6989 ?. ?=(%& -.result) ~
6290 ?. ?=(%& -.result) ~
6990 =/ node=* +.result
6291 =/ node=* +.result
6991 ?. (imported-faces-valid node) ~
6292 ?. (imported-faces-valid node) ~
6992− ?@ node (import-to-itype-standard node standard)
6293+ ?@ node (import-to-itype node)
6993− ?: ?=(%ref -.node) (import-to-itype-standard node standard)
6294+ ?: ?=(%ref -.node) (import-to-itype node)
6994 =/ pattern=(unit irec-pattern) (rec-pattern node module name)
6295 =/ pattern=(unit irec-pattern) (rec-pattern node module name)
6995− ?~ pattern (import-to-itype-standard node standard)
6296+ ?~ pattern (import-to-itype node)
6996− ?. has.u.pattern (import-to-itype-standard node standard)
6297+ ?. has.u.pattern (import-to-itype node)
6997 `[%recursive module name `(crip "{(trip name)}.{(trip module)}")]
6298 `[%recursive module name `(crip "{(trip name)}.{(trip module)}")]
6999−++ find-imported-mold
7000− |= [module=term name=term externals=iexternals surs=(list term)]
7002− (find-imported-mold-prelude module name externals surs *ifile)
7004++ collect-sur-imports
6301++ collect-sur-imports
7005 |= imports=(list import)
6302 |= imports=(list import)
@@ -7017,10 +6314,9 @@
7017 [mark.i.imports $(imports t.imports)]
6314 [mark.i.imports $(imports t.imports)]
7018 $(imports t.imports)
6315 $(imports t.imports)
7020−++ find-imported-mark-prelude
6317+++ find-imported-mark
7021− |= [name=term externals=imark-externals marks=(list term) prelude=ifile]
6318+ |= [name=term externals=imark-externals marks=(list term)]
7022 ^- (unit itype)
6319 ^- (unit itype)
7023− =/ standard=(unit ischeme) (find-jibb-mold %unit prelude)
7024 ?. (unique-value-name name marks) ~
6320 ?. (unique-value-name name marks) ~
7025 =/ found=imark-externals
6321 =/ found=imark-externals
7026 (skim externals |=(e=[mark=term result=*] =(name mark.e)))
6322 (skim externals |=(e=[mark=term result=*] =(name mark.e)))
@@ -7030,12 +6326,7 @@
7030 ?@ result ~
6326 ?@ result ~
7031 ?. ?=(%& -.result) ~
6327 ?. ?=(%& -.result) ~
7032 ?. (imported-faces-valid +.result) ~
6328 ?. (imported-faces-valid +.result) ~
7033− (import-to-itype-standard +.result standard)
6329+ (import-to-itype +.result)
7035−++ find-imported-mark
7036− |= [name=term externals=imark-externals marks=(list term)]
7038− (find-imported-mark-prelude name externals marks *ifile)
7040++ find-jibb-interface
6331++ find-jibb-interface
7041 |= [face=term imports=ijimports]
6332 |= [face=term imports=ijimports]
@@ -7103,16 +6394,6 @@
7103 ?: &(?=(~ vars.template) ?=(%jrec -.typ.template) =(at.typ.template origin) =(name.typ.template name)) `name.i.molds
6394 ?: &(?=(~ vars.template) ?=(%jrec -.typ.template) =(at.typ.template origin) =(name.typ.template name)) `name.i.molds
7104 $(molds t.molds)
6395 $(molds t.molds)
7106−++ grec-visible-alias
7107− |= [origin=path name=term proof=shape args=(list itype) molds=imold-types]
7110− =/ template=ischeme template.i.molds
7111− ?. ?=(%grec -.typ.template) $(molds t.molds)
7112− ?. &(=(at.typ.template origin) =(name.typ.template name) =(proof.typ.template proof)) $(molds t.molds)
7113− ?. &((identity-union-parameters vars.template args.typ.template) =((lent vars.template) (lent args))) $(molds t.molds)
7116++ itype-in-import
6397++ itype-in-import
7117 |= [t=itype iface=ifile face=term prelude=(unit ifile)]
6398 |= [t=itype iface=ifile face=term prelude=(unit ifile)]
7118 ^- itype
6399 ^- itype
@@ -7132,11 +6413,6 @@
7132 `(crip "{(trip u.alias)}.{(trip face)}")
6413 `(crip "{(trip u.alias)}.{(trip face)}")
7133 [%union (turn cases.t |=(c=itype (itype-in-import c iface face prelude))) origin.t label (turn args.t |=(c=itype (itype-in-import c iface face prelude)))]
6414 [%union (turn cases.t |=(c=itype (itype-in-import c iface face prelude))) origin.t label (turn args.t |=(c=itype (itype-in-import c iface face prelude)))]
7134 %recursive [%recursive module.t name.t ~]
6415 %recursive [%recursive module.t name.t ~]
7136− =/ public=(unit term) ?~(prelude ~ (grec-visible-alias at.t name.t proof.t args.t molds.u.prelude))
7137− =/ alias=(unit term) ?~(public (grec-visible-alias at.t name.t proof.t args.t molds.iface) public)
7138− =/ label=(unit @t) ?~(alias ~ ?~(public `(crip "{(trip u.alias)}.{(trip face)}") `u.alias))
7139− t(label label, args (turn args.t |=(c=itype (itype-in-import c iface face prelude))))
7141 =/ public=(unit term) ?~(prelude ~ (jrec-alias at.t name.t molds.u.prelude))
6417 =/ public=(unit term) ?~(prelude ~ (jrec-alias at.t name.t molds.u.prelude))
7142 ?^ public t(label `u.public)
6418 ?^ public t(label `u.public)
@@ -7189,27 +6465,15 @@
7189 ?~ rest ~
6465 ?~ rest ~
7190 `[[i.names i.args] u.rest]
6466 `[[i.names i.args] u.rest]
7192−++ template-apply-sub
6468+++ template-apply
7193− |= [template=ischeme args=(list itype) sub=isub]
6469+ |= [template=ischeme args=(list itype)]
7194− ^- (unit [typ=itype sub=isub])
6470+ ^- (unit itype)
7195 =/ vars=(list @ud) vars.template
6471 =/ vars=(list @ud) vars.template
7196 =/ ren=isub ~
6472 =/ ren=isub ~
7198− ?~ vars ?~(args `[(itype-rename typ.template ren) sub] ~)
6474+ ?~ vars ?~(args `(itype-rename typ.template ren) ~)
7199 ?~ args ~
6475 ?~ args ~
7200− =/ replacement=(unit igf-form)
7201− ?: (itype-var-is-gate-free i.vars typ.template)
7202− (itype-gate-free-form i.args sub 256)
7205− $(vars t.vars, args t.args, ren [[i.vars typ.u.replacement] ren], sub sub.u.replacement)
6476+ $(vars t.vars, args t.args, ren [[i.vars i.args] ren])
7208− |= [template=ischeme args=(list itype)]
7210− =/ applied=(unit [typ=itype sub=isub]) (template-apply-sub template args ~)
7214++ infer-shape-args
6478++ infer-shape-args
7215 |= [args=(list shape) state=istate]
6479 |= [args=(list shape) state=istate]
@@ -7261,29 +6525,9 @@
7261 ?. =(names.tail ~[name]) ~
6525 ?. =(names.tail ~[name]) ~
7262 `[%jrec at.state name `name name.i.fs aura.shape.i.fs name.i.t.fs]
6526 `[%jrec at.state name `name name.i.fs aura.shape.i.fs name.i.t.fs]
7264−++ simple-source-generic-recursive
7265− |= [name=term sh=shape args=(list itype) state=istate]
7267− ?. ?=(%generic -.sh) ~
7268− ?. ?=([@ ~] vars.sh) ~
7269− ?. ?=([* ~] args) ~
7270− ?~ grec-index.state ~
7271− ?. =(at.u.grec-index.state at.state) ~
7273− ?. =(prelude.u.grec-index.state u.prelude.state) ~
7274− =/ proof=(unit shape) (~(get by shapes.u.grec-index.state) name)
7277− `[%grec at.state name `name sh args]
7280++ infer-mold-template
6528++ infer-mold-template
7281 |= [sh=shape state=istate]
6529 |= [sh=shape state=istate]
7282 ^- (unit [template=ischeme state=istate])
6530 ^- (unit [template=ischeme state=istate])
7283− =/ generic=(unit itype)
7284− ?. ?=([@ ~] active.state) ~
7285− (simple-source-generic-recursive i.active.state sh ~[[%var next.state]] state)
7286− ?^ generic `[[u.generic ~[next.state]] state(next +(next.state))]
7287 =/ direct=(unit itype)
6531 =/ direct=(unit itype)
7288 ?. ?=([@ ~] active.state) ~
6532 ?. ?=([@ ~] active.state) ~
7289 (simple-source-recursive i.active.state sh state)
6533 (simple-source-recursive i.active.state sh state)
@@ -7341,7 +6585,7 @@
7341 ?~ found ~
6585 ?~ found ~
7342 ?^ t.found ~
6586 ?^ t.found ~
7343 result.i.found
6587 result.i.found
7344− ?. ?=([%invalid ?(%aura %core %overlap) @] raw) ~
6588+ ?. ?=([%invalid ?(%aura %core) @] raw) ~
7345 `["{(trip +>.raw)}" ~[[at.sh "invalid imported mold"]]]
6589 `["{(trip +>.raw)}" ~[[at.sh "invalid imported mold"]]]
7347:: Replay only the shape branches whose evaluation order we can prove.
6591:: Replay only the shape branches whose evaluation order we can prove.
@@ -7416,18 +6660,13 @@
7416 `[[%atom aura.sh] state]
6660 `[[%atom aura.sh] state]
7417 %flag `[[%flag ~] state]
6661 %flag `[[%flag ~] state]
7418 %noun `[[%noun ~] state]
6662 %noun `[[%noun ~] state]
7419− %void `[[%empty ~] state]
7421 ?. |(=(%term form.lit.sh) =(%null form.lit.sh) =(%loobean form.lit.sh)) ~
6664 ?. |(=(%term form.lit.sh) =(%null form.lit.sh) =(%loobean form.lit.sh)) ~
7422 ?: &(=(%loobean form.lit.sh) !|(=(0 val.lit.sh) =(1 val.lit.sh))) ~
6665 ?: &(=(%loobean form.lit.sh) !|(=(0 val.lit.sh) =(1 val.lit.sh))) ~
7423 `[[%const lit.sh] state]
6666 `[[%const lit.sh] state]
7425 =/ pairs=(list upair) (union-pairs cases.sh molds.state)
6668 =/ pairs=(list upair) (union-pairs cases.sh molds.state)
7426− ?: (lien pairs |=(p=upair =(%overlap relation.p))) ~
7428− ?: (levy pairs |=(p=upair =(%disjoint relation.p))) &
6669+ ?. (levy pairs |=(p=upair =(%disjoint relation.p))) ~
7429− &((union-source-state-safe state 256) (union-source-distinct-tags cases.sh molds.state 256))
7431 =/ cs=(unit [types=(list itype) state=istate]) (infer-shape-args cases.sh state)
6670 =/ cs=(unit [types=(list itype) state=istate]) (infer-shape-args cases.sh state)
7433 `[[%union types.u.cs ~ ~ ~] state.u.cs]
6672 `[[%union types.u.cs ~ ~ ~] state.u.cs]
@@ -7450,12 +6689,12 @@
7450 ?^ vars.u.found ~
6689 ?^ vars.u.found ~
7451 `[(itype-in-import typ.u.found u.iface i.t.names.sh prelude.state) state]
6690 `[(itype-in-import typ.u.found u.iface i.t.names.sh prelude.state) state]
7452 =/ found=(unit itype)
6691 =/ found=(unit itype)
7453− (find-imported-mold-prelude i.t.names.sh n externals.state surs.state ?~(prelude.state *ifile u.prelude.state))
6692+ (find-imported-mold i.t.names.sh n externals.state surs.state)
7454 ?~ found ~
6693 ?~ found ~
7455 `[u.found state]
6694 `[u.found state]
7456 ?: (lien marks.state |=(x=term =(x n)))
6695 ?: (lien marks.state |=(x=term =(x n)))
7457 ?^ (find-simple-mold n molds.state) ~
6696 ?^ (find-simple-mold n molds.state) ~
7458− =/ imported=(unit itype) (find-imported-mark-prelude n mark-externals.state marks.state ?~(prelude.state *ifile u.prelude.state))
6697+ =/ imported=(unit itype) (find-imported-mark n mark-externals.state marks.state)
7459 ?~ imported ~
6698 ?~ imported ~
7460 `[u.imported state]
6699 `[u.imported state]
7461 ?: (lien active.state |=(x=term =(x n))) ~
6700 ?: (lien active.state |=(x=term =(x n))) ~
@@ -7479,17 +6718,6 @@
7479 =/ args=(unit [types=(list itype) state=istate]) (infer-shape-args args.sh state)
6718 =/ args=(unit [types=(list itype) state=istate]) (infer-shape-args args.sh state)
7480 ?~ args ~
6719 ?~ args ~
7481 =/ n=term i.ref.sh
6720 =/ n=term i.ref.sh
7482− =/ keyed=(unit [types=(list itype) sub=isub])
7483− ?: ?=(^ (find-simple-mold n molds.state.u.args))
7484− `[types.u.args sub.state.u.args]
7485− ?~ prelude.state.u.args
7486− (itype-collection-keys n types.u.args sub.state.u.args)
7487− ?: ?=(^ (find-jibb-mold n u.prelude.state.u.args))
7488− `[types.u.args sub.state.u.args]
7489− (itype-collection-keys n types.u.args sub.state.u.args)
7491− =. types.u.args types.u.keyed
7492− =. sub.state.u.args sub.u.keyed
7493 ?^ t.ref.sh
6721 ?^ t.ref.sh
7494 ?^ t.t.ref.sh ~
6722 ?^ t.t.ref.sh ~
7495 =/ iface=(unit ifile) (find-jibb-interface i.t.ref.sh jimports.state.u.args)
6723 =/ iface=(unit ifile) (find-jibb-interface i.t.ref.sh jimports.state.u.args)
@@ -7497,10 +6725,9 @@
7497 =/ template=(unit ischeme) (find-jibb-mold n u.iface)
6725 =/ template=(unit ischeme) (find-jibb-mold n u.iface)
7498 ?~ template ~
6726 ?~ template ~
7499 ?~ vars.u.template ~
6727 ?~ vars.u.template ~
7500− =/ applied=(unit [typ=itype sub=isub]) (template-apply-sub u.template types.u.args sub.state.u.args)
6728+ =/ applied=(unit itype) (template-apply u.template types.u.args)
7501 ?~ applied ~
6729 ?~ applied ~
7502− =. sub.state.u.args sub.u.applied
7503− `[(itype-in-import typ.u.applied u.iface i.t.ref.sh prelude.state.u.args) state.u.args]
6730+ `[(itype-in-import u.applied u.iface i.t.ref.sh prelude.state.u.args) state.u.args]
7504 ?: (lien active.state.u.args |=(x=term =(x n))) ~
6731 ?: (lien active.state.u.args |=(x=term =(x n))) ~
7505 =/ found=(unit shape) (find-simple-mold n molds.state.u.args)
6732 =/ found=(unit shape) (find-simple-mold n molds.state.u.args)
7506 ?~ found
6733 ?~ found
@@ -7509,13 +6736,10 @@
7509 =/ prelude-entry=(unit ischeme) (find-jibb-mold n u.prelude.state.u.args)
6736 =/ prelude-entry=(unit ischeme) (find-jibb-mold n u.prelude.state.u.args)
7510 ?~ prelude-entry ~
6737 ?~ prelude-entry ~
7511 ?~ vars.u.prelude-entry ~
6738 ?~ vars.u.prelude-entry ~
7512− =/ applied=(unit [typ=itype sub=isub]) (template-apply-sub u.prelude-entry types.u.args sub.state.u.args)
6739+ =/ applied=(unit itype) (template-apply u.prelude-entry types.u.args)
7513 ?~ applied ~
6740 ?~ applied ~
7514− =. sub.state.u.args sub.u.applied
7515− `[typ.u.applied state.u.args]
6741+ `[u.applied state.u.args]
7516 ?. ?=(%generic -.u.found) ~
6742 ?. ?=(%generic -.u.found) ~
7517− =/ grec=(unit itype) (simple-source-generic-recursive n u.found types.u.args state.u.args)
7518− ?^ grec `[u.grec state.u.args]
7519 ?. (distinct-params vars.u.found) ~
6743 ?. (distinct-params vars.u.found) ~
7520 =/ params=(unit iparams) (bind-params vars.u.found types.u.args)
6744 =/ params=(unit iparams) (bind-params vars.u.found types.u.args)
7521 ?~ params ~
6745 ?~ params ~
@@ -7534,8 +6758,7 @@
7534 ?: in-mold.state ~
6758 ?: in-mold.state ~
7535 =/ n=(unit @ud) (icap-lookup name.sh caps.state)
6759 =/ n=(unit @ud) (icap-lookup name.sh caps.state)
7536 ?^ n `[[%var u.n] state]
6760 ?^ n `[[%var u.n] state]
7537− =/ id=@ud (named-var name.sh next.state)
7538− `[[%var id] state(next +(next.state), caps [[name.sh id at.sh] caps.state])]
6761+ `[[%var next.state] state(next +(next.state), caps [[name.sh next.state at.sh] caps.state])]
@@ -7568,12 +6791,12 @@
7568 ^- isample-result
6791 ^- isample-result
7571− ?: |((reserved-name name.s) ?=(^ (ienv-lookup name.s env)) (lien globals.state |=(x=term =(x name.s))))
6794+ ?: |(=(name.s %proj) ?=(^ (ienv-lookup name.s env)) (lien globals.state |=(x=term =(x name.s))))
7572 [%| "sample shadows a name"]
6795 [%| "sample shadows a name"]
7573 =/ t=itype [%var next.state]
6796 =/ t=itype [%var next.state]
7574 [%& t [[name.s [t ~]] env] state(next +(next.state), binders [next.state binders.state])]
6797 [%& t [[name.s [t ~]] env] state(next +(next.state), binders [next.state binders.state])]
7576− ?: |((reserved-name name.s) ?=(^ (ienv-lookup name.s env)) (lien globals.state |=(x=term =(x name.s))))
6799+ ?: |(=(name.s %proj) ?=(^ (ienv-lookup name.s env)) (lien globals.state |=(x=term =(x name.s))))
7577 [%| "sample shadows a name"]
6800 [%| "sample shadows a name"]
7578 =/ t=(unit [typ=itype state=istate]) (infer-simple-shape shape.s state)
6801 =/ t=(unit [typ=itype state=istate]) (infer-simple-shape shape.s state)
7579 ?~ t [%| "sample mold is not supported by partial inference"]
6802 ?~ t [%| "sample mold is not supported by partial inference"]
@@ -7641,7 +6864,7 @@
7643 ?: ?=(%mold -.i.ds) $(ds t.ds)
6866 ?: ?=(%mold -.i.ds) $(ds t.ds)
7644− ?: (reserved-name name.i.ds) |
6867+ ?: =(name.i.ds %proj) |
7645 ?. (unique-value-name name.i.ds names) |
6868 ?. (unique-value-name name.i.ds names) |
7646 ?: ?=(^ (ienv-lookup name.i.ds env)) |
6869 ?: ?=(^ (ienv-lookup name.i.ds env)) |
7647 ?: (lien globals.state |=(n=term =(n name.i.ds))) |
6870 ?: (lien globals.state |=(n=term =(n name.i.ds))) |
@@ -7665,7 +6888,7 @@
7666 ?~ locals &
6889 ?~ locals &
7667 =/ n=term name.i.locals
6890 =/ n=term name.i.locals
7668− ?: (reserved-name n) |
6891+ ?: =(n %proj) |
7669 ?. (unique-value-name n names) |
6892 ?. (unique-value-name n names) |
7670 ?: (lien molds.state |=(m=[name=term body=shape] =(n name.m))) |
6893 ?: (lien molds.state |=(m=[name=term body=shape] =(n name.m))) |
7671 ?: (lien marks.state |=(m=term =(n m))) |
6894 ?: (lien marks.state |=(m=term =(n m))) |
@@ -7815,123 +7038,17 @@
7815 ^- istate
7038 ^- istate
7816 ?~ sites state
7039 ?~ sites state
7817 ?: ?=(^ (icap-lookup name.i.sites caps.state)) $(sites t.sites)
7040 ?: ?=(^ (icap-lookup name.i.sites caps.state)) $(sites t.sites)
7818− =/ id=@ud (named-var name.i.sites next.state)
7819− $(sites t.sites, state state(next +(next.state), caps [[name.i.sites id at.i.sites] caps.state]))
7041+ $(sites t.sites, state state(next +(next.state), caps [[name.i.sites next.state at.i.sites] caps.state]))
7821++ reserve-def-caps
7043++ reserve-def-caps
7822 |= [e=expr state=istate]
7044 |= [e=expr state=istate]
7823 ^- istate
7045 ^- istate
7824 (reserve-cap-sites (scope-expr e) state)
7046 (reserve-cap-sites (scope-expr e) state)
7826−:: +definite-diag: whether a failure is an error in the program itself
7828−:: A definite error names the sites that conflict. A form partial
7829−:: inference does not support names none, and neither does a name
7830−:: that is not inferred yet, such as a sibling that waits for a later
7831−:: pass. An uncertain hole is the one unsupported result with a site.
7837− !=(msg.diag uncertain-hole-msg)
7839−:: +shared-types: what a body's shared variables resolve to
7841−:: The variables free in env or in the enclosing capitals, such as an
7842−:: enclosing gate's untyped sample, are shared by all of the body's
7843−:: locals. A local keeps monomorphic only the variables that these
7844−:: resolve to; it generalizes the rest, which each use renames.
7847− |= [env=ienv caps=icaps sub=isub]
7848− ^- (list [id=@ud typ=itype])
7850− (unique-type-vars (weld (free-env-vars env sub) (free-cap-vars caps sub)))
7851− |=(id=@ud [id (itype-normalize [%var id] sub)])
7853−:: +shared-moved: whether a sibling bound or refined a shared variable
7855−:: A sibling that infers can constrain a shared variable and so turn
7856−:: another local's failure into a success: +itype-fit accepts any type
7857−:: it can prove empty, so after `^- !! x` every cast of x fits. Such a
7858−:: failure can depend on the order siblings are tried in. A variable
7859−:: that a sibling keeps monomorphic occurs in what a shared variable
7860−:: resolves to, so constraining it moves a shared variable too. A
7861−:: substitution only grows, so when none moved, every sibling inferred
7862−:: so far, and the local, ran against the entry state and generalized
7866− |= [shared=(list [id=@ud typ=itype]) sub=isub]
7868− (lien shared |=([id=@ud typ=itype] !=(typ (itype-normalize [%var id] sub))))
7870−:: +closed-local: whether a local cannot see any shared variable
7872−:: A local that names no sibling, itself included, no name whose type
7873−:: had a free variable when the body was entered, and no enclosing
7874−:: capital that did, is inferred from generalized schemes and known
7875−:: types alone. What its siblings do cannot change its result, so its
7876−:: error is its own in any order. +sub is the substitution on entry,
7877−:: since a sibling may since have bound such a variable. The names are
7878−:: syntactic and ignore binders, so this errs closed.
7881− |= [d=def siblings=(list term) env=ienv caps=icaps sub=isub]
7883− ?. ?=(%value -.d) |
7884− =/ deps=(list term) (dependency-expr val.d)
7885− ?: (lien deps |=(n=term |(=(n name.d) (lien siblings |=(s=term =(s n)))))) |
7888− =/ sc=(unit ischeme) (ienv-lookup n env)
7890− ?=(^ (free-env-vars ~[[n u.sc]] sub))
7892− %+ levy (scope-expr val.d)
7894− =/ id=(unit @ud) (icap-lookup name.site caps)
7896− ?=(~ (itype-vars (itype-normalize [%var u.id] sub)))
7898−:: +infer-local-defs: infer a body's local values in dependency order
7900−:: A definition that fails, or whose type is still pending, waits for
7901−:: the next pass, since it may refer to a sibling inferred later. When
7902−:: a pass makes no progress and no cyclic group applies, report the
7903−:: definite error of the earliest waiting definition, if no order of
7904−:: the siblings could change it; otherwise the message stays generic.
7906−:: A failure counts only if it names its sites. The failure of a
7907−:: local that sees no shared variable (+closed-local) is its own. Any
7908−:: other failure counts only if no shared variable had moved when it
7909−:: was tried, and, when the body has shared variables, every other
7910−:: waiting definition also failed with sites: one that waits without
7911−:: them, on a checker limit, a pending tag or its own nested stall,
7912−:: might in another order, or once supported, constrain a shared
7913−:: variable and so let the failing local pass. When all of them failed
7914−:: with sites and none moved a shared variable, the state is the same
7915−:: in every order. With no shared variables, each local is inferred
7916−:: from generalized schemes alone.
7918−:: A cyclic group's own errors are not kept. A definition that infers
7919−:: but is then unsupported reports that at once: a failure recorded
7920−:: earlier in the pass may still pass on a retry, once a sibling has
7921−:: constrained a shared variable.
7923++ infer-local-defs
7048++ infer-local-defs
7924 |= [ds=(list def) env=ienv state=istate]
7049 |= [ds=(list def) env=ienv state=istate]
7925 ^- ilocal-result
7050 ^- ilocal-result
7926− =/ shared=(list [id=@ud typ=itype]) (shared-types env caps.state sub.state)
7927 =/ remaining=(list def) ~
7051 =/ remaining=(list def) ~
7928− =/ siblings=(list term) (global-value-names ds)
7929− =/ entry=isub sub.state
7930− :: this pass's failures with sites that are closed or were tried before
7931− :: any shared variable moved, newest first; and whether a definition
7932− :: waits without sites
7933− =/ failures=(list [diag=idiag closed=?]) ~
7935 =/ progressed=? |
7052 =/ progressed=? |
@@ -7941,36 +7058,16 @@
7941 =/ groups=icomponents (graph-components pending (global-value-names pending))
7058 =/ groups=icomponents (graph-components pending (global-value-names pending))
7942 =/ grouped=(unit [rest=(list def) env=ienv state=istate])
7059 =/ grouped=(unit [rest=(list def) env=ienv state=istate])
7943 (try-local-group pending groups env state)
7060 (try-local-group pending groups env state)
7945− =/ sure=(list [diag=idiag closed=?])
7946− ?: |(?=(~ shared) !blocked) failures
7947− (skim failures |=([diag=idiag closed=?] closed))
7948− ?^ sure [%| diag:(rear sure)]
7949− [%| ["local definitions need unsupported inference" ~]]
7061+ ?~ grouped [%| ["local definitions need unsupported inference" ~]]
7950− $(ds rest.u.grouped, remaining ~, failures ~, blocked |, env env.u.grouped, state state.u.grouped, progressed |)
7062+ $(ds rest.u.grouped, remaining ~, env env.u.grouped, state state.u.grouped, progressed |)
7951− $(ds (flop remaining), remaining ~, failures ~, blocked |, progressed |)
7063+ $(ds (flop remaining), remaining ~, progressed |)
7952 =/ d=def i.ds
7064 =/ d=def i.ds
7953 ?> ?=(%value -.d)
7065 ?> ?=(%value -.d)
7954 =/ local-state=istate (reserve-def-caps val.d state)
7066 =/ local-state=istate (reserve-def-caps val.d state)
7955− =/ plain=iresult (infer-fragment val.d env local-state)
7067+ =/ inferred=iresult (infer-fragment val.d env local-state)
7956− =/ inferred=iresult
7068+ =/ retried=? ?=(%| -.inferred)
7957− ?: ?=(%& -.plain) plain
7958− (infer-recursive-gate d env local-state)
7069+ =? inferred retried (infer-recursive-gate d env local-state)
7959− ?: ?=(%| -.inferred)
7960− :: For a value that is not a gate the retry only says so; keep the
7961− :: first failure unless the retry found a definite error.
7963− ?: ?=(%& -.plain) p.inferred
7964− ?: (definite-diag p.inferred) p.inferred
7966− ?. (definite-diag failure) $(ds t.ds, remaining [d remaining], blocked &)
7967− =/ closed=? (closed-local d siblings env caps.state entry)
7968− =? failures |(closed !(shared-moved shared sub.state))
7969− [[failure closed] failures]
7970− $(ds t.ds, remaining [d remaining])
7070+ ?: ?=(%| -.inferred) $(ds t.ds, remaining [d remaining])
7971− :: Only the deferred transaction adds obligations, and it keeps no
7972− :: failure reason. Obligations from a local are a checker limit.
7973− ?: !=(obligations.state.p.inferred obligations.state) [%| ["deferred local definition needs unsupported inference" ~]]
7974 =. state.p.inferred (promote-restricted-numbers state.p.inferred env)
7071 =. state.p.inferred (promote-restricted-numbers state.p.inferred env)
7975 =. state.p.inferred (default-hole-numbers holes.state.p.inferred holes.state state.p.inferred env !(itype-has-gate (itype-normalize typ.p.inferred sub.state.p.inferred)))
7072 =. state.p.inferred (default-hole-numbers holes.state.p.inferred holes.state state.p.inferred env !(itype-has-gate (itype-normalize typ.p.inferred sub.state.p.inferred)))
7976 =/ hole=(unit idiag) (unresolved-hole holes.state.p.inferred holes.state state.p.inferred)
7073 =/ hole=(unit idiag) (unresolved-hole holes.state.p.inferred holes.state state.p.inferred)
@@ -7983,15 +7080,14 @@
7983 [%| ["explicit capital constraints are not supported by partial inference" ~]]
7080 [%| ["explicit capital constraints are not supported by partial inference" ~]]
7984 =/ typ=itype (itype-normalize typ.p.inferred sub.state.p.inferred)
7081 =/ typ=itype (itype-normalize typ.p.inferred sub.state.p.inferred)
7985 ?: |((pending-tags tags.state.p.inferred sub.state.p.inferred) (itype-has-tag typ))
7082 ?: |((pending-tags tags.state.p.inferred sub.state.p.inferred) (itype-has-tag typ))
7986− $(ds t.ds, remaining [d remaining], blocked &)
7083+ $(ds t.ds, remaining [d remaining])
7987 ?: (unsupported-atom-vars typ caps.state.p.inferred binders.state.p.inferred sub.state.p.inferred)
7084 ?: (unsupported-atom-vars typ caps.state.p.inferred binders.state.p.inferred sub.state.p.inferred)
7988− $(ds t.ds, remaining [d remaining], blocked &)
7085+ $(ds t.ds, remaining [d remaining])
7989 =/ free=(list @ud)
7086 =/ free=(list @ud)
7990 (weld (free-env-vars env sub.state.p.inferred) (free-cap-vars caps.state sub.state.p.inferred))
7087 (weld (free-env-vars env sub.state.p.inferred) (free-cap-vars caps.state sub.state.p.inferred))
7991 =/ vars=(list @ud) (unique-type-vars (itype-vars typ))
7088 =/ vars=(list @ud) (unique-type-vars (itype-vars typ))
7992 =. vars (skim vars |=(n=@ud !(lien free |=(f=@ud =(f n)))))
7089 =. vars (skim vars |=(n=@ud !(lien free |=(f=@ud =(f n)))))
7993− =/ named=[typ=itype vars=(list @ud)] (cap-names typ vars caps.state.p.inferred sub.state.p.inferred)
7994− $(ds t.ds, env [[name.d named] env], state state.p.inferred(caps caps.state, holes holes.state), progressed &)
7090+ $(ds t.ds, env [[name.d [typ vars]] env], state state.p.inferred(caps caps.state, holes holes.state), progressed &)
7996:: Try complete cyclic local groups after individual definitions stall.
7092:: Try complete cyclic local groups after individual definitions stall.
7997:: Components with non-gates or unresolved constraints stay unavailable.
7093:: Components with non-gates or unresolved constraints stay unavailable.
@@ -8081,10 +7177,6 @@
8081 ?: &(?=(%collection -.expected) =(%list name.expected) (context-list-expression e))
7177 ?: &(?=(%collection -.expected) =(%list name.expected) (context-list-expression e))
8082 (infer-list-context e expected env state context)
7178 (infer-list-context e expected env state context)
8083 ?: ?=(%branch -.e)
7179 ?: ?=(%branch -.e)
8084− =/ named=(unit idiag) (branch-tag-name e env state)
8085− ?^ named [%| u.named]
8086− =/ empty-list=(unit iresult) (empty-list-null-branch e env state `[expected context])
8087− ?^ empty-list u.empty-list
8088 ?~ arms.e [%| ["branch is not supported by partial inference" ~]]
7180 ?~ arms.e [%| ["branch is not supported by partial inference" ~]]
8089 ?~ t.arms.e [%| ["branch pattern is not supported by partial inference" ~]]
7181 ?~ t.arms.e [%| ["branch pattern is not supported by partial inference" ~]]
8090 ?^ t.t.arms.e [%| ["branch is not supported by partial inference" ~]]
7182 ?^ t.t.arms.e [%| ["branch is not supported by partial inference" ~]]
@@ -8123,8 +7215,6 @@
8123 ?^ missing [%| u.missing]
7215 ?^ missing [%| u.missing]
8124 =/ nested=(unit idiag) (nested-missing-tag e typ.p.value expected sub.state.p.value next.state.p.value context)
7216 =/ nested=(unit idiag) (nested-missing-tag e typ.p.value expected sub.state.p.value next.state.p.value context)
8125 ?^ nested [%| u.nested]
7217 ?^ nested [%| u.nested]
8126− =/ decimal=(unit idiag) (decimal-misfit e typ.p.value expected sub.state.p.value next.state.p.value)
8127− ?^ decimal [%| u.decimal]
8128 ?: &(?=(%collection -.expected) =(%list name.expected))
7218 ?: &(?=(%collection -.expected) =(%list name.expected))
8129 [%| ["branch arm does not fit its expected list" ~[[context "expected list"] [(span-of e) "branch arm"]]]]
7219 [%| ["branch arm does not fit its expected list" ~[[context "expected list"] [(span-of e) "branch arm"]]]]
8130 ?: ?=(%flag -.expected)
7220 ?: ?=(%flag -.expected)
@@ -8190,42 +7280,25 @@
8190 =/ fit=ifit (itype-fit typ.p.tail target sub.state.p.tail next.state.p.tail)
7280 =/ fit=ifit (itype-fit typ.p.tail target sub.state.p.tail next.state.p.tail)
8191 ?: ?=(%unknown -.fit) [%| ["list tail constraint is not supported by partial inference" ~]]
7281 ?: ?=(%unknown -.fit) [%| ["list tail constraint is not supported by partial inference" ~]]
8192 ?: ?=(%bad -.fit)
7282 ?: ?=(%bad -.fit)
8193− =/ decimal=(unit idiag) (decimal-misfit val.i.t.items.e typ.p.tail target sub.state.p.tail next.state.p.tail)
8194− ?^ decimal [%| u.decimal]
8195 [%| ["list tail does not fit its expected type" ~[[context (site-type-note "expected list" target sub.state.p.tail)] [(span-of val.i.t.items.e) (site-type-note "list tail" typ.p.tail sub.state.p.tail)]]]]
7283 [%| ["list tail does not fit its expected type" ~[[context (site-type-note "expected list" target sub.state.p.tail)] [(span-of val.i.t.items.e) (site-type-note "list tail" typ.p.tail sub.state.p.tail)]]]]
8196 [%& target state.p.tail(sub sub.fit, next next.fit)]
7284 [%& target state.p.tail(sub sub.fit, next next.fit)]
8198−:: done holds the items already checked, the last first, so that a
8199−:: decimal among them can be blamed when a later item fixes its aura.
8200++ infer-open-list-items
7286++ infer-open-list-items
8201− |= [items=(list expr) expected=itype env=ienv state=istate context=span done=(list expr)]
7287+ |= [items=(list expr) expected=itype env=ienv state=istate context=span]
8202 ^- iresult
7288 ^- iresult
8203 ?~ items [%& expected state]
7289 ?~ items [%& expected state]
8204 =/ target=itype (itype-walk expected sub.state)
7290 =/ target=itype (itype-walk expected sub.state)
8205 =/ value=iresult (infer-call-context-arg i.items target env state context)
7291 =/ value=iresult (infer-call-context-arg i.items target env state context)
8206 ?: ?=(%| -.value) value
7292 ?: ?=(%| -.value) value
8207− =/ ordinary-fit=ifit (itype-fit typ.p.value target sub.state.p.value next.state.p.value)
7293+ =/ fit=ifit (itype-fit typ.p.value target sub.state.p.value next.state.p.value)
8209− ?: ?=(%ok -.ordinary-fit) ordinary-fit
8210− ?: ?&(?=(%union -.target) ?=(^ prelude.state) =(origin.target `[at.u.prelude.state %element]))
8211− (program-single-generic-fit typ.p.value target sub.state.p.value next.state.p.value)
8213 ?: ?=(%unknown -.fit) [%| ["list item constraint is not supported by partial inference" ~]]
7294 ?: ?=(%unknown -.fit) [%| ["list item constraint is not supported by partial inference" ~]]
8214 ?: ?=(%bad -.fit)
7295 ?: ?=(%bad -.fit)
8215 ?: |((itype-family-related typ.p.value target sub.state.p.value) (itype-has-any-atom typ.p.value sub.state.p.value) (itype-has-any-atom target sub.state.p.value))
7296 ?: |((itype-family-related typ.p.value target sub.state.p.value) (itype-has-any-atom typ.p.value sub.state.p.value) (itype-has-any-atom target sub.state.p.value))
8216 [%| ["list item widening is not supported by partial inference" ~]]
7297 [%| ["list item widening is not supported by partial inference" ~]]
8217− =/ decimal=(unit idiag) (decimal-misfit i.items typ.p.value target sub.state.p.value next.state.p.value)
8218− ?^ decimal [%| u.decimal]
8219− =/ earlier=(list expr) (flop done)
8222− =/ found=(unit idiag) (decimal-misfit-at i.earlier typ.p.value sub.state.p.value)
8223− ?^ found [%| u.found]
8224− $(earlier t.earlier)
8225 [%| ["list items do not have compatible types" ~[[context (site-type-note "expected item" target sub.state.p.value)] [(span-of i.items) (site-type-note "list item" typ.p.value sub.state.p.value)]]]]
7298 [%| ["list items do not have compatible types" ~[[context (site-type-note "expected item" target sub.state.p.value)] [(span-of i.items) (site-type-note "list item" typ.p.value sub.state.p.value)]]]]
8226 ?: (itype-has-tag (itype-normalize expected sub.fit))
7299 ?: (itype-has-tag (itype-normalize expected sub.fit))
8227 [%| ["list item needs context in partial inference" ~]]
7300 [%| ["list item needs context in partial inference" ~]]
8228− $(items t.items, state state.p.value(sub sub.fit, next next.fit), done [i.items done])
7301+ $(items t.items, state state.p.value(sub sub.fit, next next.fit))
8230++ infer-list-items
7303++ infer-list-items
8231 |= [items=(list expr) expected=itype env=ienv state=istate context=span]
7304 |= [items=(list expr) expected=itype env=ienv state=istate context=span]
@@ -8234,20 +7307,13 @@
8234 =/ target=itype (itype-walk expected sub.state)
7307 =/ target=itype (itype-walk expected sub.state)
8235 =/ value=iresult (infer-call-context-arg i.items target env state context)
7308 =/ value=iresult (infer-call-context-arg i.items target env state context)
8236 ?: ?=(%| -.value) value
7309 ?: ?=(%| -.value) value
8237− =/ ordinary-fit=ifit (itype-fit typ.p.value target sub.state.p.value next.state.p.value)
7310+ =/ fit=ifit (itype-fit typ.p.value target sub.state.p.value next.state.p.value)
8239− ?: ?=(%ok -.ordinary-fit) ordinary-fit
8240− ?: ?&(?=(%union -.target) ?=(^ prelude.state) =(origin.target `[at.u.prelude.state %element]))
8241− (program-single-generic-fit typ.p.value target sub.state.p.value next.state.p.value)
8243 ?: ?=(%unknown -.fit) [%| ["list item constraint is not supported by partial inference" ~]]
7311 ?: ?=(%unknown -.fit) [%| ["list item constraint is not supported by partial inference" ~]]
8244 ?: ?=(%bad -.fit)
7312 ?: ?=(%bad -.fit)
8245 =/ missing=(unit idiag) (missing-union-tag i.items target sub.state.p.value context)
7313 =/ missing=(unit idiag) (missing-union-tag i.items target sub.state.p.value context)
8246 ?^ missing [%| u.missing]
7314 ?^ missing [%| u.missing]
8247 =/ nested=(unit idiag) (nested-missing-tag i.items typ.p.value target sub.state.p.value next.state.p.value context)
7315 =/ nested=(unit idiag) (nested-missing-tag i.items typ.p.value target sub.state.p.value next.state.p.value context)
8248 ?^ nested [%| u.nested]
7316 ?^ nested [%| u.nested]
8249− =/ decimal=(unit idiag) (decimal-misfit i.items typ.p.value target sub.state.p.value next.state.p.value)
8250− ?^ decimal [%| u.decimal]
8251 [%| ["list item does not fit its expected type" ~[[context (site-type-note "expected item" target sub.state.p.value)] [(span-of i.items) (site-type-note "list item" typ.p.value sub.state.p.value)]]]]
7317 [%| ["list item does not fit its expected type" ~[[context (site-type-note "expected item" target sub.state.p.value)] [(span-of i.items) (site-type-note "list item" typ.p.value sub.state.p.value)]]]]
8252 $(items t.items, state state.p.value(sub sub.fit, next next.fit))
7318 $(items t.items, state state.p.value(sub sub.fit, next next.fit))
@@ -8328,11 +7394,6 @@
8328 [%| ["list pattern needs the standard prelude in partial inference" ~]]
7394 [%| ["list pattern needs the standard prelude in partial inference" ~]]
8329 ?~ args.typ [%| ["list pattern is not supported by partial inference" ~]]
7395 ?~ args.typ [%| ["list pattern is not supported by partial inference" ~]]
8330 ?^ t.args.typ [%| ["list pattern is not supported by partial inference" ~]]
7396 ?^ t.args.typ [%| ["list pattern is not supported by partial inference" ~]]
8331− =/ item-live=(unit [result=?(%yes %no %unknown) left=@ud])
8332− (itype-inhabited-proof i.args.typ sub.state caps.state 256)
8333− ?~ item-live [%| ["list element reachability needs unsupported inference" ~]]
8334− ?: =(%unknown result.u.item-live) [%| ["list element reachability needs unsupported inference" ~]]
8335− ?: =(%no result.u.item-live) [%| ["list nonempty pattern is unreachable" ~]]
8336 ?~ arms.e [%| ["list branch is not supported by partial inference" ~]]
7397 ?~ arms.e [%| ["list branch is not supported by partial inference" ~]]
8337 ?~ t.arms.e [%| ["list branch is not supported by partial inference" ~]]
7398 ?~ t.arms.e [%| ["list branch is not supported by partial inference" ~]]
8338 ?^ t.t.arms.e [%| ["list branch is not supported by partial inference" ~]]
7399 ?^ t.t.arms.e [%| ["list branch is not supported by partial inference" ~]]
@@ -8345,7 +7406,7 @@
8345 [%| ["list branch pattern is not supported by partial inference" ~]]
7406 [%| ["list branch pattern is not supported by partial inference" ~]]
8346 =/ binder=(unit [head=term tail=term]) ?:(first-empty second-name first-name)
7407 =/ binder=(unit [head=term tail=term]) ?:(first-empty second-name first-name)
8347 ?~ binder [%| ["list branch pattern is not supported by partial inference" ~]]
7408 ?~ binder [%| ["list branch pattern is not supported by partial inference" ~]]
8348− ?: |((reserved-name head.u.binder) (reserved-name tail.u.binder) =(head.u.binder tail.u.binder) ?=(^ (ienv-lookup head.u.binder env)) ?=(^ (ienv-lookup tail.u.binder env)) (lien globals.state |=(n=term |(=(n head.u.binder) =(n tail.u.binder)))))
7409+ ?: |(=(head.u.binder %proj) =(tail.u.binder %proj) =(head.u.binder tail.u.binder) ?=(^ (ienv-lookup head.u.binder env)) ?=(^ (ienv-lookup tail.u.binder env)) (lien globals.state |=(n=term |(=(n head.u.binder) =(n tail.u.binder)))))
8349 [%| ["pattern binder shadows a name" ~]]
7410 [%| ["pattern binder shadows a name" ~]]
8350 =/ extended=ienv [[head.u.binder [i.args.typ ~]] [tail.u.binder [typ ~]] env]
7411 =/ extended=ienv [[head.u.binder [i.args.typ ~]] [tail.u.binder [typ ~]] env]
8351 =/ left=iresult
7412 =/ left=iresult
@@ -8357,9 +7418,9 @@
8357 (infer-union-context val.y typ.u.expected ?:(first-empty extended env) state.p.left context.u.expected)
7418 (infer-union-context val.y typ.u.expected ?:(first-empty extended env) state.p.left context.u.expected)
8358 ?: ?=(%| -.right) right
7419 ?: ?=(%| -.right) right
8359 ?^ expected [%& typ.u.expected state.p.right]
7420 ?^ expected [%& typ.u.expected state.p.right]
8360− =/ joined=(unit [typ=itype sub=isub]) (itype-branch-join typ.p.left typ.p.right sub.state.p.right)
7421+ =/ joined=(unit isub) (itype-unify typ.p.left typ.p.right sub.state.p.right)
8361 ?~ joined [%| ["list branch results need unsupported inference" ~]]
7422 ?~ joined [%| ["list branch results need unsupported inference" ~]]
8362− [%& typ.u.joined state.p.right(sub sub.u.joined)]
7423+ [%& typ.p.left state.p.right(sub u.joined)]
8364++ infer-unit-branch
7425++ infer-unit-branch
8365 |= [e=expr env=ienv state=istate expected=(unit [typ=itype context=span])]
7426 |= [e=expr env=ienv state=istate expected=(unit [typ=itype context=span])]
@@ -8382,15 +7443,10 @@
8382 [%| ["unit branch pattern is not supported by partial inference" ~]]
7443 [%| ["unit branch pattern is not supported by partial inference" ~]]
8383 =/ binder=(unit term) ?:(first-empty second-name first-name)
7444 =/ binder=(unit term) ?:(first-empty second-name first-name)
8384 ?~ binder [%| ["unit branch pattern is not supported by partial inference" ~]]
7445 ?~ binder [%| ["unit branch pattern is not supported by partial inference" ~]]
8385− ?: |((reserved-name u.binder) ?=(^ (ienv-lookup u.binder env)) (lien globals.state |=(n=term =(n u.binder))))
7446+ ?: |(=(u.binder %proj) ?=(^ (ienv-lookup u.binder env)) (lien globals.state |=(n=term =(n u.binder))))
8386 [%| ["pattern binder shadows a name" ~]]
7447 [%| ["pattern binder shadows a name" ~]]
8387 =/ payload=(unit itype) (unit-union-payload typ)
7448 =/ payload=(unit itype) (unit-union-payload typ)
8388 ?~ payload [%| ["unit branch subject is not supported by partial inference" ~]]
7449 ?~ payload [%| ["unit branch subject is not supported by partial inference" ~]]
8389− =/ payload-live=(unit [result=?(%yes %no %unknown) left=@ud])
8390− (itype-inhabited-proof u.payload sub.state.p.subject caps.state.p.subject 256)
8391− ?~ payload-live [%| ["unit payload reachability needs unsupported inference" ~]]
8392− ?: =(%unknown result.u.payload-live) [%| ["unit payload reachability needs unsupported inference" ~]]
8393− ?: =(%no result.u.payload-live) [%| ["unit present pattern is unreachable" ~]]
8394 =/ extended=ienv [[u.binder [u.payload ~]] env]
7450 =/ extended=ienv [[u.binder [u.payload ~]] env]
8395 =/ left=iresult
7451 =/ left=iresult
8396 ?~ expected (infer-fragment val.x ?:(first-empty env extended) state.p.subject)
7452 ?~ expected (infer-fragment val.x ?:(first-empty env extended) state.p.subject)
@@ -8401,9 +7457,9 @@
8401 (infer-union-context val.y typ.u.expected ?:(first-empty extended env) state.p.left context.u.expected)
7457 (infer-union-context val.y typ.u.expected ?:(first-empty extended env) state.p.left context.u.expected)
8402 ?: ?=(%| -.right) right
7458 ?: ?=(%| -.right) right
8403 ?^ expected [%& typ.u.expected state.p.right]
7459 ?^ expected [%& typ.u.expected state.p.right]
8404− =/ joined=(unit [typ=itype sub=isub]) (itype-branch-join typ.p.left typ.p.right sub.state.p.right)
7460+ =/ joined=(unit isub) (itype-unify typ.p.left typ.p.right sub.state.p.right)
8405 ?~ joined [%| ["unit branch results need unsupported inference" ~]]
7461 ?~ joined [%| ["unit branch results need unsupported inference" ~]]
8406− [%& typ.u.joined state.p.right(sub sub.u.joined)]
7462+ [%& typ.p.left state.p.right(sub u.joined)]
8408:: Infer pieces in order, retaining their substitutions and pending tags.
7464:: Infer pieces in order, retaining their substitutions and pending tags.
8409:: A bare decimal literal has no outside type constraint, so it takes its
7465:: A bare decimal literal has no outside type constraint, so it takes its
@@ -8489,83 +7545,11 @@
8489 ^- (unit ienv)
7545 ^- (unit ienv)
8490 =. t ?:(?=(%face -.t) body.t t)
7546 =. t ?:(?=(%face -.t) body.t t)
8491 ?: ?=(%bind -.p)
7547 ?: ?=(%bind -.p)
8492− ?: |((reserved-name name.p) ?=(^ (ienv-lookup name.p env)) (lien globals |=(n=term =(n name.p)))) ~
7548+ ?: |(=(name.p %proj) ?=(^ (ienv-lookup name.p env)) (lien globals |=(n=term =(n name.p)))) ~
8493 `[[name.p [t ~]] env]
7549 `[[name.p [t ~]] env]
8494 ?: ?=(%cell -.p) (union-pattern-bind-items items.p t env globals)
7550 ?: ?=(%cell -.p) (union-pattern-bind-items items.p t env globals)
8497−:: +branch-tag-name: a ?- pattern name that spells one of the subject's tags
8499−:: A name in a pattern binds, so `stop` written for `%stop` would
8500−:: catch every case left. Where the subject's type at a name's
8501−:: position is a union, or a one-case mold, with a case whose constant
8502−:: there is the term the name spells, the name is an error (Grammar,
8503−:: Patterns). Every path that checks a ?- asks this first, so they
8504−:: agree; it infers the subject apart and drops the state it leaves.
8505−:: A subject that fails, or whose type isn't known yet, is left to the
8506−:: path. Samples aren't patterns: every sample name binds.
8508− |= [e=expr env=ienv state=istate]
8510− ?. ?=(%branch -.e) ~
8511− ?. (lien arms.e |=(a=arm (union-pattern-has-bind pat.a))) ~
8512− =/ subject=iresult (infer-fragment subject.e env state)
8513− ?: ?=(%| -.subject) ~
8514− =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
8515− =/ arms=(list arm) arms.e
8518− =/ found=(unit [at=span name=term]) (tag-name-pattern pat.i.arms typ ~)
8519− ?~ found $(arms t.arms)
8520− =/ name=tape (trip name.u.found)
8522− :- "`{name}` binds a name, but the subject's type has `%{name}` here; write %{name}, or * for a catch-all"
8523− ~[[(span-of subject.e) "subject"] [at.u.found "pattern name"]]
8525−:: +tag-name-pattern: the first name in p that t types by a tag
8527−:: The walk enters faces, cells and unions, and of a union only the
8528−:: cases a cell pattern can match, so `[t %draft]` reads t at @t. It
8529−:: stops at atoms, `*`, variables, collections and recursive molds,
8530−:: and at a generic union's argument positions, which a type variable
8531−:: types in its mold, as u in `[~ u=A]`.
8533− |= [p=pattern t=itype args=(list itype)]
8534− ^- (unit [at=span name=term])
8535− ?. ?=(?(%bind %cell) -.p) ~
8536− ?: ?=(%face -.t) $(t body.t)
8537− ?: (lien args |=(a=itype =(a t))) ~
8539− =/ inner=(list itype) (weld args.t args)
8540− =/ cases=(list itype) cases.t
8543− ?: &(?=(%cell -.p) =(%none (union-pattern p i.cases))) $(cases t.cases)
8544− =/ found=(unit [at=span name=term]) (tag-name-pattern p i.cases inner)
8547− ?: ?=(%cell -.p) (tag-name-items items.p t args)
8548− ?. ?=(%const -.t) ~
8549− ?. &(=(%term form.literal.t) =(%tas aura.literal.t) =(name.p val.literal.t)) ~
8552−:: +tag-name-items: +tag-name-pattern along a cell pattern's items
8554−:: As in +union-pattern-items, the last item takes the rest of the
8555−:: spine. A union mid-spine is read as the rest of the pattern.
8557− |= [ps=(list pattern) t=itype args=(list itype)]
8558− ^- (unit [at=span name=term])
8560− ?~ t.ps (tag-name-pattern i.ps t args)
8561− ?: ?=(%face -.t) $(t body.t)
8562− ?: (lien args |=(a=itype =(a t))) ~
8563− ?: ?=(%union -.t) (tag-name-pattern [%cell at.i.ps ps] t args)
8565− =/ head=(unit [at=span name=term]) (tag-name-pattern i.ps hed.t args)
8567− $(ps t.ps, t tal.t)
8569:: Split loobean fields into finite refinements for partial patterns.
7553:: Split loobean fields into finite refinements for partial patterns.
8570:: Keep original cases for binder types and preserve whole-case matching
7554:: Keep original cases for binder types and preserve whole-case matching
8571:: before trying refinements. Cap products at 64; unknown, empty or opaque
7555:: before trying refinements. Cap products at 64; unknown, empty or opaque
@@ -8613,24 +7597,19 @@
8613 ^- (unit iresult)
7597 ^- (unit iresult)
8614 ?> ?=(%branch -.e)
7598 ?> ?=(%branch -.e)
8615 ?: ?=(%| -.subject) `subject
7599 ?: ?=(%| -.subject) `subject
8616− =/ decimal=(unit idiag) (decimal-arms-misfit arms.e typ.p.subject sub.state.p.subject)
8617− ?^ decimal `[%| u.decimal]
8618 =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
7600 =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
8619 ?. ?=(%union -.typ) `[%| ["branch is not supported by partial inference" ~]]
7601 ?. ?=(%union -.typ) `[%| ["branch is not supported by partial inference" ~]]
8620− =/ live=(unit (list itype)) (itype-live-cases cases.typ sub.state.p.subject caps.state.p.subject 4.096)
7602+ =/ cases=(list itype) cases.typ
8622− =/ cases=(list itype) u.live
8623 =/ remaining=(list itype) cases
7603 =/ remaining=(list itype) cases
8624 =/ arms=(list arm) arms.e
7604 =/ arms=(list arm) arms.e
8625 =/ st=istate state.p.subject
7605 =/ st=istate state.p.subject
8626− =/ results=(list itype) ~
7606+ =/ answer=(unit itype) ~
8629 ?^ remaining
7609 ?^ remaining
8630 `[%| ["missing union case {(show-itype i.remaining sub.st)}" ~]]
7610 `[%| ["missing union case {(show-itype i.remaining sub.st)}" ~]]
8631− =/ joined=(unit [typ=itype sub=isub]) (itype-branch-join-list (flop results) sub.st)
7611+ ?~ answer `[%| ["empty union branch is not supported by partial inference" ~]]
8632− ?~ joined `[%| ["union branch result matching needs unsupported inference" ~]]
7612+ `[%& u.answer st]
8633− `[%& typ.u.joined st(sub sub.u.joined)]
8634 =/ a=arm i.arms
7613 =/ a=arm i.arms
8635 ?: (lien remaining |=(c=itype =(%unknown (union-pattern pat.a c))))
7614 ?: (lien remaining |=(c=itype =(%unknown (union-pattern pat.a c))))
@@ -8646,20 +7625,18 @@
8646 =/ body=iresult (infer-fragment val.a u.bound st)
7625 =/ body=iresult (infer-fragment val.a u.bound st)
8647 ?: ?=(%| -.body) `body
7626 ?: ?=(%| -.body) `body
8648 =/ result=itype (itype-normalize typ.p.body sub.state.p.body)
7627 =/ result=itype (itype-normalize typ.p.body sub.state.p.body)
7628+ =/ mismatch=? ?~(answer | !=((itype-normalize u.answer sub.state.p.body) result))
7629+ ?: mismatch `[%| ["union branch result matching needs unsupported inference" ~]]
8649− $(arms t.arms, remaining (skim remaining |=(c=itype !=(%full (union-pattern pat.a c)))), st state.p.body, results [result results])
7630+ $(arms t.arms, remaining (skim remaining |=(c=itype !=(%full (union-pattern pat.a c)))), st state.p.body, answer `result)
8651++ infer-known-union-context-whole
7632++ infer-known-union-context-whole
8652 |= [e=expr expected=itype env=ienv subject=iresult context=span]
7633 |= [e=expr expected=itype env=ienv subject=iresult context=span]
8653 ^- (unit iresult)
7634 ^- (unit iresult)
8654 ?> ?=(%branch -.e)
7635 ?> ?=(%branch -.e)
8655 ?: ?=(%| -.subject) `subject
7636 ?: ?=(%| -.subject) `subject
8656− =/ decimal=(unit idiag) (decimal-arms-misfit arms.e typ.p.subject sub.state.p.subject)
8657− ?^ decimal `[%| u.decimal]
8658 =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
7637 =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
8659 ?. ?=(%union -.typ) `[%| ["branch is not supported by partial inference" ~]]
7638 ?. ?=(%union -.typ) `[%| ["branch is not supported by partial inference" ~]]
8660− =/ live=(unit (list itype)) (itype-live-cases cases.typ sub.state.p.subject caps.state.p.subject 4.096)
7639+ =/ cases=(list itype) cases.typ
8662− =/ cases=(list itype) u.live
8663 =/ remaining=(list itype) cases
7640 =/ remaining=(list itype) cases
8664 =/ arms=(list arm) arms.e
7641 =/ arms=(list arm) arms.e
8665 =/ st=istate state.p.subject
7642 =/ st=istate state.p.subject
@@ -8703,24 +7680,20 @@
8703 ?: ?=(%| -.subject) subject
7680 ?: ?=(%| -.subject) subject
8704 =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
7681 =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
8705 ?. ?=(%union -.typ) [%| ["branch is not supported by partial inference" ~]]
7682 ?. ?=(%union -.typ) [%| ["branch is not supported by partial inference" ~]]
8706− =/ live=(unit (list itype)) (itype-live-cases cases.typ sub.state.p.subject caps.state.p.subject 4.096)
8707− ?~ live [%| ["union emptiness needs unsupported inference" ~]]
8708− =/ expanded=(unit (list ifinite)) (finite-cases u.live ~ 0)
7683+ =/ expanded=(unit (list ifinite)) (finite-cases cases.typ ~ 0)
8709 ?~ expanded [%| ["union pattern expansion needs unsupported inference" ~]]
7684 ?~ expanded [%| ["union pattern expansion needs unsupported inference" ~]]
8710 =/ cases=(list ifinite) u.expanded
7685 =/ cases=(list ifinite) u.expanded
8711 =/ remaining=(list ifinite) cases
7686 =/ remaining=(list ifinite) cases
8712 =/ arms=(list arm) arms.e
7687 =/ arms=(list arm) arms.e
8713 =/ st=istate state.p.subject
7688 =/ st=istate state.p.subject
8714− =/ results=(list itype) ~
7689+ =/ answer=(unit itype) ~
8717 ?^ remaining
7692 ?^ remaining
8718 [%| ["missing union case {(show-itype part.i.remaining sub.st)}" ~]]
7693 [%| ["missing union case {(show-itype part.i.remaining sub.st)}" ~]]
8719− ?~ results [%| ["empty union branch is not supported by partial inference" ~]]
7694+ ?~ answer [%| ["empty union branch is not supported by partial inference" ~]]
8720− ?^ expected [%& typ.u.expected st]
7695+ ?~ expected [%& u.answer st]
8721− =/ joined=(unit [typ=itype sub=isub]) (itype-branch-join-list (flop results) sub.st)
7696+ [%& typ.u.expected st]
8722− ?~ joined [%| ["union branch result matching needs unsupported inference" ~]]
8723− [%& typ.u.joined st(sub sub.u.joined)]
8724 =/ a=arm i.arms
7697 =/ a=arm i.arms
8725 ?: (lien remaining |=(c=ifinite =(%unknown (union-pattern pat.a part.c))))
7698 ?: (lien remaining |=(c=ifinite =(%unknown (union-pattern pat.a part.c))))
8726 [%| ["partial union pattern is not supported by partial inference" ~]]
7699 [%| ["partial union pattern is not supported by partial inference" ~]]
@@ -8748,9 +7721,11 @@
8748 [%| ["union branch arm does not fit its expected type" ~[[context.u.expected "expected type"] [(span-of val.a) "branch arm"]]]]
7721 [%| ["union branch arm does not fit its expected type" ~[[context.u.expected "expected type"] [(span-of val.a) "branch arm"]]]]
8749 ?: (itype-has-tag (itype-normalize typ.u.expected sub.fit))
7722 ?: (itype-has-tag (itype-normalize typ.u.expected sub.fit))
8750 [%| ["union branch result needs context in partial inference" ~]]
7723 [%| ["union branch result needs context in partial inference" ~]]
8751− $(arms t.arms, remaining (skim remaining |=(c=ifinite !=(%full (union-pattern pat.a part.c)))), st state.p.body(sub sub.fit, next next.fit), results [typ.p.body results])
7724+ $(arms t.arms, remaining (skim remaining |=(c=ifinite !=(%full (union-pattern pat.a part.c)))), st state.p.body(sub sub.fit, next next.fit), answer `typ.u.expected)
8752 =/ result=itype (itype-normalize typ.p.body sub.state.p.body)
7725 =/ result=itype (itype-normalize typ.p.body sub.state.p.body)
7726+ =/ mismatch=? ?~(answer | !=((itype-normalize u.answer sub.state.p.body) result))
7727+ ?: mismatch [%| ["union branch result matching needs unsupported inference" ~]]
8753− $(arms t.arms, remaining (skim remaining |=(c=ifinite !=(%full (union-pattern pat.a part.c)))), st state.p.body, results [result results])
7728+ $(arms t.arms, remaining (skim remaining |=(c=ifinite !=(%full (union-pattern pat.a part.c)))), st state.p.body, answer `result)
8755:: Prove a one-arm record pattern covers a known, non-union subject.
7730:: Prove a one-arm record pattern covers a known, non-union subject.
8756:: Variable or partial matches stay unsupported; binding uses the same
7731:: Variable or partial matches stay unsupported; binding uses the same
@@ -8826,65 +7801,9 @@
8826 =/ cell=itype [%cell [%face head.typ [%atom aura.typ]] [%face tail.typ typ]]
7801 =/ cell=itype [%cell [%face head.typ [%atom aura.typ]] [%face tail.typ typ]]
8827 [%& [%union ~[nil cell] ~ ~ ~] state.p.subject(jrec-fuel (dec jrec-fuel.state.p.subject))]
7802 [%& [%union ~[nil cell] ~ ~ ~] state.p.subject(jrec-fuel (dec jrec-fuel.state.p.subject))]
8829−:: A bounded source-proven tree match permits flat tag patterns and
8830−:: nonbinding catch-alls. Whole-case binders cannot consume the temporary
8831−:: structural view. Pattern count and field arity are checked first.
8832−++ grec-simple-pattern
8833− |= [pat=pattern view=itype]
8835− ?. ?=(%cell -.pat) |
8837− =/ first=pattern i.items.pat
8838− ?. ?=(%lit -.first) |
8839− ?. =(%term form.lit.first) |
8840− =/ chosen=(unit itype) (contextual-tagged-case view val.lit.first ~)
8842− ?> ?=(%cell -.u.chosen)
8843− =/ rest=(list pattern) t.items.pat
8844− =/ arity=? ?:(?=(%cell -.tal.u.chosen) ?=([* [* ~]] rest) ?=([* ~] rest))
8846− (levy rest |=(p=pattern |(?=(%bind -.p) ?=(%any -.p))))
8848−:: A catch-all with no binder is safe even when it covers both cases.
8849−:: A bound whole case still declines to avoid exporting the analysis view.
8850−++ grec-patterns-eligible
8851− |= [arms=(list arm) view=itype left=@ud]
8855− =/ pat=pattern pat.i.arms
8856− ?. |(?=(%any -.pat) (grec-simple-pattern pat view)) |
8857− $(arms t.arms, left (dec left))
8859− |= [e=expr subject=iresult]
8861− ?: ?=(%| -.subject) subject
8862− ?. ?=(%branch -.e) subject
8863− ?. (grec-direct-context typ.p.subject sub.state.p.subject) subject
8864− =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
8865− ?. ?=(%grec -.typ) subject
8867− =/ view=(unit [view=itype left=@ud]) (grec-unfold-view typ jrec-fuel.state.p.subject)
8868− ?~ view [%| ["recursive mold unfolding needs unsupported inference" ~]]
8869− ?. (grec-patterns-eligible arms.e view.u.view 128) subject
8870− [%& view.u.view state.p.subject(jrec-fuel left.u.view)]
8872−:: A single-arm diagnostic only probes a direct, source-typed in-scope wing;
8873−:: other subjects retain the prior single-pattern inference path.
8874−++ grec-single-wing-subject
8875− |= [e=expr env=ienv state=istate]
8878− ?. ?=([@ ~] names.e) ~
8879− =/ scheme=(unit ischeme) (ienv-lookup i.names.e env)
8881− ?. (grec-direct-context typ.u.scheme sub.state) ~
8882− `(infer-fragment e env state)
8884++ infer-known-union-branch-subject
7804++ infer-known-union-branch-subject
8885 |= [e=expr env=ienv subject=iresult]
7805 |= [e=expr env=ienv subject=iresult]
8886 ^- iresult
7806 ^- iresult
8887− =. subject (grec-match-view e subject)
8888 =. subject (jrec-match-view e subject)
7807 =. subject (jrec-match-view e subject)
8889 =/ whole=(unit iresult) (infer-known-union-whole e env subject)
7808 =/ whole=(unit iresult) (infer-known-union-whole e env subject)
8890 ?~ whole (infer-known-union-finite e env subject ~)
7809 ?~ whole (infer-known-union-finite e env subject ~)
@@ -8899,7 +7818,6 @@
8899++ infer-known-union-context-subject
7818++ infer-known-union-context-subject
8900 |= [e=expr expected=itype env=ienv subject=iresult context=span]
7819 |= [e=expr expected=itype env=ienv subject=iresult context=span]
8901 ^- iresult
7820 ^- iresult
8902− =. subject (grec-match-view e subject)
8903 =. subject (jrec-match-view e subject)
7821 =. subject (jrec-match-view e subject)
8904 =/ whole=(unit iresult) (infer-known-union-context-whole e expected env subject context)
7822 =/ whole=(unit iresult) (infer-known-union-context-whole e expected env subject context)
8905 ?~ whole (infer-known-union-finite e env subject `[expected context])
7823 ?~ whole (infer-known-union-finite e env subject `[expected context])
@@ -8952,72 +7870,12 @@
8952 =/ subject=iresult (infer-fragment e env state)
7870 =/ subject=iresult (infer-fragment e env state)
8953 ?: ?=(%| -.subject) ?:((union-subject-call e) `subject ~)
7871 ?: ?=(%| -.subject) ?:((union-subject-call e) `subject ~)
8954 =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
7872 =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
8955− ?. |(?=(%union -.typ) ?=(%jrec -.typ) &(?=(%grec -.typ) (grec-direct-context typ.p.subject sub.state.p.subject))) ~
7873+ ?. |(?=(%union -.typ) ?=(%jrec -.typ)) ~
8956 `subject
7874 `subject
8958−:: A direct wing with an already-known union may skip genuinely empty cases
8959−:: when checking a one-arm match. Other subjects keep their existing path.
8960−:: A directly known canonical list of an empty element contains only null.
8961−:: This helper never refines an opaque or variable-bound subject.
8962−++ empty-list-null-branch
8963− |= [e=expr env=ienv state=istate expected=(unit [typ=itype context=span])]
8965− ?. ?=(%branch -.e) ~
8968− ?. (unit-empty-pattern pat.i.arms.e) ~
8969− ?. ?=(%wing -.subject.e) ~
8970− ?. ?=([@ ~] names.subject.e) ~
8971− =/ scheme=(unit ischeme) (ienv-lookup i.names.subject.e env)
8973− ?. ?=(%collection -.typ.u.scheme) ~
8974− ?. =(%list name.typ.u.scheme) ~
8976− ?. =(at.u.prelude.state /lib/jibb/prelude/jibb) ~
8977− =/ standard=(unit ischeme) (find-jibb-mold %list u.prelude.state)
8979− ?. =(u.standard [[%collection %list ~[[%var 0]]] ~[0]]) ~
8980− =/ subject=iresult (infer-fragment subject.e env state)
8981− ?: ?=(%| -.subject) ~
8982− =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
8983− ?. ?=(%collection -.typ) ~
8984− ?. =(%list name.typ) ~
8987− =/ proof=(unit [empty=? left=@ud]) (itype-empty-proof i.args.typ sub.state.p.subject 256)
8990− ?~ expected `(infer-fragment val.i.arms.e env state.p.subject)
8991− =/ body=iresult (infer-call-context-arg val.i.arms.e typ.u.expected env state.p.subject context.u.expected)
8992− ?: ?=(%| -.body) `body
8993− =/ fit=ifit (itype-fit typ.p.body typ.u.expected sub.state.p.body next.state.p.body)
8994− ?: ?=(%unknown -.fit) `[%| ["single-case branch result constraint is not supported by partial inference" ~]]
8995− ?: ?=(%bad -.fit) `[%| ["single-case branch arm does not fit its expected type" ~[[context.u.expected "expected type"] [(span-of val.i.arms.e) "branch arm"]]]]
8996− ?: (itype-has-tag (itype-normalize typ.u.expected sub.fit))
8997− `[%| ["single-case branch result needs context in partial inference" ~]]
8998− `[%& typ.p.body state.p.body(sub sub.fit, next next.fit)]
9000−++ known-empty-union-wing
9001− |= [e=expr env=ienv state=istate]
9004− ?. ?=([@ ~] names.e) ~
9005− =/ scheme=(unit ischeme) (ienv-lookup i.names.e env)
9007− ?. (contextual-direct-union typ.u.scheme) ~
9008− =/ subject=iresult (infer-fragment e env state)
9009− ?: ?=(%| -.subject) ~
9010− =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
9011− ?. ?=(%union -.typ) ~
9012− =/ live=(unit (list itype)) (itype-live-cases cases.typ sub.state.p.subject caps.state.p.subject 4.096)
9014− ?: =(u.live cases.typ) ~
9017:: Infer changes only against a fully known record spine. Retain the
7877:: Infer changes only against a fully known record spine. Retain the
9018−:: target type; unknown spines and overlapping edits remain unsupported.
7878+:: target type; unknown spines and repeated edits remain unsupported.
9019−:: An edit's wing, as open.cart, reads through record fields only,
9020−:: outermost first, and its value fits the field it names.
9021++ change-spine-known
7879++ change-spine-known
9022 |= [t=itype sub=isub]
7880 |= [t=itype sub=isub]
@@ -9029,87 +7887,26 @@
9029 $(t tal.t)
7887 $(t tal.t)
9031++ infer-change-edits
7889++ infer-change-edits
9032− |= [edits=(list edit) target=itype env=ienv state=istate seen=(list (list term))]
7890+ |= [edits=(list edit) target=itype env=ienv state=istate seen=(list term)]
9033 ^- iresult
7891 ^- iresult
9034 ?~ edits [%& target state]
7892 ?~ edits [%& target state]
9035 =/ entry=edit i.edits
7893 =/ entry=edit i.edits
9036− =/ outer=(list term) (flop names.entry)
7894+ ?: (lien seen |=(name=term =(name name.entry)))
9037− ?: (lien seen |=(prior=(list term) (wing-overlap prior outer)))
9038 [%| ["repeated change fields are not supported by partial inference" ~]]
7895 [%| ["repeated change fields are not supported by partial inference" ~]]
9039 ?. (change-spine-known target sub.state)
7896 ?. (change-spine-known target sub.state)
9040 [%| ["change target needs a known record in partial inference" ~]]
7897 [%| ["change target needs a known record in partial inference" ~]]
9041− =/ field=(each itype idiag) (change-wing-field entry target sub.state)
7898+ =/ found=(list itype) (record-fields-named name.entry target sub.state)
9042− ?: ?=(%| -.field) [%| p.field]
7899+ ?~ found
7900+ [%| ["record has no field `{(trip name.entry)}`" ~[[at.entry "unknown field"]]]]
7901+ ?^ t.found [%| ["change field is ambiguous in partial inference" ~]]
9043− =/ expected=itype p.field
7902+ =/ expected=itype i.found
9044 =/ value=iresult (infer-call-context-arg val.entry expected env state at.entry)
7903 =/ value=iresult (infer-call-context-arg val.entry expected env state at.entry)
9045 ?: ?=(%| -.value) value
7904 ?: ?=(%| -.value) value
9046 =/ fit=ifit (itype-fit typ.p.value expected sub.state.p.value next.state.p.value)
7905 =/ fit=ifit (itype-fit typ.p.value expected sub.state.p.value next.state.p.value)
9047 ?: ?=(%unknown -.fit) [%| ["change field constraint is not supported by partial inference" ~]]
7906 ?: ?=(%unknown -.fit) [%| ["change field constraint is not supported by partial inference" ~]]
9048 ?: ?=(%bad -.fit)
7907 ?: ?=(%bad -.fit)
9049− =/ decimal=(unit idiag) (decimal-misfit val.entry typ.p.value expected sub.state.p.value next.state.p.value)
9050− ?^ decimal [%| u.decimal]
9051 [%| ["change field and replacement do not unify" ~[[at.entry (site-type-note "expected replacement" expected sub.state.p.value)] [(span-of val.entry) (site-type-note "replacement" typ.p.value sub.state.p.value)]]]]
7908 [%| ["change field and replacement do not unify" ~[[at.entry (site-type-note "expected replacement" expected sub.state.p.value)] [(span-of val.entry) (site-type-note "replacement" typ.p.value sub.state.p.value)]]]]
9052− $(edits t.edits, state state.p.value(sub sub.fit, next next.fit), seen [outer seen])
7909+ $(edits t.edits, state state.p.value(sub sub.fit, next next.fit), seen [name.entry seen])
9054−:: +change-wing-field: the type of the field an edit's wing names in
9055−:: a known record target, read through record fields, outermost first
9057−++ change-wing-field
9058− |= [entry=edit target=itype sub=isub]
9059− ^- (each itype idiag)
9060− =/ outer=(list term) (flop names.entry)
9061− =/ k=@ud (lent names.entry)
9062− =/ typ=itype target
9063− =| through=(unit [name=term at=span])
9064− |- ^- (each itype idiag)
9066− =/ here=span (edit-name-at entry (dec k))
9067− ?: &(?=(^ through) !(change-spine-known typ sub))
9068− ?. (itype-not-record typ sub)
9069− [%| ["change wing needs a known record in partial inference" ~]]
9070− =/ label=tape "field `{(trip name.u.through)}`"
9072− :- "change wing `{(show-names names.entry)}` goes through `{(trip name.u.through)}`, which is not a record"
9073− ~[[at.u.through (site-type-note label typ sub)]]
9074− =/ found=(list itype) (record-fields-named i.outer typ sub)
9076− [%| ["record has no field `{(trip i.outer)}`" ~[[here "unknown field"]]]]
9077− ?^ t.found [%| ["change field is ambiguous in partial inference" ~]]
9078− $(outer t.outer, k (dec k), typ i.found, through `[i.outer here])
9080−:: +edit-name-at: where the kth name of an edit's wing is written,
9081−:: counting from 0: its names are joined by dots from the edit's start
9086− =/ col=@ud col.beg.at.e
9087− =/ ns=(list term) names.e
9090− =/ len=@ud (met 3 i.ns)
9091− ?: =(0 k) [[line.beg.at.e col] [line.beg.at.e (add col len)]]
9092− $(ns t.ns, k (dec k), col +((add col len)))
9094−:: +itype-not-record: whether a type is surely no record: an atom, a
9095−:: loobean, a list or other collection, a gate, a union or a noun
9098− |= [t=itype sub=isub]
9100− =. t (itype-walk t sub)
9101− ?=(?(%atom %any-atom %flag %const %tag %collection %fn %union %noun %empty) -.t)
9103−:: +wing-overlap: whether two edits' wings, outermost first, name the
9104−:: same field or one a field inside the other's
9107− |= [a=(list term) b=(list term)]
9114:: Backtick constructs the canonical prelude unit, after checking its
7911:: Backtick constructs the canonical prelude unit, after checking its
9115:: prepared template has the standard null and [~ u=A] cases.
7912:: prepared template has the standard null and [~ u=A] cases.
@@ -9213,183 +8010,6 @@
9213 ?. ?=(%ok -.first) ~
8010 ?. ?=(%ok -.first) ~
9214 $(items t.items, actual tal.actual, expected tal.expected, sub sub.first, next next.first)
8011 $(items t.items, actual tal.actual, expected tal.expected, sub sub.first, next next.first)
9216−:: +decimal-misfit: a decimal's error where another aura is expected
9218−:: A bare decimal is a @ud and fits only @ud, @u, @ and * (S4). After
9219−:: a value fails to fit, refit it with each decimal's variable widened
9220−:: to any aura (+decimal-relax), so that a gate's shared capital learns
9221−:: its aura from the other arguments, then walk the value's syntax
9222−:: beside the type it should fit. The first decimal whose place is an
9223−:: atom of another aura gets the error; otherwise ~, and the caller's
9224−:: own error stands.
9227− |= [e=expr actual=itype expected=itype sub=isub next=@ud]
9229− =/ loose=isub (turn sub |=(b=ibinding b(val (decimal-relax val.b))))
9230− =/ fit=ifit (itype-fit (decimal-relax actual) (decimal-relax expected) loose next)
9231− (decimal-misfit-at e (decimal-relax expected) ?:(?=(%ok -.fit) sub.fit loose))
9233−:: +decimal-relax: a type with each decimal's variable taking any aura
9240− %rnvar [%rvar id.t]
9241− %collection t(args (turn args.t |=(c=itype (decimal-relax c))))
9242− %grec t(args (turn args.t |=(c=itype (decimal-relax c))))
9243− %union t(cases (turn cases.t |=(c=itype (decimal-relax c))), args (turn args.t |=(c=itype (decimal-relax c))))
9244− %face t(body $(t body.t))
9245− %fn [%fn $(t sample.t) $(t product.t)]
9246− %cell [%cell $(t hed.t) $(t tal.t)]
9249−:: +decimal-misfit-at: walk a value beside the type it should fit
9251−:: Through groups, faces, tuples and term-headed pairs, the union case
9252−:: a tuple's head tag picks, units and list literals.
9254−++ decimal-misfit-at
9255− |= [e=expr expected=itype sub=isub]
9257− =. expected (itype-walk expected sub)
9258− ?: ?=(%face -.expected) $(expected body.expected)
9260− %lit (decimal-lit-misfit at.e lit.e expected |)
9261− %group $(e inner.e)
9262− %pair $(e (pair-as-cell e))
9263− %tuple (decimal-misfit-items items.e expected sub)
9265− ?. ?=(%collection -.expected) ~
9266− ?. &(=(%unit name.expected) ?=([* ~] args.expected)) ~
9267− $(e val.e, expected i.args.expected)
9269− ?. ?=(%collection -.expected) ~
9270− ?. &(=(%list name.expected) ?=([* ~] args.expected)) ~
9271− =/ items=(list expr) items.e
9274− =/ found=(unit idiag) ^$(e i.items, expected i.args.expected)
9279−:: +decimal-misfit-items: a tuple's items beside a cell, the last its tail
9281−++ decimal-misfit-items
9282− |= [items=(list item) expected=itype sub=isub]
9285− ?~ t.items (decimal-misfit-at val.i.items expected sub)
9286− =. expected (itype-walk expected sub)
9287− ?: ?=(%face -.expected) $(expected body.expected)
9288− ?: ?=(%union -.expected)
9289− =/ head=expr val.i.items
9290− ?. ?=(%lit -.head) ~
9291− =/ case=(unit itype) (decimal-case val.lit.head cases.expected sub)
9294− ?. ?=(%cell -.expected) ~
9295− =/ found=(unit idiag) (decimal-misfit-at val.i.items hed.expected sub)
9297− $(items t.items, expected tal.expected)
9299−:: +decimal-pattern-misfit: a decimal pattern where another aura is matched
9301−:: The subject's type is known, so no refit is needed. A cell pattern
9302−:: picks its union case by its head, as a tuple does.
9304−++ decimal-pattern-misfit
9305− |= [p=pattern expected=itype sub=isub]
9307− =. expected (itype-walk expected sub)
9308− ?: ?=(%face -.expected) $(expected body.expected)
9309− ?: ?=(%lit -.p) (decimal-lit-misfit at.p lit.p expected &)
9311− (decimal-pattern-items items.p expected sub)
9313−:: +decimal-pattern-items: a cell pattern's items, as +decimal-misfit-items
9315−++ decimal-pattern-items
9316− |= [items=(list pattern) expected=itype sub=isub]
9319− ?~ t.items (decimal-pattern-misfit i.items expected sub)
9320− =. expected (itype-walk expected sub)
9321− ?: ?=(%face -.expected) $(expected body.expected)
9322− ?: ?=(%union -.expected)
9323− ?. ?=(%lit -.i.items) ~
9324− =/ case=(unit itype) (decimal-case val.lit.i.items cases.expected sub)
9327− ?. ?=(%cell -.expected) ~
9328− =/ found=(unit idiag) (decimal-pattern-misfit i.items hed.expected sub)
9330− $(items t.items, expected tal.expected)
9332−:: +decimal-arms-misfit: the first arm whose pattern has a misplaced decimal
9334−++ decimal-arms-misfit
9335− |= [arms=(list arm) subject=itype sub=isub]
9338− =/ found=(unit idiag) (decimal-pattern-misfit pat.i.arms subject sub)
9342−:: +decimal-case: the one union case whose head is the constant value
9345− |= [value=@ cases=(list itype) sub=isub]
9347− =/ hits=(list itype)
9350− =. c (itype-walk c sub)
9352− =/ head=itype (itype-walk hed.c sub)
9353− =? head ?=(%face -.head) (itype-walk body.head sub)
9354− &(?=(%const -.head) =(value val.literal.head))
9355− ?. ?=([* ~] hits) ~
9358−:: +decimal-lit-misfit: the error for a decimal at a place of known type
9360−++ decimal-lit-misfit
9361− |= [at=span l=lit expected=itype pattern=?]
9363− ?. &(=(%number form.l) =(%ud aura.l)) ~
9364− ?. ?=(%atom -.expected) ~
9365− ?: (decimal-aura aura.expected) ~
9366− `[(decimal-misfit-msg l aura.expected pattern) ~[[at "decimal"]]]
9368−:: +decimal-misfit-msg: "`30` is a @ud, not a @dr; write ~s30"
9370−:: The hint writes the value in the expected aura's own literal where
9371−:: that reads naturally: 30 seconds, the text "30", the ship ~syd; a
9372−:: date gets an example. Patterns take no dates, durations or knots,
9373−:: so in a pattern those auras get no hint.
9375−++ decimal-misfit-msg
9376− |= [l=lit aura=@ta pattern=?]
9378− =/ what=tape "`{(trip txt.l)}` is a @ud, not a @{(trip aura)}"
9380− ?: &(pattern ?=(?(%da %dr %ta) aura)) ""
9382− %da "a date, as ~2026.1.1"
9383− %dr (trip (scot %dr (mul val.l ~s1)))
9384− %p (trip (scot %p val.l))
9385− %t (show-quoted txt.l)
9386− %ta "~.{(trip txt.l)}"
9387− %ux (trip (scot %ux val.l))
9388− %uv (trip (scot %uv val.l))
9391− "{what}; write {hint}"
9393:: A term-headed pair is the same noun as a two-item cell. Preserve the
8013:: A term-headed pair is the same noun as a two-item cell. Preserve the
9394:: whole pair span for the synthetic head and the value's own span for
8014:: whole pair span for the synthetic head and the value's own span for
9395:: the payload; unresolved term constraints follow ordinary cell inference.
8015:: the payload; unresolved term constraints follow ordinary cell inference.
@@ -9424,8 +8044,8 @@
9424 %duration [%& [%atom %dr] state]
8044 %duration [%& [%atom %dr] state]
9425 %knot [%& [%atom %ta] state]
8045 %knot [%& [%atom %ta] state]
9426 %loobean [%& [%flag ~] state]
8046 %loobean [%& [%flag ~] state]
9427− %term [%& [%tag next.state lit.e |] state(next +(next.state), tags [[next.state lit.e at.e] tags.state])]
8047+ %term [%& [%tag next.state lit.e |] state(next +(next.state), tags [[next.state lit.e] tags.state])]
9428− %null [%& [%tag next.state lit.e |] state(next +(next.state), tags [[next.state lit.e at.e] tags.state])]
8048+ %null [%& [%tag next.state lit.e |] state(next +(next.state), tags [[next.state lit.e] tags.state])]
9431 ?~ prelude.state [%| ["unit construction needs the standard prelude in partial inference" ~]]
8051 ?~ prelude.state [%| ["unit construction needs the standard prelude in partial inference" ~]]
@@ -9447,7 +8067,7 @@
9447 ?. =(u.standard [[%collection %list ~[[%var 0]]] ~[0]])
8067 ?. =(u.standard [[%collection %list ~[[%var 0]]] ~[0]])
9448 [%| ["list literal needs the standard prelude in partial inference" ~]]
8068 [%| ["list literal needs the standard prelude in partial inference" ~]]
9449 =/ element=itype [%var next.state]
8069 =/ element=itype [%var next.state]
9450− =/ result=iresult (infer-open-list-items items.e element env state(next +(next.state)) at.e ~)
8070+ =/ result=iresult (infer-open-list-items items.e element env state(next +(next.state)) at.e)
9451 ?: ?=(%| -.result) result
8071 ?: ?=(%| -.result) result
9452 [%& [%collection %list ~[element]] state.p.result]
8072 [%& [%collection %list ~[element]] state.p.result]
9453 %str (infer-string-pieces pieces.e env state)
8073 %str (infer-string-pieces pieces.e env state)
@@ -9479,7 +8099,6 @@
9479 [%& typ.instance state.instance]
8099 [%& typ.instance state.instance]
9480 =/ scheme=(unit ischeme) (ienv-lookup i.names.e env)
8100 =/ scheme=(unit ischeme) (ienv-lookup i.names.e env)
9481 ?~ scheme
8101 ?~ scheme
9482− ?: =(i.names.e %unface) [%| (unface-value at.e)]
9483 ?~ prelude.state [%| ["name is not available to partial inference" ~]]
8102 ?~ prelude.state [%| ["name is not available to partial inference" ~]]
9484 =/ prelude-entry=(unit ischeme) (ienv-lookup i.names.e values.u.prelude.state)
8103 =/ prelude-entry=(unit ischeme) (ienv-lookup i.names.e values.u.prelude.state)
9485 ?~ prelude-entry [%| ["name is not available to partial inference" ~]]
8104 ?~ prelude-entry [%| ["name is not available to partial inference" ~]]
@@ -9487,24 +8106,18 @@
9487 [%& typ.inst state.inst]
8106 [%& typ.inst state.inst]
9488 =/ instance=[typ=itype state=istate] (instantiate-scheme u.scheme state)
8107 =/ instance=[typ=itype state=istate] (instantiate-scheme u.scheme state)
9489 [%& typ.instance state.instance]
8108 [%& typ.instance state.instance]
9491− ?: &(?=(%wing -.inner.e) =(names.inner.e ~[%unface]) ?=(~ (ienv-lookup %unface env)))
9492− [%| ["unface takes one argument, as (unface e)" ~[[at.e "unface call"]]]]
9493− $(e inner.e)
8109+ %group $(e inner.e)
9495 ?~ edits.e [%| ["a change takes at least one field" ~[[at.e "empty change"]]]]
8111 ?~ edits.e [%| ["a change takes at least one field" ~[[at.e "empty change"]]]]
9496 =/ target=iresult $(e [%wing at.e target.e])
8112 =/ target=iresult $(e [%wing at.e target.e])
9497 ?: ?=(%| -.target) target
8113 ?: ?=(%| -.target) target
9498 (infer-change-edits edits.e typ.p.target env state.p.target ~)
8114 (infer-change-edits edits.e typ.p.target env state.p.target ~)
9499− %ctor [%& [%tag next.state tag.e &] state(next +(next.state), tags [[next.state tag.e at.e] tags.state])]
8115+ %ctor [%& [%tag next.state tag.e &] state(next +(next.state), tags [[next.state tag.e] tags.state])]
9501 =/ traced=iresult $(e val.e)
8117 =/ traced=iresult $(e val.e)
9502 ?: ?=(%| -.traced) traced
8118 ?: ?=(%| -.traced) traced
9503 $(e then.e, state state.p.traced)
8119 $(e then.e, state state.p.traced)
9505− ?: &(?=(^ defer.state) ?=(^ prelude.state))
9506− (dg-infer-tuple-items items.e env state)
9507− (infer-simple-items items.e env state)
8120+ %tuple (infer-simple-items items.e env state)
9509 ?~ defs.e $(e final.e)
8122 ?~ defs.e $(e final.e)
9510 =/ local-names=(list term) (global-value-names defs.e)
8123 =/ local-names=(list term) (global-value-names defs.e)
@@ -9527,17 +8140,8 @@
9527 ?: ?=(%| -.result) result
8140 ?: ?=(%| -.result) result
9528 [%& typ.p.result state.p.result(globals globals.state, molds molds.state)]
8141 [%& typ.p.result state.p.result(globals globals.state, molds molds.state)]
9530− =/ named=(unit idiag) (branch-tag-name e env state)
9531− ?^ named [%| u.named]
9532− ?^ defer.state (dg-boolean-branch e env state)
9533 ?~ arms.e [%| ["branch is not supported by partial inference" ~]]
8143 ?~ arms.e [%| ["branch is not supported by partial inference" ~]]
9534 ?~ t.arms.e
8144 ?~ t.arms.e
9535− =/ empty-list=(unit iresult) (empty-list-null-branch e env state ~)
9536− ?^ empty-list u.empty-list
9537− =/ empty-union=(unit iresult) (known-empty-union-wing subject.e env state)
9538− ?^ empty-union (infer-known-union-branch-subject e env u.empty-union)
9539− =/ single=(unit iresult) (grec-single-wing-subject subject.e env state)
9540− ?^ single (infer-known-union-branch-subject e env u.single)
9541 ?: (single-structured-pattern e) (infer-single-case-branch e env state ~)
8145 ?: (single-structured-pattern e) (infer-single-case-branch e env state ~)
9542 (infer-cell-branch e env state ~)
8146 (infer-cell-branch e env state ~)
9543 ?^ t.t.arms.e (infer-known-union-branch e env state)
8147 ?^ t.t.arms.e (infer-known-union-branch e env state)
@@ -9569,22 +8173,22 @@
9569 ?: ?=(%| -.right) right
8173 ?: ?=(%| -.right) right
9570 =/ ltype=itype (itype-normalize typ.p.left sub.state.p.right)
8174 =/ ltype=itype (itype-normalize typ.p.left sub.state.p.right)
9571 =/ rtype=itype (itype-normalize typ.p.right sub.state.p.right)
8175 =/ rtype=itype (itype-normalize typ.p.right sub.state.p.right)
8176+ ?: &(!=(ltype rtype) |(?=(^ (itype-vars ltype)) ?=(^ (itype-vars rtype))) |((itype-has-fixed-atom ltype) (itype-has-fixed-atom rtype)))
8177+ [%| ["branch widening is not supported by partial inference" ~]]
9572− =/ joined=(unit [typ=itype sub=isub]) (itype-branch-join typ.p.left typ.p.right sub.state.p.right)
8178+ =/ joined=(unit isub) (itype-unify typ.p.left typ.p.right sub.state.p.right)
9573 ?~ joined
8179 ?~ joined
9574 ?: |((itype-has-recursive ltype) (itype-has-recursive rtype))
8180 ?: |((itype-has-recursive ltype) (itype-has-recursive rtype))
9575 [%| ["recursive branch matching is not supported by partial inference" ~]]
8181 [%| ["recursive branch matching is not supported by partial inference" ~]]
9576 ?: |((itype-has-tag ltype) (itype-has-tag rtype) (itype-has-union ltype) (itype-has-union rtype))
8182 ?: |((itype-has-tag ltype) (itype-has-tag rtype) (itype-has-union ltype) (itype-has-union rtype))
9577 [%| ["branch tag or union context is not supported by partial inference" ~]]
8183 [%| ["branch tag or union context is not supported by partial inference" ~]]
8184+ =/ common=(unit itype) (itype-concrete-join typ.p.left typ.p.right sub.state.p.right)
8185+ ?^ common [%& u.common state.p.right]
9578 ?: |((itype-has-face typ.p.left sub.state.p.right) (itype-has-face typ.p.right sub.state.p.right))
8186 ?: |((itype-has-face typ.p.left sub.state.p.right) (itype-has-face typ.p.right sub.state.p.right))
9579 [%| ["record branch matching is not supported by partial inference" ~]]
8187 [%| ["record branch matching is not supported by partial inference" ~]]
9580 ?: |((itype-has-any-atom typ.p.left sub.state.p.right) (itype-has-any-atom typ.p.right sub.state.p.right) (itype-family-related typ.p.left typ.p.right sub.state.p.right))
8188 ?: |((itype-has-any-atom typ.p.left sub.state.p.right) (itype-has-any-atom typ.p.right sub.state.p.right) (itype-family-related typ.p.left typ.p.right sub.state.p.right))
9581 [%| ["branch widening is not supported by partial inference" ~]]
8189 [%| ["branch widening is not supported by partial inference" ~]]
9582− =/ decimal-x=(unit idiag) (decimal-misfit val.x typ.p.left typ.p.right sub.state.p.right next.state.p.right)
9583− ?^ decimal-x [%| u.decimal-x]
9584− =/ decimal-y=(unit idiag) (decimal-misfit val.y typ.p.right typ.p.left sub.state.p.right next.state.p.right)
9585− ?^ decimal-y [%| u.decimal-y]
9586 [%| ["branch arms have incompatible types" ~[[(span-of val.x) (site-type-note "first arm" typ.p.left sub.state.p.right)] [(span-of val.y) (site-type-note "second arm" typ.p.right sub.state.p.right)]]]]
8190 [%| ["branch arms have incompatible types" ~[[(span-of val.x) (site-type-note "first arm" typ.p.left sub.state.p.right)] [(span-of val.y) (site-type-note "second arm" typ.p.right sub.state.p.right)]]]]
9587− [%& typ.u.joined state.p.right(sub sub.u.joined)]
8191+ [%& typ.p.left state.p.right(sub u.joined)]
9589 =/ target=(unit [typ=itype state=istate]) (infer-simple-shape shape.e state)
8193 =/ target=(unit [typ=itype state=istate]) (infer-simple-shape shape.e state)
9590 ?~ target
8194 ?~ target
@@ -9604,11 +8208,7 @@
9604 ?^ missing [%| u.missing]
8208 ?^ missing [%| u.missing]
9605 =/ nested=(unit idiag) (nested-missing-tag val.e typ.p.value typ.u.target sub.state.p.value next.state.p.value at.shape.e)
8209 =/ nested=(unit idiag) (nested-missing-tag val.e typ.p.value typ.u.target sub.state.p.value next.state.p.value at.shape.e)
9606 ?^ nested [%| u.nested]
8210 ?^ nested [%| u.nested]
9607− =/ decimal=(unit idiag) (decimal-misfit val.e typ.p.value typ.u.target sub.state.p.value next.state.p.value)
9608− ?^ decimal [%| u.decimal]
9609 [%| ["cast mold and expression type do not unify" ~[[at.shape.e (site-type-note "cast mold" typ.u.target sub.state.p.value)] [(span-of val.e) (site-type-note "expression" typ.p.value sub.state.p.value)]]]]
8211 [%| ["cast mold and expression type do not unify" ~[[at.shape.e (site-type-note "cast mold" typ.u.target sub.state.p.value)] [(span-of val.e) (site-type-note "expression" typ.p.value sub.state.p.value)]]]]
9610− ?: &(?=(^ defer.state.p.value) !(dg-stable-fit typ.p.value typ.u.target sub.fit))
9611− [%| ["deferred cast fit needs stable inference" ~]]
9612 =/ merged=itype (itype-merge-faces typ.p.value typ.u.target sub.fit)
8212 =/ merged=itype (itype-merge-faces typ.p.value typ.u.target sub.fit)
9613 [%& merged state.p.value(sub sub.fit, next next.fit)]
8213 [%& merged state.p.value(sub sub.fit, next next.fit)]
9614 %crash [%& [%var next.state] state(next +(next.state))]
8214 %crash [%& [%var next.state] state(next +(next.state))]
@@ -9634,7 +8234,6 @@
9634 ?~ args.e [%| ["call has no argument" ~]]
8234 ?~ args.e [%| ["call has no argument" ~]]
9635 ?: (explicit-proj-call e env state)
8235 ?: (explicit-proj-call e env state)
9636 [%| ["proj needs an expected record type" ~]]
8236 [%| ["proj needs an expected record type" ~]]
9637− ?: (reserved-call %unface e env state) (infer-unface e env state)
9638 (infer-call-with-head e env state (infer-fragment head.e env state))
8237 (infer-call-with-head e env state (infer-fragment head.e env state))
9639 * [%| ["expression is not supported by partial inference" ~]]
8238 * [%| ["expression is not supported by partial inference" ~]]
@@ -9917,35 +8516,21 @@
9917 ?: ?=(%ok -.fit) ~
8516 ?: ?=(%ok -.fit) ~
9918 (direct-gate-call-fit e typ.p.arg sample.ht env st)
8517 (direct-gate-call-fit e typ.p.arg sample.ht env st)
9919 =. fit ?~(direct fit u.direct)
8518 =. fit ?~(direct fit u.direct)
9920− ?: ?=(%unknown -.fit)
9921− ?~ defer.st [%| ["call constraint is not supported by partial inference" ~]]
8519+ ?: ?=(%unknown -.fit) [%| ["call constraint is not supported by partial inference" ~]]
9922− =/ edge=(unit dgo) (dg-eligible-ctor e typ.p.head typ.p.arg sample.ht st)
9923− ?~ edge [%| ["call constraint is not supported by partial inference" ~]]
9924− ?: (gth (lent obligations.st) 63) [%| ["call constraint is not supported by partial inference" ~]]
9925− [%& product.ht st(obligations [u.edge obligations.st])]
9927 ?: ?=(%bad -.fit)
8520 ?: ?=(%bad -.fit)
9928 ?~ t.args.e
8521 ?~ t.args.e
9929 =/ missing=(unit idiag) (missing-union-tag i.args.e sample.ht sub.st (span-of head.e))
8522 =/ missing=(unit idiag) (missing-union-tag i.args.e sample.ht sub.st (span-of head.e))
9930 ?^ missing [%| u.missing]
8523 ?^ missing [%| u.missing]
9931 =/ nested=(unit idiag) (nested-missing-tag i.args.e typ.p.arg sample.ht sub.st next.st (span-of head.e))
8524 =/ nested=(unit idiag) (nested-missing-tag i.args.e typ.p.arg sample.ht sub.st next.st (span-of head.e))
9932 ?^ nested [%| u.nested]
8525 ?^ nested [%| u.nested]
9933− =/ decimal=(unit idiag) (decimal-misfit i.args.e typ.p.arg sample.ht sub.st next.st)
9934− ?^ decimal [%| u.decimal]
9935 [%| ["call's sample and argument types do not unify" ~[[(span-of head.e) (site-type-note "called gate" ht sub.st)] [(span-of i.args.e) (site-type-note "argument" typ.p.arg sub.st)]]]]
8526 [%| ["call's sample and argument types do not unify" ~[[(span-of head.e) (site-type-note "called gate" ht sub.st)] [(span-of i.args.e) (site-type-note "argument" typ.p.arg sub.st)]]]]
9936 =/ bad=(unit [at=span typ=itype])
8527 =/ bad=(unit [at=span typ=itype])
9937 (call-error-site args.e typ.p.arg sample.ht sub.st next.st)
8528 (call-error-site args.e typ.p.arg sample.ht sub.st next.st)
9938 =/ whole-args=span
8529 =/ whole-args=span
9939 [beg:(span-of i.args.e) end:(span-of (rear args.e))]
8530 [beg:(span-of i.args.e) end:(span-of (rear args.e))]
9940− =/ decimal=(unit idiag)
9941− =/ items=(list item) (turn args.e |=(a=expr [(span-of a) ~ a]))
9942− (decimal-misfit [%tuple whole-args items] typ.p.arg sample.ht sub.st next.st)
9943− ?^ decimal [%| u.decimal]
9944 =/ arg-at=span ?~(bad whole-args at.u.bad)
8531 =/ arg-at=span ?~(bad whole-args at.u.bad)
9945 =/ arg-type=itype ?~(bad typ.p.arg typ.u.bad)
8532 =/ arg-type=itype ?~(bad typ.p.arg typ.u.bad)
9946 [%| ["call's sample and argument types do not unify" ~[[(span-of head.e) (site-type-note "called gate" ht sub.st)] [arg-at (site-type-note "argument" arg-type sub.st)]]]]
8533 [%| ["call's sample and argument types do not unify" ~[[(span-of head.e) (site-type-note "called gate" ht sub.st)] [arg-at (site-type-note "argument" arg-type sub.st)]]]]
9947− ?: &(?=(^ defer.st) !(dg-stable-call-fit typ.p.arg sample.ht product.ht sub.fit ?=(^ t.args.e)))
9948− [%| ["deferred call fit needs stable inference" ~]]
9949 =/ face-asym=?
8534 =/ face-asym=?
9950 ?^ direct |
8535 ?^ direct |
9951 ?^ t.args.e (itype-positional-face-asym args.e typ.p.arg sample.ht sub.fit)
8536 ?^ t.args.e (itype-positional-face-asym args.e typ.p.arg sample.ht sub.fit)
@@ -10011,8 +8596,6 @@
10011 ?^ missing [%| u.missing]
8596 ?^ missing [%| u.missing]
10012 =/ nested=(unit idiag) (nested-missing-tag val.e typ.p.value payload sub.state.p.value next.state.p.value context)
8597 =/ nested=(unit idiag) (nested-missing-tag val.e typ.p.value payload sub.state.p.value next.state.p.value context)
10013 ?^ nested [%| u.nested]
8598 ?^ nested [%| u.nested]
10014− =/ decimal=(unit idiag) (decimal-misfit val.e typ.p.value payload sub.state.p.value next.state.p.value)
10015− ?^ decimal [%| u.decimal]
10016 [%| ["unit payload does not fit its expected type" ~[[context (site-type-note "expected unit payload" payload sub.state.p.value)] [(span-of val.e) (site-type-note "payload" typ.p.value sub.state.p.value)]]]]
8599 [%| ["unit payload does not fit its expected type" ~[[context (site-type-note "expected unit payload" payload sub.state.p.value)] [(span-of val.e) (site-type-note "payload" typ.p.value sub.state.p.value)]]]]
10017 [%& expected state.p.value(sub sub.fit, next next.fit)]
8600 [%& expected state.p.value(sub sub.fit, next next.fit)]
@@ -10025,7 +8608,6 @@
10025 ^- iresult
8608 ^- iresult
10026 ?> ?=(%call -.e)
8609 ?> ?=(%call -.e)
10027 ?~ args.e [%| ["call has no argument" ~]]
8610 ?~ args.e [%| ["call has no argument" ~]]
10028− ?: (reserved-call %unface e env state) (infer-unface e env state)
10029 =/ head=iresult (infer-fragment head.e env state)
8611 =/ head=iresult (infer-fragment head.e env state)
10030 ?: ?=(%| -.head) head
8612 ?: ?=(%| -.head) head
10031 =/ ht=itype (itype-walk typ.p.head sub.state.p.head)
8613 =/ ht=itype (itype-walk typ.p.head sub.state.p.head)
@@ -10042,17 +8624,7 @@
10042 ?~ args.result |
8624 ?~ args.result |
10043 ?. =((lent args.result) (lent args.expected)) |
8625 ?. =((lent args.result) (lent args.expected)) |
10044 ?: |((itype-has-tag (itype-normalize result sub.state.p.head)) (itype-has-tag (itype-normalize expected sub.state.p.head))) |
8626 ?: |((itype-has-tag (itype-normalize result sub.state.p.head)) (itype-has-tag (itype-normalize expected sub.state.p.head))) |
10045− =/ result-recursive=? (itype-has-recursive (itype-normalize result sub.state.p.head))
10046− =/ expected-recursive=? (itype-has-recursive (itype-normalize expected sub.state.p.head))
8627+ ?: |((itype-has-recursive (itype-normalize result sub.state.p.head)) (itype-has-recursive (itype-normalize expected sub.state.p.head))) |
10048− ?. result-recursive &
10049− ?~ prelude.state |
10050− &(=(at.u.prelude.state /lib/jibb/prelude/jibb) =(origin.result `[at.u.prelude.state %element]))
10052− ?. expected-recursive &
10053− ?~ prelude.state |
10054− &(=(at.u.prelude.state /lib/jibb/prelude/jibb) =(origin.expected `[at.u.prelude.state %element]))
10055− ?. &(result-ok expected-ok) |
10056 ?: |((itype-has-any-atom result sub.state.p.head) (itype-has-any-atom expected sub.state.p.head)) |
8628 ?: |((itype-has-any-atom result sub.state.p.head) (itype-has-any-atom expected sub.state.p.head)) |
10058 ?. eligible (infer-call-with-head e env state head)
8630 ?. eligible (infer-call-with-head e env state head)
@@ -10108,70 +8680,18 @@
10108 `(infer-simple-items items.e env state)
8680 `(infer-simple-items items.e env state)
10109 `(width-infer-items items.e index.u.target env state context)
8681 `(width-infer-items items.e index.u.target env state context)
10111−:: +reserved-call: whether e calls the reserved operation n
10113−:: Experimental intrinsic recognition; real bindings retain normal calls.
8683+:: Experimental intrinsic recognition; real bindings retain normal calls.
10115− |= [n=term e=expr env=ienv state=istate]
10117− ?. ?=(%call -.e) |
10118− ?. ?=(%wing -.head.e) |
10119− ?. =(names.head.e ~[n]) |
10120− ?: ?=(^ (ienv-lookup n env)) |
10121− ?: (lien globals.state |=(x=term =(x n))) |
10122− ?~ prelude.state &
10123− ?:(?=(^ (ienv-lookup n values.u.prelude.state)) | &)
10124++ explicit-proj-call
8684++ explicit-proj-call
10125 |= [e=expr env=ienv state=istate]
8685 |= [e=expr env=ienv state=istate]
10127 ?. ?=(%call -.e) |
8687 ?. ?=(%call -.e) |
10128 ?. ?=([* ~] args.e) |
8688 ?. ?=([* ~] args.e) |
10129− (reserved-call %proj e env state)
8689+ ?. ?=(%wing -.head.e) |
10130−::
8690+ ?. =(names.head.e ~[%proj]) |
10131−:: +infer-unface: (unface e), e's type with every face removed
8691+ ?: ?=(^ (ienv-lookup %proj env)) |
10132−::
8692+ ?: (lien globals.state |=(n=term =(n %proj))) |
10133−:: A reserved operation handled by type, like proj. Any number of
8693+ ?~ prelude.state &
10134−:: arguments is taken here so that a wrong count is an error. A type
8694+ ?:(?=(^ (ienv-lookup %proj values.u.prelude.state)) | &)
10135−:: not yet known would wait, as wing access does; the partial checker
10136−:: has no such wait and reports it as unsupported, as it does field
10137−:: access on such a type.
10139− |= [e=expr env=ienv state=istate]
10142− ?. ?=([* ~] args.e)
10143− [%| ["unface takes one argument, as (unface e)" ~[[at.e "unface call"]]]]
10144− ?^ defer.state [%| ["deferred unface needs unsupported inference" ~]]
10145− =/ value=iresult (infer-fragment i.args.e env state)
10146− ?: ?=(%| -.value) value
10147− =/ typ=itype (itype-walk typ.p.value sub.state.p.value)
10148− ?: ?=(?(%var %fvar) -.typ)
10149− [%| ["unface on a type not yet known is not supported by partial inference" ~]]
10150− [%& (itype-unface typ sub.state.p.value) state.p.value]
10152−:: +unface-value: the error for unface written where a value goes
10157− ["unface is not a value; write |=(g (unface g))" ~[[at "unface used as a value"]]]
10159−:: +unfaced-gate: the gate under a ++'s (unface |= …), or ~
10161−:: Such a ++ is a gate for recursion: its own name has the unfaced
10162−:: type, and its body may call it.
10164− |= [e=expr env=ienv state=istate]
10166− ?: ?=(%group -.e) $(e inner.e)
10167− ?. (reserved-call %unface e env state) ~
10169− ?. ?=([* ~] args.e) ~
10170− =/ gate=expr i.args.e
10172− ?: ?=(%group -.gate) $(gate inner.gate)
10173− ?. ?=(?(%gate %gate-wide) -.gate) ~
10175++ infer-proj-source
8695++ infer-proj-source
10176 |= [e=expr expected=itype env=ienv state=istate context=span]
8696 |= [e=expr expected=itype env=ienv state=istate context=span]
10177 ^- iresult
8697 ^- iresult
@@ -10244,20 +8764,6 @@
10244 ?: ?=(?(%cell %face %fn %union %collection) -.val.i.sub) |
8764 ?: ?=(?(%cell %face %fn %union %collection) -.val.i.sub) |
10245 $(sub t.sub)
8765 $(sub t.sub)
10247−:: Check the syntactic root before scanning; scan substitutions once.
10248−++ grec-direct-context
10249− |= [expected=itype sub=isub]
10253− ?: ?=(%face -.expected)
10255− $(expected body.expected, left (dec left))
10256− ?. ?=(%grec -.expected) |
10259− ?: ?=(?(%cell %face %fn %union %collection %grec) -.val.i.sub) |
10260− $(sub t.sub, left (dec left))
10261++ contextual-direct-union
8767++ contextual-direct-union
10262 |= target=itype
8768 |= target=itype
@@ -10282,112 +8788,9 @@
10282 $(remaining t.remaining, found `c)
8788 $(remaining t.remaining, found `c)
10283 $(remaining t.remaining)
8789 $(remaining t.remaining)
10285−:: A bounded syntactic screen: no nested branch, cast, gate or local body
10286−:: can re-enter cell-branch retry during either inference attempt.
10287−++ closed-cell-retry-safe
10288− |= [todo=(list expr) fuel=@ud]
10293− =. fuel (dec fuel)
10295− %lit $(todo t.todo)
10296− %wing $(todo t.todo)
10297− %ctor $(todo t.todo)
10298− %path $(todo t.todo)
10299− %crash $(todo t.todo)
10301− ?. (levy pieces.e |=(p=piece ?=(%text -.p))) |
10303− %group $(todo [inner.e t.todo])
10304− %pair $(todo [val.e t.todo])
10305− %unit $(todo [val.e t.todo])
10306− %list $(todo (weld items.e t.todo))
10307− %tuple $(todo (weld (turn items.e |=(i=item val.i)) t.todo))
10308− %change $(todo (weld (turn edits.e |=(ed=edit val.ed)) t.todo))
10309− %call $(todo [head.e (weld args.e t.todo)])
10310− %trace $(todo [val.e then.e t.todo])
10313−++ closed-cell-sub-safe
10314− |= [sub=isub fuel=@ud]
10318− ?: ?=(?(%cell %face %fn %union %collection %grec %jrec %recursive) -.val.i.sub) |
10319− $(sub t.sub, fuel (dec fuel))
10321−++ closed-cell-branch-eligible
10322− |= [e=expr expected=itype sub=isub]
10324− ?. &(?=(%branch -.e) ?=(%cell -.expected) (closed-cell-sub-safe sub 512)) |
10329− =/ y=arm i.t.arms.e
10330− ?. &(?=(%lit -.pat.x) ?=(%lit -.pat.y)) |
10331− ?. &(=(%loobean form.lit.pat.x) =(%loobean form.lit.pat.y)) |
10332− ?: =(val.lit.pat.x val.lit.pat.y) |
10333− (closed-cell-retry-safe ~[subject.e val.x val.y] 512)
10335−:: Attempt ordinary inference first; retry from the same state only for
10336−:: the bounded non-reentrant syntax above. Preserve original value faces.
10337−++ infer-closed-cell-branch
10338− |= [e=expr expected=itype env=ienv state=istate context=span]
10340− ?> (closed-cell-branch-eligible e expected sub.state)
10341− ?> ?=(%branch -.e)
10344− =/ ordinary=iresult (infer-fragment e env state)
10345− =/ ordinary-good=?
10346− ?: ?=(%| -.ordinary) |
10347− =/ fit=ifit (itype-fit typ.p.ordinary expected sub.state.p.ordinary next.state.p.ordinary)
10349− ?: ordinary-good ordinary
10350− =/ attempt=(unit iresult)
10352− =/ y=arm i.t.arms.e
10353− =/ subject=iresult (infer-fragment subject.e env state)
10354− ?: ?=(%| -.subject) ~
10355− =/ subject-type=itype (itype-normalize typ.p.subject sub.state.p.subject)
10356− ?: ?=(%union -.subject-type) ~
10357− =/ su=(unit isub) (itype-unify typ.p.subject [%flag ~] sub.state.p.subject)
10359− =/ left=iresult (infer-call-context-arg val.x expected env state.p.subject(sub u.su) context)
10360− ?: ?=(%| -.left) ~
10361− =/ lf=ifit (itype-fit typ.p.left expected sub.state.p.left next.state.p.left)
10363− =/ right=iresult (infer-call-context-arg val.y expected env state.p.left(sub sub.lf, next next.lf) context)
10364− ?: ?=(%| -.right) ~
10365− =/ rf=ifit (itype-fit typ.p.right expected sub.state.p.right next.state.p.right)
10367− =/ sub=isub sub.rf
10368− =/ next=@ud next.rf
10369− =/ lt=itype (itype-normalize typ.p.left sub)
10370− =/ rt=itype (itype-normalize typ.p.right sub)
10371− =/ et=itype (itype-normalize expected sub)
10373− ?: |(?=(^ (itype-vars lt)) ?=(^ (itype-vars rt)) ?=(^ (itype-vars et))) ~
10374− ?: |((itype-has-tag lt) (itype-has-tag rt) (itype-has-tag et)) ~
10375− =/ lcheck=ifit (itype-fit typ.p.left expected sub next)
10376− ?. ?=(%ok -.lcheck) ~
10377− ?. &(=(sub.lcheck sub) =(next.lcheck next)) ~
10378− =/ rcheck=ifit (itype-fit typ.p.right expected sub next)
10379− ?. ?=(%ok -.rcheck) ~
10380− ?. &(=(sub.rcheck sub) =(next.rcheck next)) ~
10381− `[%& typ.p.left state.p.right(sub sub, next next)]
10382− ?~ attempt ordinary
10385++ infer-call-context-arg
8791++ infer-call-context-arg
10386 |= [e=expr expected=itype env=ienv state=istate context=span]
8792 |= [e=expr expected=itype env=ienv state=istate context=span]
10387 ^- iresult
8793 ^- iresult
10388− ?: &(?=(^ defer.state) ?=(%branch -.e)) (infer-fragment e env state)
10389− ?: &(?=(^ defer.state) ?=(^ prelude.state) ?=(%tuple -.e))
10390− (infer-fragment e env state)
10391 ?: ?=(%pair -.e) $(e (pair-as-cell e))
8794 ?: ?=(%pair -.e) $(e (pair-as-cell e))
10392 ?: ?=(%group -.e) $(e inner.e)
8795 ?: ?=(%group -.e) $(e inner.e)
10393 ?: &(?=(%body -.e) ?=(~ defs.e)) $(e final.e)
8796 ?: &(?=(%body -.e) ?=(~ defs.e)) $(e final.e)
@@ -10400,23 +8803,6 @@
10400 ?: ?=(%face -.target) $(target (itype-walk body.target sub.state))
8803 ?: ?=(%face -.target) $(target (itype-walk body.target sub.state))
10401 ?: (explicit-proj-call e env state)
8804 ?: (explicit-proj-call e env state)
10402 (infer-proj-context e expected env state context)
8805 (infer-proj-context e expected env state context)
10403− :: Experimental construction only for a source-proven direct target.
10404− :: Decline any walked structural binding to retain raw-variable provenance.
10405− ?: &(?=(%grec -.target) ?=(%tuple -.e) (grec-direct-context expected sub.state))
10406− =/ unfolded=(unit [view=itype left=@ud]) (grec-unfold-view target jrec-fuel.state)
10407− ?~ unfolded [%| ["recursive mold unfolding needs unsupported inference" ~]]
10408− ?~ items.e [%| ["recursive mold constructor needs unsupported inference" ~]]
10409− =/ first=item i.items.e
10410− ?. &(?=(~ face.first) ?=(%lit -.val.first) =(%term form.lit.val.first))
10411− [%| ["recursive mold constructor needs unsupported inference" ~]]
10412− =/ chosen=(unit itype) (contextual-tagged-case view.u.unfolded val.lit.val.first sub.state)
10413− ?~ chosen [%| ["recursive mold constructor has no matching case" ~]]
10414− =/ value=iresult (infer-call-context-items items.e u.chosen env state(jrec-fuel left.u.unfolded) context)
10415− ?: ?=(%| -.value) value
10416− =/ fit=ifit (itype-fit typ.p.value u.chosen sub.state.p.value next.state.p.value)
10417− ?: ?=(%unknown -.fit) [%| ["recursive mold case needs unsupported inference" ~]]
10418− ?: ?=(%bad -.fit) [%| ["recursive mold case does not fit its source shape" ~]]
10419− [%& target state.p.value(sub sub.fit, next next.fit)]
10420 :: Only the source-proven one-layer cell is exposed. Each recursive
8806 :: Only the source-proven one-layer cell is exposed. Each recursive
10421 :: descent consumes one written tuple; named values use ordinary fit.
8807 :: descent consumes one written tuple; named values use ordinary fit.
10422 ?: &(?=(%jrec -.target) ?=(%lit -.e) =(%null form.lit.e))
8808 ?: &(?=(%jrec -.target) ?=(%lit -.e) =(%null form.lit.e))
@@ -10434,16 +8820,7 @@
10434 ?: ?=(%bad -.fit) [%| ["recursive mold cell does not fit its source shape" ~]]
8820 ?: ?=(%bad -.fit) [%| ["recursive mold cell does not fit its source shape" ~]]
10435 [%& target state.p.value(sub sub.fit, next next.fit)]
8821 [%& target state.p.value(sub sub.fit, next next.fit)]
10436 ?: ?=(%call -.e) (infer-contextual-call e target env state)
8822 ?: ?=(%call -.e) (infer-contextual-call e target env state)
10437− =/ named=(unit idiag) (branch-tag-name e env state)
10438− ?^ named [%| u.named]
10439− =/ empty-list=(unit iresult) (empty-list-null-branch e env state `[target context])
10440− ?^ empty-list u.empty-list
10441 ?: (single-structured-pattern e)
8823 ?: (single-structured-pattern e)
10442− ?> ?=(%branch -.e)
10443− =/ empty-union=(unit iresult) (known-empty-union-wing subject.e env state)
10444− ?^ empty-union (infer-known-union-context-subject e target env u.empty-union context)
10445− =/ single=(unit iresult) (grec-single-wing-subject subject.e env state)
10446− ?^ single (infer-known-union-context-subject e target env u.single context)
10447 (infer-single-case-branch e env state `[target context])
8824 (infer-single-case-branch e env state `[target context])
10448 ?: (cell-binder-pattern e)
8825 ?: (cell-binder-pattern e)
10449 (infer-cell-branch e env state `[target context])
8826 (infer-cell-branch e env state `[target context])
@@ -10463,8 +8840,6 @@
10463 (infer-known-union-context-subject e target env u.known context)
8840 (infer-known-union-context-subject e target env u.known context)
10464 ?: &(?=(%union -.target) ?=(%unit -.e))
8841 ?: &(?=(%union -.target) ?=(%unit -.e))
10465 (infer-unit-context e target env state context)
8842 (infer-unit-context e target env state context)
10466− ?: (closed-cell-branch-eligible e expected sub.state)
10467− (infer-closed-cell-branch e expected env state context)
10468 ?: &(?=(%flag -.target) (context-union-branch e))
8843 ?: &(?=(%flag -.target) (context-union-branch e))
10469 (infer-union-context e target env state context)
8844 (infer-union-context e target env state context)
10470 ?: &(?=(%union -.target) (context-union-branch e))
8845 ?: &(?=(%union -.target) (context-union-branch e))
@@ -10578,7 +8953,7 @@
10578 ?~ pats [%& ~]
8953 ?~ pats [%& ~]
10579 ?. ?=(%bind -.i.pats) [%| 'branch pattern is not supported by partial inference']
8954 ?. ?=(%bind -.i.pats) [%| 'branch pattern is not supported by partial inference']
10580 =/ name=term name.i.pats
8955 =/ name=term name.i.pats
10581− ?: |((reserved-name name) ?=(^ (ienv-lookup name env)) (lien globals |=(n=term =(n name))) (lien seen |=(n=term =(n name))))
8956+ ?: |(=(name %proj) ?=(^ (ienv-lookup name env)) (lien globals |=(n=term =(n name))) (lien seen |=(n=term =(n name))))
10582 [%| 'pattern shadows a name']
8957 [%| 'pattern shadows a name']
10583 =/ rest=(each (list term) @t) $(pats t.pats, seen [name seen])
8958 =/ rest=(each (list term) @t) $(pats t.pats, seen [name seen])
10584 ?: ?=(%| -.rest) rest
8959 ?: ?=(%| -.rest) rest
@@ -10603,7 +8978,7 @@
10603 ?~ t.names |
8978 ?~ t.names |
10604 =. typ (itype-walk typ sub)
8979 =. typ (itype-walk typ sub)
10605 ?: ?=(%cell -.typ) $(typ tal.typ, names t.names)
8980 ?: ?=(%cell -.typ) $(typ tal.typ, names t.names)
10606− |(?=(%union -.typ) ?=(%collection -.typ) ?=(%recursive -.typ) ?=(%jrec -.typ) ?=(%grec -.typ) ?=(%noun -.typ) ?=(%fn -.typ) ?=(%tag -.typ))
8981+ |(?=(%union -.typ) ?=(%collection -.typ) ?=(%recursive -.typ) ?=(%jrec -.typ) ?=(%noun -.typ) ?=(%fn -.typ) ?=(%tag -.typ))
10608++ cell-binder-pattern
8983++ cell-binder-pattern
10609 |= e=expr
8984 |= e=expr
@@ -10655,17 +9030,25 @@
10655 ^- tape
9030 ^- tape
10656 =. t (itype-walk t sub)
9031 =. t (itype-walk t sub)
10658− %var (show-var id.t)
9033+ %var
10659− %fvar (show-var id.t)
9034+ ?: (lth id.t 26) [(add 65 id.t) ~]
10660− %avar (show-var id.t)
9035+ "T{<id.t>}"
10661− %rvar (show-var id.t)
9036+ %avar
10662− %nvar (show-var id.t)
9037+ ?: (lth id.t 26) [(add 65 id.t) ~]
10663− %rnvar (show-var id.t)
9038+ "T{<id.t>}"
9040+ ?: (lth id.t 26) [(add 65 id.t) ~]
9043+ ?: (lth id.t 26) [(add 65 id.t) ~]
9046+ ?: (lth id.t 26) [(add 65 id.t) ~]
10664 %atom "@{(trip aura.t)}"
9048 %atom "@{(trip aura.t)}"
10665 %any-atom "@"
9049 %any-atom "@"
10666 %flag "?"
9050 %flag "?"
10667 %noun "*"
9051 %noun "*"
10669 %tag (trip txt.literal.t)
9052 %tag (trip txt.literal.t)
10670 %const (trip txt.literal.t)
9053 %const (trip txt.literal.t)
@@ -10674,24 +9057,12 @@
10674 "({(trip u.label.t)} {(show-itype-cases args.t sub)})"
9057 "({(trip u.label.t)} {(show-itype-cases args.t sub)})"
10675 %recursive ?~(label.t "recursive mold" (trip u.label.t))
9058 %recursive ?~(label.t "recursive mold" (trip u.label.t))
10676 %jrec ?~(label.t "recursive mold" (trip u.label.t))
9059 %jrec ?~(label.t "recursive mold" (trip u.label.t))
10677− %grec ?~(label.t "recursive mold" "({(trip u.label.t)} {(show-itype-cases args.t sub)})")
10678 %collection "({(trip name.t)} {(show-itype-cases args.t sub)})"
9060 %collection "({(trip name.t)} {(show-itype-cases args.t sub)})"
10679 %face "[{(trip name.t)}={(show-itype-context body.t sub)}]"
9061 %face "[{(trip name.t)}={(show-itype-context body.t sub)}]"
10680 %fn "$-({(show-itype-context sample.t sub)} {(show-itype-context product.t sub)})"
9062 %fn "$-({(show-itype-context sample.t sub)} {(show-itype-context product.t sub)})"
10681 %cell "[{(show-itype-item hed.t sub)} {(show-itype-item tal.t sub)}]"
9063 %cell "[{(show-itype-item hed.t sub)} {(show-itype-item tal.t sub)}]"
10684−:: +show-var: a type variable as printed: its name if it has one, else
10685−:: a letter for its number, A to Z, then T26, T27 and on
10690− =/ name=@t (var-name id)
10691− ?. =(0 name) (trip name)
10692− ?: (lth id 26) [(add 65 id) ~]
10695++ show-itype-item
9066++ show-itype-item
10696 |= [t=itype sub=isub]
9067 |= [t=itype sub=isub]
10697 ^- tape
9068 ^- tape
@@ -10723,20 +9094,17 @@
10723 %nvar &
9094 %nvar &
10724 %rnvar &
9095 %rnvar &
10727 %avar |
9097 %avar |
10728 %rvar |
9098 %rvar |
10729 %atom |
9099 %atom |
10730 %any-atom |
9100 %any-atom |
10731 %flag |
9101 %flag |
10732 %noun |
9102 %noun |
10735 %const |
9104 %const |
10736 %union |((lien cases.typ |=(c=itype (itype-has-nvar c))) (lien args.typ |=(c=itype (itype-has-nvar c))))
9105 %union |((lien cases.typ |=(c=itype (itype-has-nvar c))) (lien args.typ |=(c=itype (itype-has-nvar c))))
10737 %recursive |
9106 %recursive |
10738 %jrec |
9107 %jrec |
10739− %grec (lien args.typ |=(c=itype (itype-has-nvar c)))
10740 %collection (lien args.typ |=(c=itype (itype-has-nvar c)))
9108 %collection (lien args.typ |=(c=itype (itype-has-nvar c)))
10741 %face $(typ body.typ)
9109 %face $(typ body.typ)
10742 %fn |($(typ sample.typ) $(typ product.typ))
9110 %fn |($(typ sample.typ) $(typ product.typ))
@@ -10747,10 +9115,11 @@
10747 |= [label=tape typ=itype sub=isub]
9115 |= [label=tape typ=itype sub=isub]
10748 ^- tape
9116 ^- tape
10749 =/ normalized=itype (itype-normalize typ sub)
9117 =/ normalized=itype (itype-normalize typ sub)
10750− ?: |(?=(%var -.normalized) ?=(%fvar -.normalized) ?=(%avar -.normalized) ?=(%rvar -.normalized) (itype-has-nvar normalized) (itype-has-tag normalized) (itype-has-union normalized)) label
9118+ ?: |(?=(%var -.normalized) ?=(%avar -.normalized) ?=(%rvar -.normalized) (itype-has-nvar normalized) (itype-has-tag normalized) (itype-has-union normalized)) label
10751 ?: (itype-has-hidden-recursive normalized) label
9119 ?: (itype-has-hidden-recursive normalized) label
10752 =/ vars=(list @ud) (unique-type-vars (itype-vars normalized))
9120 =/ vars=(list @ud) (unique-type-vars (itype-vars normalized))
10753− =/ printable=itype (canonical-itype (cap-names normalized vars ~ sub))
9121+ ?: (gth (lent vars) 26) label
9122+ =/ printable=itype (canonical-itype normalized vars)
10754 "{label} has type {(show-itype printable ~)}{(show-atom-constraint printable)}"
9123 "{label} has type {(show-itype printable ~)}{(show-atom-constraint printable)}"
10756:: A capital in a written mold is generalized with its enclosing ++.
9125:: A capital in a written mold is generalized with its enclosing ++.
@@ -10767,7 +9136,6 @@
10767 =/ ident=(unit @ud)
9136 =/ ident=(unit @ud)
10768 ?+ -.resolved ~
9137 ?+ -.resolved ~
10769 %var `id.resolved
9138 %var `id.resolved
10770− %fvar `id.resolved
10771 %avar `id.resolved
9139 %avar `id.resolved
10772 %rvar `id.resolved
9140 %rvar `id.resolved
@@ -10783,7 +9151,6 @@
10783 =/ ident=(unit @ud)
9151 =/ ident=(unit @ud)
10784 ?+ -.resolved ~
9152 ?+ -.resolved ~
10785 %var `id.resolved
9153 %var `id.resolved
10786− %fvar `id.resolved
10787 %avar `id.resolved
9154 %avar `id.resolved
10788 %rvar `id.resolved
9155 %rvar `id.resolved
@@ -10791,116 +9158,6 @@
10791 ?: =(n u.ident) `i.caps
9158 ?: =(n u.ident) `i.caps
10792 $(caps t.caps)
9159 $(caps t.caps)
10794−:: +cap-names: give each variable in vars the name it was written with
10796−:: Unification joins variables, and the one an ID resolves to may not
10797−:: carry the name its definition wrote, as when a capital meets a
10798−:: called gate's variable or an atom variable. Each variable in vars
10799−:: takes the name of the first capital in caps that resolves to it;
10800−:: failing that, of the earliest made of the named variables that
10801−:: resolve to it, itself included (+joined-names). Only the name part
10802−:: of an ID changes, not its count, so IDs stay distinct.
10805− |= [typ=itype vars=(list @ud) caps=icaps sub=isub]
10806− ^- [typ=itype vars=(list @ud)]
10807− =/ written=icaps (flop caps)
10808− =/ joined=(map @ud @ud) (joined-names sub)
10809− =/ ren=(map @ud @ud) ~
10810− =/ out=(list @ud) ~
10812− ?~ vars [?~(ren typ (itype-reid typ ren)) (flop out)]
10813− =/ cap=(unit icap) (cap-with-id i.vars written sub)
10814− =/ first=(unit @ud) (~(get by joined) i.vars)
10817− ?~ first (var-name i.vars)
10818− ?: =(0 (var-name i.vars)) (var-name u.first)
10819− ?: (lth (var-count u.first) (var-count i.vars)) (var-name u.first)
10821− =/ to=@ud (named-var name i.vars)
10822− ?: =(to i.vars) $(vars t.vars, out [i.vars out])
10823− $(vars t.vars, out [to out], ren (~(put by ren) i.vars to))
10825−:: +joined-names: for each variable that named ones resolve to, the
10826−:: earliest made of those, by count
10828−:: One pass over sub keeps each ID's newest binding, as +itype-lookup
10829−:: would find it: the variable it is bound to, or ~ for another type.
10830−:: Each named ID then follows those bindings to the variable it
10831−:: resolves to, if any.
10836− =/ edges=(map @ud (unit @ud))
10837− %+ roll (flop sub)
10838− |= [b=ibinding m=(map @ud (unit @ud))]
10839− (~(put by m) id.b (var-of val.b))
10840− =/ named=(list @ud)
10841− (murn ~(tap by edges) |=([k=@ud *] ?:(=(0 (var-name k)) ~ `k)))
10842− =/ fuel=@ud ~(wyt by edges)
10843− =/ out=(map @ud @ud) ~
10846− =/ root=(unit @ud) (follow-var i.named edges fuel)
10847− ?~ root $(named t.named)
10848− ?: =(u.root i.named) $(named t.named)
10849− =/ best=(unit @ud) (~(get by out) u.root)
10850− ?: &(?=(^ best) (lth (var-count u.best) (var-count i.named)))
10852− $(named t.named, out (~(put by out) u.root i.named))
10854−:: +follow-var: the variable that id resolves to through edges, or ~ if
10855−:: it resolves to another type; fuel bounds the steps
10858− |= [id=@ud edges=(map @ud (unit @ud)) fuel=@ud]
10862− =/ edge=(unit (unit @ud)) (~(get by edges) id)
10865− ?: =(u.u.edge id) `id
10866− $(id u.u.edge, fuel (dec fuel))
10868−:: +var-of: the ID of a type variable node, or ~ for another type
10882−:: +itype-reid: t with the variable IDs in ids replaced, each node
10883−:: keeping its kind
10886− |= [t=itype ids=(map @ud @ud)]
10889− %var t(id (fall (~(get by ids) id.t) id.t))
10890− %fvar t(id (fall (~(get by ids) id.t) id.t))
10891− %avar t(id (fall (~(get by ids) id.t) id.t))
10892− %rvar t(id (fall (~(get by ids) id.t) id.t))
10893− %nvar t(id (fall (~(get by ids) id.t) id.t))
10894− %rnvar t(id (fall (~(get by ids) id.t) id.t))
10895− ?(%atom %any-atom %flag %noun %empty %tag %const %recursive %jrec) t
10896− %union t(cases (turn cases.t |=(c=itype ^$(t c))), args (turn args.t |=(c=itype ^$(t c))))
10897− %grec t(args (turn args.t |=(c=itype ^$(t c))))
10898− %collection t(args (turn args.t |=(c=itype ^$(t c))))
10899− %face t(body $(t body.t))
10900− %fn t(sample $(t sample.t), product $(t product.t))
10901− %cell t(hed $(t hed.t), tal $(t tal.t))
10904++ merged-capitals
9161++ merged-capitals
10905 |= [caps=icaps sub=isub]
9162 |= [caps=icaps sub=isub]
10906 ^- (unit [first=icap second=icap])
9163 ^- (unit [first=icap second=icap])
@@ -10909,7 +9166,6 @@
10909 =/ ident=(unit @ud)
9166 =/ ident=(unit @ud)
10910 ?+ -.resolved ~
9167 ?+ -.resolved ~
10911 %var `id.resolved
9168 %var `id.resolved
10912− %fvar `id.resolved
10913 %avar `id.resolved
9169 %avar `id.resolved
10914 %rvar `id.resolved
9170 %rvar `id.resolved
@@ -10926,7 +9182,6 @@
10926 =/ ident=(unit @ud)
9182 =/ ident=(unit @ud)
10927 ?+ -.resolved ~
9183 ?+ -.resolved ~
10928 %var `id.resolved
9184 %var `id.resolved
10929− %fvar `id.resolved
10930 %avar `id.resolved
9185 %avar `id.resolved
10931 %rvar `id.resolved
9186 %rvar `id.resolved
@@ -10953,7 +9208,6 @@
10957 %avar =(n id.t)
9211 %avar =(n id.t)
10958 %rvar =(n id.t)
9212 %rvar =(n id.t)
10959 %nvar |
9213 %nvar |
@@ -10962,13 +9216,11 @@
10962 %any-atom |
9216 %any-atom |
10963 %flag |
9217 %flag |
10964 %noun |
9218 %noun |
10967 %const |
9220 %const |
10968 %union |((lien cases.t |=(c=itype (has-atom-var n c))) (lien args.t |=(c=itype (has-atom-var n c))))
9221 %union |((lien cases.t |=(c=itype (has-atom-var n c))) (lien args.t |=(c=itype (has-atom-var n c))))
10969 %recursive |
9222 %recursive |
10970 %jrec |
9223 %jrec |
10971− %grec (lien args.t |=(c=itype (has-atom-var n c)))
10972 %collection (lien args.t |=(c=itype (has-atom-var n c)))
9224 %collection (lien args.t |=(c=itype (has-atom-var n c)))
10973 %face $(t body.t)
9225 %face $(t body.t)
10974 %fn |($(t sample.t) $(t product.t))
9226 %fn |($(t sample.t) $(t product.t))
@@ -11016,17 +9268,12 @@
11016 =/ sep=tape ?:(printed ", " " where ")
9268 =/ sep=tape ?:(printed ", " " where ")
11017 =/ clause=tape "{sep}{(show-itype [%avar i.vars] ~)} is an atom"
9269 =/ clause=tape "{sep}{(show-itype [%avar i.vars] ~)} is an atom"
11018 $(vars t.vars, printed &, out (weld out clause))
9270 $(vars t.vars, printed &, out (weld out clause))
11019− ?: (itype-var-is-gate-free i.vars t)
11020− =/ sep=tape ?:(printed ", " " where ")
11021− =/ clause=tape "{sep}{(show-itype [%fvar i.vars] ~)} contains no gates"
11022− $(vars t.vars, printed &, out (weld out clause))
11023 $(vars t.vars)
9271 $(vars t.vars)
11025:: Build the supported part of the value environment in dependency order.
9273:: Build the supported part of the value environment in dependency order.
11026−:: Each pass adds successful definitions, visiting them dependencies first
9274+:: Each pass adds successful definitions. Forward references become
11027−:: (+dependency-order), so a forward reference usually resolves in the
9275+:: available on a later pass; unsupported syntax does not enter the
11028−:: first pass; any that do not are retried on a later pass. Unsupported
9276+:: environment. Generalized definitions are closed, so a use instantiates
11029−:: syntax does not enter the environment. Generalized definitions are closed, so a use instantiates
11030:: its variables afresh.
9277:: its variables afresh.
11032++ global-value-names
9279++ global-value-names
@@ -11117,12 +9364,8 @@
11117++ infer-recursive-gate
9364++ infer-recursive-gate
11118 |= [d=def env=ienv state=istate]
9365 |= [d=def env=ienv state=istate]
11119 ^- iresult
9366 ^- iresult
11120− ?^ defer.state [%| ["deferred recursive inference is unsupported" ~]]
11121 =. gate-defs.state ~
9367 =. gate-defs.state ~
11122 ?. ?=(%value -.d) [%| ["recursive definition is not a gate" ~]]
9368 ?. ?=(%value -.d) [%| ["recursive definition is not a gate" ~]]
11123− :: A ++ whose body is (unface |= …) is a gate too, unfaced
11124− =/ peeled=(unit expr) (unfaced-gate val.d env state)
11125− =? val.d ?=(^ peeled) u.peeled
11126 ?. |(?=(%gate -.val.d) ?=(%gate-wide -.val.d))
9369 ?. |(?=(%gate -.val.d) ?=(%gate-wide -.val.d))
11127 [%| ["recursive definition is not a gate" ~]]
9370 [%| ["recursive definition is not a gate" ~]]
11128 =/ result=(unit itype) (recursive-branch-seed d env state)
9371 =/ result=(unit itype) (recursive-branch-seed d env state)
@@ -11146,7 +9389,6 @@
11146 =/ product=itype ?~(result [%var id] u.result)
9389 =/ product=itype ?~(result [%var id] u.result)
11147 =/ st=istate state.p.sam(next +(id))
9390 =/ st=istate state.p.sam(next +(id))
11148 =/ seed=itype [%fn typ.p.sam product]
9391 =/ seed=itype [%fn typ.p.sam product]
11149− =? seed ?=(^ peeled) (itype-unface seed sub.st)
11150 =/ seeded=ienv [[name.d [seed ~]] env.p.sam]
9392 =/ seeded=ienv [[name.d [seed ~]] env.p.sam]
11151 =/ body=expr
9393 =/ body=expr
11152 ?- -.gate
9394 ?- -.gate
@@ -11158,9 +9400,7 @@
11158 ?: ?=(%| -.out) out
9400 ?: ?=(%| -.out) out
11159 =/ uni=(unit isub) (itype-unify product typ.p.out sub.state.p.out)
9401 =/ uni=(unit isub) (itype-unify product typ.p.out sub.state.p.out)
11160 ?~ uni [%| ["recursive gate constraint is not supported by partial inference" ~]]
9402 ?~ uni [%| ["recursive gate constraint is not supported by partial inference" ~]]
11161− =/ typ=itype [%fn typ.p.sam typ.p.out]
9403+ [%& [%fn typ.p.sam typ.p.out] state.p.out(sub u.uni)]
11162− =? typ ?=(^ peeled) (itype-unface typ u.uni)
11163− [%& typ state.p.out(sub u.uni)]
11165++ dependency-root
9405++ dependency-root
11166 |= names=(list term)
9406 |= names=(list term)
@@ -11268,7 +9508,7 @@
11268:: Infer a cyclic component with one monomorphic seed per gate. All members
9508:: Infer a cyclic component with one monomorphic seed per gate. All members
11269:: must succeed before any scheme is available; pending constraints and
9509:: must succeed before any scheme is available; pending constraints and
11270:: unresolved branch joins remain partial.
9510:: unresolved branch joins remain partial.
11271−+$ igate-entry [name=term typ=itype body=expr env=ienv caps=icaps unfaced=?]
9511++$ igate-entry [name=term typ=itype body=expr env=ienv caps=icaps]
11272+$ igate-seeds (each [entries=(list igate-entry) state=istate] idiag)
9512+$ igate-seeds (each [entries=(list igate-entry) state=istate] idiag)
11273++ seed-gate-group
9513++ seed-gate-group
11274 |= [ds=(list def) env=ienv state=istate]
9514 |= [ds=(list def) env=ienv state=istate]
@@ -11276,9 +9516,7 @@
11276 ?~ ds [%& [~ state]]
9516 ?~ ds [%& [~ state]]
11277 =/ d=def i.ds
9517 =/ d=def i.ds
11278 ?. ?=(%value -.d) [%| ["recursive group contains a non-gate" ~]]
9518 ?. ?=(%value -.d) [%| ["recursive group contains a non-gate" ~]]
11279− :: A ++ whose body is (unface |= …) is a gate too, unfaced
9519+ =/ gate=expr val.d
11280− =/ peeled=(unit expr) (unfaced-gate val.d env state)
11281− =/ gate=expr ?~(peeled val.d u.peeled)
11282 ?. |(?=(%gate -.gate) ?=(%gate-wide -.gate))
9520 ?. |(?=(%gate -.gate) ?=(%gate-wide -.gate))
11283 [%| ["recursive group contains a non-gate" ~]]
9521 [%| ["recursive group contains a non-gate" ~]]
11284 =/ initial=istate (reserve-def-caps gate state)
9522 =/ initial=istate (reserve-def-caps gate state)
@@ -11296,8 +9534,7 @@
11298 =/ seed=itype [%fn typ.p.sam [%var next.state.p.sam]]
9536 =/ seed=itype [%fn typ.p.sam [%var next.state.p.sam]]
11299− =? seed ?=(^ peeled) (itype-unface seed sub.state.p.sam)
9537+ =/ entry=igate-entry [name.d seed body env.p.sam caps.state.p.sam]
11300− =/ entry=igate-entry [name.d seed body env.p.sam caps.state.p.sam ?=(^ peeled)]
11301 =/ after=istate state.p.sam(next +(next.state.p.sam), caps caps.state)
9538 =/ after=istate state.p.sam(next +(next.state.p.sam), caps caps.state)
11302 =/ rest=igate-seeds $(ds t.ds, state after)
9539 =/ rest=igate-seeds $(ds t.ds, state after)
11303 ?: ?=(%| -.rest) rest
9540 ?: ?=(%| -.rest) rest
@@ -11337,21 +9574,20 @@
11337 ?: (constrained-capitals caps.entry sub.state)
9574 ?: (constrained-capitals caps.entry sub.state)
11338 [%| ["explicit capital constraints are not supported by partial inference" ~]]
9575 [%| ["explicit capital constraints are not supported by partial inference" ~]]
11339 =/ typ=itype (itype-normalize typ.entry sub.state)
9576 =/ typ=itype (itype-normalize typ.entry sub.state)
11340− =? typ unfaced.entry (itype-unface typ ~)
11341 ?: (itype-has-nvar typ) [%| ["recursive group needs unsupported inference" ~]]
9577 ?: (itype-has-nvar typ) [%| ["recursive group needs unsupported inference" ~]]
11342 ?: |((itype-has-tag typ) (itype-has-hidden-generic typ) (itype-has-hidden-recursive typ) (unsupported-atom-vars typ caps.entry binders.state sub.state))
9578 ?: |((itype-has-tag typ) (itype-has-hidden-generic typ) (itype-has-hidden-recursive typ) (unsupported-atom-vars typ caps.entry binders.state sub.state))
11343 [%| ["recursive group needs unsupported inference" ~]]
9579 [%| ["recursive group needs unsupported inference" ~]]
11344 =/ free=(list @ud) (weld (free-env-vars env sub.state) (free-cap-vars caps.outer sub.state))
9580 =/ free=(list @ud) (weld (free-env-vars env sub.state) (free-cap-vars caps.outer sub.state))
11345 =/ vars=(list @ud) (unique-type-vars (itype-vars typ))
9581 =/ vars=(list @ud) (unique-type-vars (itype-vars typ))
11346 =. vars (skim vars |=(n=@ud !(lien free |=(f=@ud =(f n)))))
9582 =. vars (skim vars |=(n=@ud !(lien free |=(f=@ud =(f n)))))
9583+ ?: (gth (lent vars) 26) [%| ["recursive group needs too many type variables" ~]]
11347 =/ rest=(each ienv idiag) $(entries t.entries)
9584 =/ rest=(each ienv idiag) $(entries t.entries)
11348 ?: ?=(%| -.rest) rest
9585 ?: ?=(%| -.rest) rest
11349− [%& [[name.entry (cap-names typ vars caps.entry sub.state)] p.rest]]
9586+ [%& [[name.entry [typ vars]] p.rest]]
11351++ infer-gate-group
9588++ infer-gate-group
11352 |= [ds=(list def) env=ienv state=istate]
9589 |= [ds=(list def) env=ienv state=istate]
11353 ^- ilocal-result
9590 ^- ilocal-result
11354− ?^ defer.state [%| ["deferred recursive inference is unsupported" ~]]
11355 =/ names=(list term) (global-value-names ds)
9591 =/ names=(list term) (global-value-names ds)
11356 ?. (levy names |=(n=term (unique-value-name n names)))
9592 ?. (levy names |=(n=term (unique-value-name n names)))
11357 [%| ["recursive group contains duplicate names" ~]]
9593 [%| ["recursive group contains duplicate names" ~]]
@@ -11390,8 +9626,40 @@
11390 =. entry entry(source src, target dst)
9626 =. entry entry(source src, target dst)
11391 `[entry u.rest]
9627 `[entry u.rest]
11393−
9629+++ add-supported-defs
11394−+$ iresolved [env=ienv grouped=(list term) artifacts=(list iwidth-definition) failures=(list [name=term diag=idiag])]
9630+ |= [ds=(list def) all-defs=(list def) checked=(map term def) heads=(unit igate-prelude-evidence) env=ienv molds=imolds globals=(list term) externals=iexternals surs=(list term) mark-externals=imark-externals marks=(list term) jimports=ijimports reserved-molds=(list term) at=path prelude=(unit ifile) artifacts=(list iwidth-definition)]
9631+ ^- [env=ienv artifacts=(list iwidth-definition)]
9632+ ?~ ds [env artifacts]
9634+ ?: ?=(%mold -.d) $(ds t.ds)
9635+ ?. (unique-value-name name.d globals) $(ds t.ds)
9636+ ?^ (ienv-lookup name.d env) $(ds t.ds)
9637+ =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
9638+ =/ initial=istate [0 ~ ~ ~ molds globals externals surs mark-externals marks jimports reserved-molds ~ ~ ~ | at top prelude ~ 256 ~ ~ ~]
9639+ =. gate-defs.initial checked
9640+ =. head-evidence.initial heads
9641+ =. initial (reserve-def-caps val.d initial)
9642+ =/ result=iresult (infer-fragment val.d env initial)
9643+ =? result ?=(%| -.result) (infer-recursive-gate d env initial)
9644+ ?: ?=(%| -.result) $(ds t.ds)
9645+ =. state.p.result (promote-restricted-numbers state.p.result env)
9646+ =. state.p.result (default-hole-numbers holes.state.p.result holes.initial state.p.result env !(itype-has-gate (itype-normalize typ.p.result sub.state.p.result)))
9647+ ?^ (unresolved-hole holes.state.p.result holes.initial state.p.result) $(ds t.ds)
9648+ ?: (constrained-capitals caps.state.p.result sub.state.p.result) $(ds t.ds)
9649+ =/ typ=itype (default-decimals (itype-normalize typ.p.result sub.state.p.result))
9650+ ?: |((pending-tags tags.state.p.result sub.state.p.result) (itype-has-tag typ)) $(ds t.ds)
9651+ ?: (unsupported-atom-vars typ caps.state.p.result binders.state.p.result sub.state.p.result) $(ds t.ds)
9652+ =/ vars=(list @ud) (unique-type-vars (itype-vars typ))
9653+ ?: (gth (lent vars) 26) $(ds t.ds)
9654+ =/ finalized=(unit (list iwprojection))
9655+ (width-finalize projections.state.p.result sub.state.p.result vars)
9656+ ?~ finalized $(ds t.ds)
9657+ =? artifacts ?=(^ u.finalized)
9658+ [[name.d val.d typ sub.state.p.result (flop u.finalized)] artifacts]
9659+ =? checked |(?=(%gate -.val.d) ?=(%gate-wide -.val.d)) (~(put by checked) name.d d)
9660+ $(ds t.ds, env [[name.d [typ vars]] env], checked checked)
9662++$ iresolved [env=ienv grouped=(list term) artifacts=(list iwidth-definition)]
11395+$ iadj (map term (list term))
9663+$ iadj (map term (list term))
11396+$ ivisited (map term ?)
9664+$ ivisited (map term ?)
11397+$ iwork (list [name=term done=?])
9665+$ iwork (list [name=term done=?])
@@ -11487,7 +9755,7 @@
11487++ add-groups
9755++ add-groups
11488 |= [ds=(list def) components=icomponents graph=iadj env=ienv grouped=(list term) artifacts=(list iwidth-definition) state=istate]
9756 |= [ds=(list def) components=icomponents graph=iadj env=ienv grouped=(list term) artifacts=(list iwidth-definition) state=istate]
11489 ^- iresolved
9757 ^- iresolved
11490− ?~ components [env grouped artifacts ~]
9758+ ?~ components [env grouped artifacts]
11491 =/ component=(list term) i.components
9759 =/ component=(list term) i.components
11492 ?. (graph-cycle component graph) $(components t.components)
9760 ?. (graph-cycle component graph) $(components t.components)
11493 ?: (lien component |=(n=term ?=(^ (ienv-lookup n env)))) $(components t.components)
9761 ?: (lien component |=(n=term ?=(^ (ienv-lookup n env)))) $(components t.components)
@@ -11504,79 +9772,6 @@
11504++ resolve-groups
9772++ resolve-groups
11505 |= [ds=(list def) molds=imolds globals=(list term) externals=iexternals surs=(list term) mark-externals=imark-externals marks=(list term) jimports=ijimports reserved-molds=(list term) at=path prelude=(unit ifile)]
9773 |= [ds=(list def) molds=imolds globals=(list term) externals=iexternals surs=(list term) mark-externals=imark-externals marks=(list term) jimports=ijimports reserved-molds=(list term) at=path prelude=(unit ifile)]
11506 ^- iresolved
9774 ^- iresolved
11507− (resolve-groups-core ds molds globals externals surs mark-externals marks jimports reserved-molds at prelude ~)
11510−+$ iadded-definition
11511− [env=ienv checked=(map term def) artifacts=(list iwidth-definition)]
11512−++ add-supported-result
11513− |= [d=def result=iresult initial=istate env=ienv checked=(map term def) artifacts=(list iwidth-definition)]
11514− ^- (unit iadded-definition)
11516− ?: ?=(%| -.result) ~
11517− =. state.p.result (promote-restricted-numbers state.p.result env)
11518− =. state.p.result (default-hole-numbers holes.state.p.result holes.initial state.p.result env !(itype-has-gate (itype-normalize typ.p.result sub.state.p.result)))
11519− ?^ (unresolved-hole holes.state.p.result holes.initial state.p.result) ~
11520− ?: (constrained-capitals caps.state.p.result sub.state.p.result) ~
11521− =/ typ=itype (default-decimals (itype-normalize typ.p.result sub.state.p.result))
11522− ?: |((pending-tags tags.state.p.result sub.state.p.result) (itype-has-tag typ)) ~
11523− ?: (unsupported-atom-vars typ caps.state.p.result binders.state.p.result sub.state.p.result) ~
11524− =/ vars=(list @ud) (unique-type-vars (itype-vars typ))
11525− =/ finalized=(unit (list iwprojection))
11526− (width-finalize projections.state.p.result sub.state.p.result vars)
11528− =? artifacts ?=(^ u.finalized)
11529− [[name.d val.d typ sub.state.p.result (flop u.finalized)] artifacts]
11530− =? checked |(?=(%gate -.val.d) ?=(%gate-wide -.val.d)) (~(put by checked) name.d d)
11531− `[[[name.d (cap-names typ vars caps.state.p.result sub.state.p.result)] env] checked artifacts]
11532−++ add-supported-defs-core
11533− |= [ds=(list def) checked=(map term def) heads=(unit igate-prelude-evidence) env=ienv molds=imolds globals=(list term) externals=iexternals surs=(list term) mark-externals=imark-externals marks=(list term) jimports=ijimports reserved-molds=(list term) at=path prelude=(unit ifile) artifacts=(list iwidth-definition) index=(unit [at=path source=@t prelude=ifile shapes=(map term shape)])]
11534− ^- [env=ienv artifacts=(list iwidth-definition) failures=(list [name=term diag=idiag])]
11535− =/ failures=(list [name=term diag=idiag]) ~
11537− ?~ ds [env artifacts (flop failures)]
11539− ?: ?=(%mold -.d) $(ds t.ds)
11540− ?. (unique-value-name name.d globals) $(ds t.ds)
11541− ?^ (ienv-lookup name.d env) $(ds t.ds)
11542− =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
11543− =/ initial=istate [0 ~ ~ ~ molds globals externals surs mark-externals marks jimports reserved-molds ~ ~ ~ | at top prelude ~ 256 ~ ~ ~ ~ ~ ~]
11544− =. grec-index.initial index
11545− =. gate-defs.initial checked
11546− =. head-evidence.initial heads
11547− =. initial (reserve-def-caps val.d initial)
11548− =/ plain=iresult (infer-fragment val.d env initial)
11549− =/ result=iresult plain
11550− =? result ?=(%| -.result) (infer-recursive-gate d env initial)
11551− ?: ?=(%| -.result)
11553− ?: (definite-diag p.result) p.result
11554− ?: ?=(%| -.plain) p.plain
11556− =? failures (definite-diag failure) [[name.d failure] failures]
11558− =/ added=(unit iadded-definition)
11559− (add-supported-result d result initial env checked artifacts)
11560− ?~ added $(ds t.ds)
11561− $(ds t.ds, env env.u.added, checked checked.u.added, artifacts artifacts.u.added)
11563−:: Retry one unresolved definition to explain a pending tag. The gate
11564−:: evidence is built from the whole module, not only this definition.
11565−++ module-pending-tag-one
11566− |= [d=def env=ienv base=istate checked=(map term def) heads=(unit igate-prelude-evidence)]
11567− ^- (unit [at=span msg=tape])
11568− ?. ?=(%value -.d) ~
11569− ?^ (ienv-lookup name.d env) ~
11570− =/ initial=istate base(gate-defs checked, head-evidence heads)
11571− =. initial (reserve-def-caps val.d initial)
11572− =/ result=iresult (infer-fragment val.d env initial)
11573− =? result ?=(%| -.result) (infer-recursive-gate d env initial)
11574− ?: ?=(%| -.result) ~
11575− (pending-tag-diagnostic tags.state.p.result sub.state.p.result)
11577−++ resolve-groups-core
11578− |= [ds=(list def) molds=imolds globals=(list term) externals=iexternals surs=(list term) mark-externals=imark-externals marks=(list term) jimports=ijimports reserved-molds=(list term) at=path prelude=(unit ifile) index=(unit [at=path source=@t prelude=ifile shapes=(map term shape)])]
11580 =/ env=ienv ~
9775 =/ env=ienv ~
11581 =/ grouped=(list term) ~
9776 =/ grouped=(list term) ~
11582 =/ artifacts=(list iwidth-definition) ~
9777 =/ artifacts=(list iwidth-definition) ~
@@ -11586,38 +9781,14 @@
11586 =/ components=icomponents (graph-components ds names)
9781 =/ components=icomponents (graph-components ds names)
11587 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
9782 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
11588 =/ heads=(unit igate-prelude-evidence) (direct-prelude-evidence ds prelude)
9783 =/ heads=(unit igate-prelude-evidence) (direct-prelude-evidence ds prelude)
11589− =/ ordered=(list def) (dependency-order ds components)
11591− =/ next=[env=ienv artifacts=(list iwidth-definition) failures=(list [name=term diag=idiag])]
9785+ =/ next=[env=ienv artifacts=(list iwidth-definition)]
11592− (add-supported-defs-core ordered (direct-checked-gates ds env) heads env molds globals externals surs mark-externals marks jimports reserved-molds at prelude artifacts index)
9786+ (add-supported-defs ds ds (direct-checked-gates ds env) heads env molds globals externals surs mark-externals marks jimports reserved-molds at prelude artifacts)
11593− =/ initial=istate [0 ~ ~ ~ molds globals externals surs mark-externals marks jimports reserved-molds ~ ~ ~ | at top prelude ~ 256 ~ ~ ~ ~ ~ ~]
9787+ =/ initial=istate [0 ~ ~ ~ molds globals externals surs mark-externals marks jimports reserved-molds ~ ~ ~ | at top prelude ~ 256 ~ ~ ~]
11594− =. grec-index.initial index
11595 =/ out=iresolved (add-groups ds components graph env.next grouped artifacts.next initial)
9788 =/ out=iresolved (add-groups ds components graph env.next grouped artifacts.next initial)
11596− ?: =(env env.out) out(failures failures.next)
9789+ ?: =(env env.out) out
11597 $(env env.out, grouped grouped.out, artifacts artifacts.out)
9790 $(env env.out, grouped grouped.out, artifacts artifacts.out)
11599−:: +dependency-order: the value definitions, dependencies first
11601−:: +graph-components lists the components dependencies first, so one
11602−:: pass of +add-supported-defs-core in this order resolves a forward
11603−:: chain that would otherwise take a pass per link; the fixpoint above
11604−:: stays as the fallback (review question 12). Members of a component
11605−:: keep their source order. Definitions in no component (molds, and
11606−:: every value when duplicate names leave no components) follow in
11609−++ dependency-order
11610− |= [ds=(list def) components=icomponents]
11612− =/ ranked=(list def)
11614− %+ turn components
11615− |= component=(list term)
11616− (skim ds |=(d=def &(?=(%value -.d) (lien component |=(n=term =(n name.d))))))
11617− =/ members=(list term) (zing components)
11618− =/ named=ivisited (graph-nameset members ~)
11619− (weld ranked (skip ds |=(d=def &(?=(%value -.d) (~(has by named) name.d)))))
11621++ resolve-supported-defs
9792++ resolve-supported-defs
11622 |= [ds=(list def) molds=imolds globals=(list term) externals=iexternals surs=(list term) mark-externals=imark-externals marks=(list term) jimports=ijimports reserved-molds=(list term) at=path prelude=(unit ifile)]
9793 |= [ds=(list def) molds=imolds globals=(list term) externals=iexternals surs=(list term) mark-externals=imark-externals marks=(list term) jimports=ijimports reserved-molds=(list term) at=path prelude=(unit ifile)]
11623 ^- ienv
9794 ^- ienv
@@ -11862,311 +10033,44 @@
11862 %overlap
10033 %overlap
11863 %unknown
10034 %unknown
11865−:: A source-only fallback for literal-tagged cells and one-hop local
10036+++ union-pairs
11866−:: generic applications. It screens all work before ordinary inference.
10037+ |= [cases=(list shape) molds=imolds]
11867−++ union-simple-shape-budget
10038+ ^- (list upair)
11868− |= [s=shape fuel=@ud vars=(unit (list @t))]
10039+ ?~ cases ~
11869− ^- (unit @ud)
10040+ =/ first=shape i.cases
11870− ?: =(0 fuel) ~
10041+ =/ a=upat (project-union-mold first molds ~)
11871− =. fuel (dec fuel)
10042+ =/ pairs=(list upair)
11872− ?- -.s
10043+ %+ turn t.cases
11873− ?(%aura %noun %void %flag) `fuel
10044+ |= second=shape
11874− %tvar
10045+ ^- upair
11875− ?~ vars `fuel
10046+ [at.first at.second (union-relate a (project-union-mold second molds ~))]
11876− ?:((lien u.vars |=(n=@t =(n name.s))) `fuel ~)
10047+ (weld pairs $(cases t.cases))
11878− ?. |(=(%term form.lit.s) =(%null form.lit.s) =(%loobean form.lit.s)) ~
10049+:: A closed structural mold supplies no equation to determine a hole.
11879− ?: &(=(%loobean form.lit.s) !|(=(0 val.lit.s) =(1 val.lit.s))) ~
10050+:: Applications, references, unbound capitals and unions are unproved.
11880− `fuel
10051+++ simple-mold-hole
11881− %cell (union-simple-fields-budget fields.s fuel vars)
10052+ |= sh=shape
10053+ ^- (unit (unit span))
10054+ ?: ?=(%generic -.sh)
10056+ ?. (distinct-params vars.sh) ~
10057+ (simple-mold-hole-in body.sh vars.sh)
10058+ (simple-mold-hole-in sh ~)
10059+++ simple-mold-hole-in
10060+ |= [sh=shape vars=(list @t)]
10061+ ^- (unit (unit span))
10064+ ?(%aura %noun %void %flag %const) `~
10065+ %tvar ?:((lien vars |=(v=@t =(v name.sh))) `~ ~)
10066+ %cell (simple-mold-field-holes fields.sh vars)
11883− =/ left=(unit @ud) $(s sample.s, fuel fuel)
10068+ =/ a=(unit (unit span)) $(sh sample.sh)
11884− ?~ left ~
10069+ ?~ a ~
11885− $(s product.s, fuel u.left)
10070+ =/ b=(unit (unit span)) $(sh product.sh)
11887− ==
10072+ `?~(u.a u.b u.a)
11888−++ union-simple-fields-budget
10073+ %generic ~
11889− |= [fields=(list field) fuel=@ud vars=(unit (list @t))]
11893− =/ field-shape=shape
11895− %bare shape.i.fields
11896− %face shape.i.fields
11897− %pun [%ref at.i.fields ~[name.i.fields]]
11899− =/ head=(unit @ud) (union-simple-shape-budget field-shape (dec fuel) vars)
11901− $(fields t.fields, fuel u.head)
11902−++ union-source-find
11903− |= [n=term molds=imolds fuel=@ud]
11904− ^- (unit [body=shape left=@ud])
11905− =/ found=(unit shape) ~
11911− ?: =(n name.i.molds)
11913− $(molds t.molds, fuel (dec fuel), found `body.i.molds)
11914− $(molds t.molds, fuel (dec fuel))
11915−++ union-source-args-budget
11916− |= [vars=(list @t) args=(list shape) fuel=@ud]
11918− =/ seen=(set @t) *(set @t)
11920− ?~ vars ?~(args `fuel ~)
11923− ?: (~(has in:..zuse seen) i.vars) ~
11924− =/ arg=(unit @ud) (union-simple-shape-budget i.args (dec fuel) ~)
11926− $(vars t.vars, args t.args, fuel u.arg, seen (~(put in:..zuse seen) i.vars))
11927−++ union-source-cell-tag
11930− ?. ?=(%cell -.s) ~
11933− ?. ?=(%bare -.i.fields.s) ~
11934− =/ head=shape shape.i.fields.s
11935− ?. ?=(%const -.head) ~
11936− ?. |(=(%term form.lit.head) =(%null form.lit.head) =(%loobean form.lit.head)) ~
11937− ?: &(=(%loobean form.lit.head) !|(=(0 val.lit.head) =(1 val.lit.head))) ~
11939−++ union-source-case-tag
11940− |= [s=shape molds=imolds fuel=@ud]
11941− ^- (unit [tag=@ left=@ud])
11943− =/ tag=(unit @) (union-source-cell-tag s)
11945− =/ left=(unit @ud) (union-simple-shape-budget s fuel ~)
11948− ?. ?=(%apply -.s) ~
11949− ?. ?=([@ ~] ref.s) ~
11951− =/ found=(unit [body=shape left=@ud]) (union-source-find i.ref.s molds (dec fuel))
11953− ?. ?=(%generic -.body.u.found) ~
11954− ?~ vars.body.u.found ~
11955− =/ tag=(unit @) (union-source-cell-tag body.body.u.found)
11957− =/ args=(unit @ud) (union-source-args-budget vars.body.u.found args.s left.u.found)
11959− =/ left=(unit @ud) (union-simple-shape-budget body.body.u.found u.args `vars.body.u.found)
11962−++ union-source-distinct-tags
11963− |= [cases=(list shape) molds=imolds fuel=@ud]
11965− =/ seen=(set @) *(set @)
11966− =/ has-application=? |
11968− ?~ cases has-application
11970− =/ item=(unit [tag=@ left=@ud]) (union-source-case-tag i.cases molds (dec fuel))
11972− ?: (~(has in:..zuse seen) tag.u.item) |
11973− $(cases t.cases, fuel left.u.item, seen (~(put in:..zuse seen) tag.u.item), has-application |(has-application ?=(%apply -.i.cases)))
11975−:: This inference-only screen bounds inherited work that the small source
11976−:: slice may consult. It does not authenticate a caller-created state.
11977−++ union-state-leaf
11980− ?=(?(%var %fvar %avar %rvar %nvar %rnvar %atom %any-atom %flag %noun %empty %const) -.t)
11981−++ union-state-params-budget
11982− |= [params=iparams fuel=@ud]
11986− ?. (union-state-leaf typ.i.params) ~
11987− $(params t.params, fuel (dec fuel))
11988−++ union-state-sub-budget
11989− |= [sub=isub fuel=@ud]
11993− ?. (union-state-leaf val.i.sub) ~
11994− $(sub t.sub, fuel (dec fuel))
11995−++ union-state-caps-budget
11996− |= [caps=icaps fuel=@ud]
12000− $(caps t.caps, fuel (dec fuel))
12001−++ union-state-active-budget
12002− |= [active=(list term) fuel=@ud]
12006− $(active t.active, fuel (dec fuel))
12007−++ union-state-tags-budget
12008− |= [tags=(list ipending) fuel=@ud]
12012− $(tags t.tags, fuel (dec fuel))
12013−++ union-source-state-safe
12014− |= [state=istate fuel=@ud]
12016− ?^ grec-index.state |
12019− ?^ obligations.state |
12020− =/ params=(unit @ud) (union-state-params-budget params.state fuel)
12022− =/ sub=(unit @ud) (union-state-sub-budget sub.state u.params)
12024− =/ caps=(unit @ud) (union-state-caps-budget caps.state u.sub)
12026− =/ active=(unit @ud) (union-state-active-budget active.state u.caps)
12028− ?=(^ (union-state-tags-budget tags.state u.active))
12030−:: Positive overlap witnesses from parsed, one-hop local source only.
12031−:: Unknown or exhausted work returns no witness, never disjointness.
12032−+$ uow-case [at=span head=@ payload=upat]
12033−++ union-overlap-primitive
12042− ?. |(=(%term form.lit.s) =(%null form.lit.s) =(%loobean form.lit.s)) ~
12043− ?: &(=(%loobean form.lit.s) !|(=(0 val.lit.s) =(1 val.lit.s))) ~
12044− `[%atom `val.lit.s]
12047−++ union-overlap-case
12048− |= [s=shape molds=imolds fuel=@ud]
12049− ^- (unit [item=uow-case left=@ud])
12051− =. fuel (dec fuel)
12052− :: Each body has exactly two fields; an application has exactly one
12053− :: parameter and one concrete primitive argument. The full mold table
12054− :: is scanned to establish unique ownership.
12055− =/ expanded=(unit [body=shape param=(unit [name=@t pat=upat]) left=@ud])
12056− ?: ?=(%cell -.s) `[s ~ fuel]
12057− ?. ?=(%apply -.s) ~
12058− ?. ?=([@ ~] ref.s) ~
12059− ?. ?=([* ~] args.s) ~
12061− =/ found=(unit [body=shape left=@ud]) (union-source-find i.ref.s molds (dec fuel))
12063− ?. ?=(%generic -.body.u.found) ~
12064− ?. ?=([@ ~] vars.body.u.found) ~
12065− ?: =(0 left.u.found) ~
12066− =/ argument=(unit upat) (union-overlap-primitive i.args.s)
12068− `[body.body.u.found `[i.vars.body.u.found u.argument] (dec left.u.found)]
12070− =/ body=shape body.u.expanded
12071− ?. ?=(%cell -.body) ~
12072− ?. ?=([* * ~] fields.body) ~
12073− :: Charge the cell, two fields, and the head and payload nodes.
12074− ?: (lth left.u.expanded 5) ~
12075− =/ head=(unit @) (union-source-cell-tag body)
12077− =/ field=field i.t.fields.body
12082− %pun [%ref at.field ~[name.field]]
12084− =/ pattern=(unit upat)
12085− ?: ?=(%tvar -.payload)
12086− ?~ param.u.expanded ~
12087− ?. =(name.payload name.u.param.u.expanded) ~
12088− `pat.u.param.u.expanded
12089− (union-overlap-primitive payload)
12091− `[[at.s u.head u.pattern] (sub left.u.expanded 5)]
12092−++ union-overlap-against
12093− |= [first=uow-case rest=(list shape) molds=imolds fuel=@ud]
12094− ^- (unit [witness=(unit upair) left=@ud])
12097− =/ other=(unit [item=uow-case left=@ud]) (union-overlap-case i.rest molds (dec fuel))
12099− ?: &(=(head.first head.item.u.other) =(%overlap (union-relate payload.first payload.item.u.other)))
12100− `[`[at.first at.item.u.other %overlap] left.u.other]
12101− $(rest t.rest, fuel left.u.other)
12102−++ union-source-overlap
12103− |= [cases=(list shape) molds=imolds fuel=@ud]
12108− =/ first=(unit [item=uow-case left=@ud]) (union-overlap-case i.cases molds (dec fuel))
12110− =/ found=(unit [witness=(unit upair) left=@ud])
12111− (union-overlap-against item.u.first t.cases molds left.u.first)
12113− ?^ witness.u.found witness.u.found
12114− $(cases t.cases, fuel left.u.found)
12117− |= [cases=(list shape) molds=imolds]
12120− =/ first=shape i.cases
12121− =/ a=upat (project-union-mold first molds ~)
12122− =/ pairs=(list upair)
12126− [at.first at.second (union-relate a (project-union-mold second molds ~))]
12127− (weld pairs $(cases t.cases))
12129−:: The partial report and the full module check share one overlap proof,
12130−:: so for the same union both name the same pair. The caller passes the
12131−:: projected .pairs, which the partial report reads again. The projection
12132−:: proves atoms, flags and nested literal cells, and its first overlap is
12133−:: named even when the source slice would prove an earlier pair. The
12134−:: source slice is tried only when some pair is unknown, for its one-hop
12135−:: generic applications. A missing witness does not mean the cases are
12137−++ mold-overlap-witness
12138− |= [cases=(list shape) pairs=(list upair) molds=imolds]
12140− =/ overlapping=(list upair) (skim pairs |=(p=upair =(%overlap relation.p)))
12141− ?^ overlapping `i.overlapping
12142− ?. (lien pairs |=(p=upair =(%unknown relation.p))) ~
12143− (union-source-overlap cases molds 256)
12145−:: A closed structural mold supplies no equation to determine a hole.
12146−:: Applications, references, unbound capitals and unions are unproved.
12147−++ simple-mold-hole
12149− ^- (unit (unit span))
12150− ?: ?=(%generic -.sh)
12152− ?. (distinct-params vars.sh) ~
12153− (simple-mold-hole-in body.sh vars.sh)
12154− (simple-mold-hole-in sh ~)
12155−++ simple-mold-hole-in
12156− |= [sh=shape vars=(list @t)]
12157− ^- (unit (unit span))
12160− ?(%aura %noun %void %flag %const) `~
12161− %tvar ?:((lien vars |=(v=@t =(v name.sh))) `~ ~)
12162− %cell (simple-mold-field-holes fields.sh vars)
12164− =/ a=(unit (unit span)) $(sh sample.sh)
12166− =/ b=(unit (unit span)) $(sh product.sh)
12172++ simple-mold-field-holes
10076++ simple-mold-field-holes
@@ -12281,17 +10185,15 @@
12281 =? sh ?=(%generic -.sh) body.sh
10185 =? sh ?=(%generic -.sh) body.sh
12282 ?. ?=(%union -.sh) (crip "+$ {(trip name.d)}: not checked")
10186 ?. ?=(%union -.sh) (crip "+$ {(trip name.d)}: not checked")
12283 =/ pairs=(list upair) (union-pairs cases.sh molds)
10187 =/ pairs=(list upair) (union-pairs cases.sh molds)
12284− =/ witness=(unit upair) (mold-overlap-witness cases.sh pairs molds)
10188+ =/ overlapping=(list upair) (skim pairs |=(p=upair =(%overlap relation.p)))
12285− ?^ witness
10189+ ?^ overlapping
12286− =/ p=upair u.witness
10190+ =/ p=upair i.overlapping
12287 =/ summary=@t (crip "+$ {(trip name.d)}: overlapping cases; mold not checked")
10191 =/ summary=@t (crip "+$ {(trip name.d)}: overlapping cases; mold not checked")
12288 =/ first=@t (show-error src [file line.beg.first.p col.beg.first.p "first union case"])
10192 =/ first=@t (show-error src [file line.beg.first.p col.beg.first.p "first union case"])
12289 =/ second=@t (show-error src [file line.beg.second.p col.beg.second.p "overlapping case"])
10193 =/ second=@t (show-error src [file line.beg.second.p col.beg.second.p "overlapping case"])
12290 (of-wain:format ~[summary first second])
10194 (of-wain:format ~[summary first second])
12291 ?: (lien pairs |=(p=upair =(%unknown relation.p)))
10195 ?: (lien pairs |=(p=upair =(%unknown relation.p)))
12292− ?. (union-source-distinct-tags cases.sh molds 256)
10196+ (crip "+$ {(trip name.d)}: case disjointness unresolved; mold not checked")
12293− (crip "+$ {(trip name.d)}: case disjointness unresolved; mold not checked")
12294− (crip "+$ {(trip name.d)}: cases proven disjoint; mold not checked")
12295 (crip "+$ {(trip name.d)}: cases proven disjoint; mold not checked")
10197 (crip "+$ {(trip name.d)}: cases proven disjoint; mold not checked")
12297:: +show-inference-diagnostic: a partial report with both source sites
10199:: +show-inference-diagnostic: a partial report with both source sites
@@ -12307,7 +10209,6 @@
12307 (of-wain:format [summary excerpts])
10209 (of-wain:format [summary excerpts])
12309:: Both written field sites are shown in the source that declares them.
10211:: Both written field sites are shown in the source that declares them.
12310−:: A store's derived-name clash shows its two sites the same way.
12311++ show-duplicate-fields
10212++ show-duplicate-fields
12312 |= [file=path src=@t diagnostic=idiag]
10213 |= [file=path src=@t diagnostic=idiag]
@@ -12349,14 +10250,7 @@
12349+$ jbundle (list jsource)
10250+$ jbundle (list jsource)
12350+$ jcache (list [at=path iface=ifile])
10251+$ jcache (list [at=path iface=ifile])
12351+$ jfile-result (each [iface=ifile cache=jcache] @t)
10252+$ jfile-result (each [iface=ifile cache=jcache] @t)
12352−:: Overlap evidence retains the exact source that supplied its spans.
12353−:: Ordinary Jibb imports preserve this evidence through the resolver.
12354−+$ jfile-overlap [file=path source=@t name=term cases=upair]
12355−+$ jfile-failure [message=@t overlap=(unit jfile-overlap)]
12356−+$ jfile-detailed-result (each [iface=ifile cache=jcache] jfile-failure)
12357+$ jimports-result (each [resolved=ijimports cache=jcache] @t)
10253+$ jimports-result (each [resolved=ijimports cache=jcache] @t)
12358−:: Preserve an imported overlap's original file and source across the graph.
12359−+$ jimports-detailed-result (each [resolved=ijimports cache=jcache] jfile-failure)
12361:: Written record fields each have their own lexical record scope.
10255:: Written record fields each have their own lexical record scope.
12362+$ written-fields (map term span)
10256+$ written-fields (map term span)
@@ -12465,29 +10359,13 @@
12465 =/ first=(unit idiag) ?:(?=(%expr -.i.segs) (duplicate-expr p.i.segs) ~)
10359 =/ first=(unit idiag) ?:(?=(%expr -.i.segs) (duplicate-expr p.i.segs) ~)
12466 ?^ first first
10360 ?^ first first
12467 $(segs t.segs)
10361 $(segs t.segs)
12468−:: A change's items each set a field once: two that name the same field,
12469−:: or one a field inside the other's, as cart and open.cart, overlap.
12470++ duplicate-edits
10362++ duplicate-edits
12471 |= edits=(list edit)
10363 |= edits=(list edit)
12472 ^- (unit idiag)
10364 ^- (unit idiag)
12473− =| seen=(list edit)
12474− |- ^- (unit idiag)
12475 ?~ edits ~
10365 ?~ edits ~
12476− =/ e=edit i.edits
10366+ =/ first (duplicate-expr val.i.edits)
12477− =/ prior=(list edit)
12478− (skim seen |=(p=edit (wing-overlap (flop names.p) (flop names.e))))
12480− =/ same=? =(names.i.prior names.e)
12481− =/ sites=(list [at=span note=tape])
12482− :~ [at.i.prior "first field"]
12483− [at.e ?:(same "repeated field" "overlapping field")]
12485− ?: same `["change field `{(show-names names.e)}` is repeated" sites]
12486− =/ a=tape (show-names names.i.prior)
12487− `["change fields `{a}` and `{(show-names names.e)}` overlap" sites]
12488− =/ first (duplicate-expr val.e)
12489 ?^ first first
10367 ?^ first first
12490− $(edits t.edits, seen [e seen])
10368+ $(edits t.edits)
12491++ duplicate-arms
10369++ duplicate-arms
12492 |= arms=(list arm)
10370 |= arms=(list arm)
12493 ^- (unit idiag)
10371 ^- (unit idiag)
@@ -12560,142 +10438,59 @@
12561 [n $(imports t.imports)]
10439 [n $(imports t.imports)]
12563−:: +reserved-name: whether n names a reserved operation
10441+++ reserved-proj-sample
12565−:: proj and unface are handled by the checker by type, not bound, so
12566−:: no module may define, import or bind either name, as a value or
12567−:: as a mold. A field, tag or path segment may still be spelled so.
12571− |(=(n %proj) =(n %unface))
12573 |= sam=sample
10442 |= sam=sample
12575 ?- -.sam
10444 ?- -.sam
12576− %bind (reserved-name name.sam)
10445+ %bind =(name.sam %proj)
12577− %face (reserved-name name.sam)
10446+ %face =(name.sam %proj)
12578− %pun (reserved-name name.sam)
10447+ %pun =(name.sam %proj)
12579− %cell (lien items.sam reserved-sample)
10448+ %cell (lien items.sam reserved-proj-sample)
12582−++ reserved-pattern
10451+++ reserved-proj-pattern
12583 |= p=pattern
10452 |= p=pattern
12586− %bind (reserved-name name.p)
10455+ %bind =(name.p %proj)
12587− %cell (lien items.p reserved-pattern)
10456+ %cell (lien items.p reserved-proj-pattern)
12590−++ reserved-def
10459+++ reserved-proj-def
12591 |= d=def
10460 |= d=def
12593− ?: (reserved-name name.d) &
10462+ ?: =(name.d %proj) &
12594− ?: ?=(%value -.d) (reserved-expr val.d)
10463+ ?: ?=(%value -.d) (reserved-proj-expr val.d)
12596−++ reserved-expr
10465+++ reserved-proj-expr
12597 |= e=expr
10466 |= e=expr
12600− %str (lien pieces.e |=(p=piece ?:(?=(%expr -.p) (reserved-expr p.p) |)))
10469+ %str (lien pieces.e |=(p=piece ?:(?=(%expr -.p) (reserved-proj-expr p.p) |)))
12601− %qath (lien segs.e |=(p=qseg ?:(?=(%expr -.p) (reserved-expr p.p) |)))
10470+ %qath (lien segs.e |=(p=qseg ?:(?=(%expr -.p) (reserved-proj-expr p.p) |)))
12602− %change (lien edits.e |=(p=edit (reserved-expr val.p)))
10471+ %change (lien edits.e |=(p=edit (reserved-proj-expr val.p)))
12603 %pair $(e val.e)
10472 %pair $(e val.e)
12604 %unit $(e val.e)
10473 %unit $(e val.e)
12605 %group $(e inner.e)
10474 %group $(e inner.e)
12606− %list (lien items.e reserved-expr)
10475+ %list (lien items.e reserved-proj-expr)
12607− %tuple (lien items.e |=(i=item (reserved-expr val.i)))
10476+ %tuple (lien items.e |=(i=item (reserved-proj-expr val.i)))
12608− ?(%gate %gate-wide) |((reserved-sample sample.e) $(e body.e))
10477+ ?(%gate %gate-wide) |((reserved-proj-sample sample.e) $(e body.e))
12609 %cast $(e val.e)
10478 %cast $(e val.e)
12610− %call |($(e head.e) (lien args.e reserved-expr))
10479+ %call |($(e head.e) (lien args.e reserved-proj-expr))
12611 %trace |($(e val.e) $(e then.e))
10480 %trace |($(e val.e) $(e then.e))
12612− %branch |($(e subject.e) (lien arms.e |=(a=arm |((reserved-pattern pat.a) (reserved-expr val.a)))))
10481+ %branch |($(e subject.e) (lien arms.e |=(a=arm |((reserved-proj-pattern pat.a) (reserved-proj-expr val.a)))))
12613− %body |((lien defs.e reserved-def) $(e final.e))
10482+ %body |((lien defs.e reserved-proj-def) $(e final.e))
12617−++ module-has-reserved
10486+++ module-has-reserved-proj
12618 |= mod=module
10487 |= mod=module
12620 =/ imported=(list term) (import-binding-names imports.mod)
10489 =/ imported=(list term) (import-binding-names imports.mod)
12621 =/ vals=(list term) (global-value-names defs.mod)
10490 =/ vals=(list term) (global-value-names defs.mod)
12622 =/ molds=imolds (collect-simple-molds defs.mod)
10491 =/ molds=imolds (collect-simple-molds defs.mod)
12623 =/ mold-names=(list term) (turn molds |=(m=[name=term body=shape] name.m))
10492 =/ mold-names=(list term) (turn molds |=(m=[name=term body=shape] name.m))
12624− |((lien (weld imported (weld vals mold-names)) reserved-name) (lien defs.mod reserved-def))
10493+ |((lien (weld imported (weld vals mold-names)) |=(n=term =(n %proj))) (lien defs.mod reserved-proj-def))
12626−:: A scope collision retains source sites. Prelude declarations may be in
12627−:: another source, so their name and namespace are retained separately.
12628−+$ iscope-diagnostic
12629− [issue=idiag prelude=(unit [name=term kind=?(%value %mold %any)])]
12630−++ scope-import-diagnostic
12631− |= [imports=(list import) prelude-values=(list term) prelude-molds=(list term) seen=written-fields]
12632− ^- (each written-fields iscope-diagnostic)
12633− ?~ imports [%& seen]
12634− =/ imp=import i.imports
12641− ?: (reserved-name n)
12642− [%| [["`{(trip n)}` is reserved and cannot be bound" ~[[at.imp "reserved name"]]] ~]]
12643− =/ earlier=(unit span) (~(get by seen) n)
12645− [%| [["import `{(trip n)}` shadows an earlier import" ~[[u.earlier "earlier import"] [at.imp "conflicting import"]]] ~]]
12646− ?: |((lien prelude-values |=(x=term =(n x))) (lien prelude-molds |=(x=term =(n x))))
12647− [%| [["import `{(trip n)}` shadows a prelude name" ~[[at.imp "conflicting import"]]] `[n %any]]]
12648− $(imports t.imports, seen (~(put by seen) n at.imp))
12649−++ scope-def-diagnostic
12650− |= [defs=(list def) imports=written-fields prelude-values=(list term) prelude-molds=(list term) values=written-fields molds=written-fields]
12651− ^- (unit iscope-diagnostic)
12655− ?: (reserved-name n)
12656− `[["`{(trip n)}` is reserved and cannot be bound" ~[[at.d "reserved name"]]] ~]
12657− =/ imported=(unit span) (~(get by imports) n)
12659− `[["definition `{(trip n)}` shadows an import" ~[[u.imported "import"] [at.d "conflicting definition"]]] ~]
12660− =/ seen=written-fields ?:(?=(%value -.d) values molds)
12661− =/ earlier=(unit span) (~(get by seen) n)
12663− `[["definition `{(trip n)}` shadows an earlier definition" ~[[u.earlier "earlier definition"] [at.d "conflicting definition"]]] ~]
12664− =/ prelude-names=(list term) ?:(?=(%value -.d) prelude-values prelude-molds)
12665− ?: (lien prelude-names |=(x=term =(n x)))
12666− `[["definition `{(trip n)}` shadows a prelude name" ~[[at.d "conflicting definition"]]] `[n ?:(?=(%value -.d) %value %mold)]]
12668− $(defs t.defs, values (~(put by values) n at.d))
12669− $(defs t.defs, molds (~(put by molds) n at.d))
12670−++ module-scope-diagnostic
12671− |= [mod=module prelude-values=(list term) prelude-molds=(list term)]
12672− ^- (unit iscope-diagnostic)
12673− =/ imports=(each written-fields iscope-diagnostic)
12674− (scope-import-diagnostic imports.mod prelude-values prelude-molds ~)
12675− ?: ?=(%| -.imports) `p.imports
12676− (scope-def-diagnostic defs.mod p.imports prelude-values prelude-molds ~ ~)
12677−++ show-scope-diagnostic
12678− |= [file=path src=@t diagnostic=iscope-diagnostic prelude=(unit ifile)]
12680− =/ excerpts=(list @t)
12681− %+ turn sites.issue.diagnostic
12682− |= site=[at=span note=tape]
12683− (show-error src [file line.beg.at.site col.beg.at.site note.site])
12684− =/ previous=(list @t)
12685− ?~ prelude.diagnostic ~
12687− ?~ source.u.prelude ~
12688− =/ parsed (parse at.u.prelude u.source.u.prelude)
12689− ?: ?=(%| -.parsed) ~
12690− =/ matching=(list def)
12691− %+ skim defs.p.parsed
12693− ?& =(name.d name.u.prelude.diagnostic)
12694− |(=(%any kind.u.prelude.diagnostic) =(-.d kind.u.prelude.diagnostic))
12697− ~[(show-error u.source.u.prelude [at.u.prelude line.beg.at.i.matching col.beg.at.i.matching "prelude declaration"])]
12698− (of-wain:format [(crip msg.issue.diagnostic) (weld excerpts previous)])
12700++ module-scope-valid
10495++ module-scope-valid
12701 |= [mod=module prelude-values=(list term) prelude-molds=(list term)]
10496 |= [mod=module prelude-values=(list term) prelude-molds=(list term)]
@@ -12704,7 +10499,7 @@
12704 =/ vals=(list term) (global-value-names defs.mod)
10499 =/ vals=(list term) (global-value-names defs.mod)
12705 =/ molds=imolds (collect-simple-molds defs.mod)
10500 =/ molds=imolds (collect-simple-molds defs.mod)
12706 =/ mold-names=(list term) (turn molds |=(m=[name=term body=shape] name.m))
10501 =/ mold-names=(list term) (turn molds |=(m=[name=term body=shape] name.m))
12707− ?: (module-has-reserved mod) |
10502+ ?: (module-has-reserved-proj mod) |
12708 ?. %+ levy imported
10503 ?. %+ levy imported
12709 |= n=term
10504 |= n=term
12710 &((unique-value-name n imported) !(lien vals |=(v=term =(n v))) !(lien mold-names |=(m=term =(n m))) !(lien prelude-values |=(v=term =(n v))) !(lien prelude-molds |=(m=term =(n m))))
10505 &((unique-value-name n imported) !(lien vals |=(v=term =(n v))) !(lien mold-names |=(m=term =(n m))) !(lien prelude-values |=(v=term =(n v))) !(lien prelude-molds |=(m=term =(n m))))
@@ -12712,44 +10507,22 @@
12712 ?. (levy vals |=(n=term &((unique-value-name n vals) !(lien prelude-values |=(v=term =(n v)))))) |
10507 ?. (levy vals |=(n=term &((unique-value-name n vals) !(lien prelude-values |=(v=term =(n v)))))) |
12713 (levy mold-names |=(n=term &((unique-value-name n mold-names) !(lien prelude-molds |=(m=term =(n m))))))
10508 (levy mold-names |=(n=term &((unique-value-name n mold-names) !(lien prelude-molds |=(m=term =(n m))))))
12715−:: A detailed failure is attached only to the first mold that actually
10510+:: In an API file or before main's kind is known, a lone `+$ poke`
12716−:: failed in this check, using that module's checked source mold table.
10511+:: may be a declaration rather than a mold that shadows the prelude. Do not call
12717−+$ imold-failure [message=@t overlap=(unit [name=term cases=upair])]
10512+:: that one collision definite, and do not hide unrelated scope errors.
12718−:: Validate a generic wrapper without an unbounded duplicate-name pass.
10513+++ pending-declared-poke
12719−++ module-mold-params-valid
10514+ |= [at=path mod=module prelude-values=(list term) prelude-molds=(list term)]
12720− |= [vars=(list @t) seen=(set @t) fuel=@ud]
12722− ?~ vars &
10516+ ?. (lien prelude-molds |=(n=term =(%poke n))) |
12723− ?: =(0 fuel) |
10517+ ?. |(?=([%ui %api @ %jibb ~] at) (lien defs.mod |=(d=def &(?=(%value -.d) =(%main name.d))))) |
12724− ?: (~(has in:..zuse seen) i.vars) |
10518+ =/ pokes=(list def)
12725− $(vars t.vars, seen (~(put in:..zuse seen) i.vars), fuel (dec fuel))
10519+ (skim defs.mod |=(d=def &(?=(%mold -.d) =(%poke name.d))))
12726−++ module-mold-overlap
10520+ ?~ pokes |
12727− |= [m=[name=term body=shape] molds=imolds]
10521+ ?^ t.pokes |
12728− ^- (unit upair)
10522+ =/ remaining=(list def)
12729− =/ sh=shape body.m
10523+ (skim defs.mod |=(d=def !&(?=(%mold -.d) =(%poke name.d))))
12730− =/ valid=?
10524+ (module-scope-valid mod(defs remaining) prelude-values prelude-molds)
12731− ?. ?=(%generic -.sh) &
10525+::
12733− (module-mold-params-valid vars.sh *(set @t) 256)
12735− =? sh ?=(%generic -.sh) body.sh
12736− ?. ?=(%union -.sh) ~
12737− :: A failed inference keeps no projection, so it is computed once more.
12738− (mold-overlap-witness cases.sh (union-pairs cases.sh molds) molds)
12739−++ module-mold-types-detail
12740− |= [molds=imolds state=istate]
12741− ^- (each imold-types imold-failure)
12743− =/ m=[name=term body=shape] i.molds
12744− =/ t=(unit [template=ischeme state=istate])
12745− (infer-mold-template body.m state(active [name.m active.state], in-mold &))
12747− =/ overlap=(unit upair) (module-mold-overlap m molds.state)
12748− [%| ['module mold needs unsupported inference' ?~(overlap ~ `[name.m u.overlap])]]
12749− =. typ.template.u.t (label-direct-union typ.template.u.t body.m name.m state)
12750− =/ rest=(each imold-types imold-failure) $(molds t.molds)
12751− ?: ?=(%| -.rest) rest
12752− [%& [[name.m template.u.t] p.rest]]
12753++ module-mold-types
10526++ module-mold-types
12754 |= [molds=imolds state=istate]
10527 |= [molds=imolds state=istate]
12755 ^- (each imold-types @t)
10528 ^- (each imold-types @t)
@@ -12807,42 +10580,10 @@
12807 ?. ?=(%tvar -.i.args.tail) |
10580 ?. ?=(%tvar -.i.args.tail) |
12808 =(var name.i.args.tail)
10581 =(var name.i.args.tail)
12810−++ prelude-public-label
12813− ?: =(label 'ask.internal') `'ask'
12814− ?: =(label 'qath.internal') `'qath'
12815− ?: =(label 'raw-poke.internal') `'raw-poke'
12818−++ prelude-label-nested
12823− =/ label=(unit @t) ?~(label.typ ~ (prelude-public-label u.label.typ))
12824− [%union (turn cases.typ |=(c=itype (prelude-label-nested c))) origin.typ label (turn args.typ |=(c=itype (prelude-label-nested c)))]
12826− =/ label=(unit @t) ?~(label.typ ~ (prelude-public-label u.label.typ))
12827− typ(label label, args (turn args.typ |=(c=itype (prelude-label-nested c))))
12829− =/ label=(unit @t) ?~(label.typ ~ (prelude-public-label u.label.typ))
12831− %collection [%collection name.typ (turn args.typ |=(c=itype (prelude-label-nested c)))]
12832− %face [%face name.typ $(typ body.typ)]
12833− %fn [%fn $(typ sample.typ) $(typ product.typ)]
12834− %cell [%cell $(typ hed.typ) $(typ tal.typ)]
12838++ prelude-label
10583++ prelude-label
12839 |= [typ=itype name=term vars=(list @ud)]
10584 |= [typ=itype name=term vars=(list @ud)]
12840 ^- itype
10585 ^- itype
12841− =. typ (prelude-label-nested typ)
12842 ?: ?=(%jrec -.typ) typ(label `name)
10586 ?: ?=(%jrec -.typ) typ(label `name)
12843− ?: ?=(%grec -.typ)
12844− ?. (identity-union-parameters vars args.typ) typ(label ~)
12846 ?. ?=(%union -.typ) typ
10587 ?. ?=(%union -.typ) typ
12847 ?. (identity-union-parameters vars args.typ)
10588 ?. (identity-union-parameters vars args.typ)
12848 ?~ origin.typ typ
10589 ?~ origin.typ typ
@@ -12875,14 +10616,7 @@
12875 =/ plus=ischeme [[%fn [%cell b b] b] ~[0]]
10616 =/ plus=ischeme [[%fn [%cell b b] b] ~[0]]
12876 =/ minus=ischeme [[%fn b b] ~[0]]
10617 =/ minus=ischeme [[%fn b b] ~[0]]
12877 =/ greater=ischeme [[%fn pair [%flag ~]] ~[0]]
10618 =/ greater=ischeme [[%fn pair [%flag ~]] ~[0]]
12878− =/ free=itype [%fvar 0]
10619+ [~[[%raw-add plus] [%raw-dec minus] [%raw-gth greater]] ~ /lib/jibb/primitives/jibb ~ ~ ~ ~ ~]
12879− =/ equal=ischeme [[%fn [%cell free free] [%flag ~]] ~[0]]
12880− =/ utf8=itype [%atom 'tD']
12881− =/ tape=itype [%collection %list ~[utf8]]
12882− =/ codepoints=itype [%collection %list ~[[%atom %c]]]
12883− =/ text-trip=ischeme [[%fn [%atom %t] tape] ~]
12884− =/ text-tuba=ischeme [[%fn tape codepoints] ~]
12885− [~[[%raw-add plus] [%raw-dec minus] [%raw-gth greater] [%raw-eq equal] [%raw-trip text-trip] [%raw-tuba text-tuba]] ~ /lib/jibb/primitives/jibb ~ ~ ~ ~ ~]
12887++ infer-private-internal
10621++ infer-private-internal
12888 |= [src=@t public-source=@t]
10622 |= [src=@t public-source=@t]
@@ -12923,7 +10657,7 @@
12923 =/ source-unit=(unit ischeme)
10657 =/ source-unit=(unit ischeme)
12924 ?~ unit-decl ~
10658 ?~ unit-decl ~
12925 =/ unit-molds=imolds ~[[%unit u.unit-decl]]
10659 =/ unit-molds=imolds ~[[%unit u.unit-decl]]
12926− =/ unit-state=istate [0 ~ ~ ~ unit-molds ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | /lib/jibb/prelude/jibb ~[%unit] ~ ~ 256 ~ ~ ~ ~ ~ ~]
10660+ =/ unit-state=istate [0 ~ ~ ~ unit-molds ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | /lib/jibb/prelude/jibb ~[%unit] ~ ~ 256 ~ ~ ~]
12927 =/ unit-types=imold-types (partial-prelude-molds unit-molds unit-state)
10661 =/ unit-types=imold-types (partial-prelude-molds unit-molds unit-state)
12928 =/ unit-iface=ifile [~ unit-types /lib/jibb/prelude/jibb ~ ~ ~ ~ ~]
10662 =/ unit-iface=ifile [~ unit-types /lib/jibb/prelude/jibb ~ ~ ~ ~ ~]
12929 =/ found=(unit ischeme) (find-jibb-mold %unit unit-iface)
10663 =/ found=(unit ischeme) (find-jibb-mold %unit unit-iface)
@@ -12938,7 +10672,7 @@
12938 =/ js=ijimports ~[[face.i.imports.mod primitive]]
10672 =/ js=ijimports ~[[face.i.imports.mod primitive]]
12939 =/ reserved=(list term) ~[face.i.imports.mod]
10673 =/ reserved=(list term) ~[face.i.imports.mod]
12940 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
10674 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
12941− =/ state=istate [0 ~ ~ ~ molds globals ~ ~ ~ ~ js reserved ~ ~ ~ | at top ~ ~ 256 ~ ~ ~ ~ ~ ~]
10675+ =/ state=istate [0 ~ ~ ~ molds globals ~ ~ ~ ~ js reserved ~ ~ ~ | at top ~ ~ 256 ~ ~ ~]
12942 =/ mts=(each imold-types @t) (module-mold-types molds state)
10676 =/ mts=(each imold-types @t) (module-mold-types molds state)
12943 =/ usable=(unit imold-types)
10677 =/ usable=(unit imold-types)
12944 ?: ?=(%& -.mts) `p.mts
10678 ?: ?=(%& -.mts) `p.mts
@@ -12994,7 +10728,7 @@
12994 =? env-molds declared
10728 =? env-molds declared
12995 (skim molds |=(m=[name=term body=shape] !=(%list name.m)))
10729 (skim molds |=(m=[name=term body=shape] !=(%list name.m)))
12996 =/ reserved=(list term) ?:(declared ~[%list] ~)
10730 =/ reserved=(list term) ?:(declared ~[%list] ~)
12997− =/ state=istate [0 ~ ~ ~ env-molds globals ~ ~ ~ ~ u.private reserved ~ ~ ~ | at names ~ ~ 256 ~ ~ ~ ~ ~ ~]
10731+ =/ state=istate [0 ~ ~ ~ env-molds globals ~ ~ ~ ~ u.private reserved ~ ~ ~ | at names ~ ~ 256 ~ ~ ~]
12998 :: Other prelude molds may use list only after its source has passed
10732 :: Other prelude molds may use list only after its source has passed
12999 :: the standard-list check. The raw declaration remains removed.
10733 :: the standard-list check. The raw declaration remains removed.
13000 =/ declared-list=(unit shape) (find-simple-mold %list molds)
10734 =/ declared-list=(unit shape) (find-simple-mold %list molds)
@@ -13059,99 +10793,6 @@
13059 ?~ (ienv-lookup name.i.ds env) |
10793 ?~ (ienv-lookup name.i.ds env) |
13060 $(ds t.ds)
10794 $(ds t.ds)
13062−:: Names the value a failed full check stops at, for its message only. A
13063−:: value whose module dependencies all resolved failed on its own, so the
13064−:: first such missing value is named. Otherwise every missing value waits
13065−:: on another, so following the first one each waits on, from the first
13066−:: missing value, reaches a value twice, which is named. The walk is over
13067−:: the syntactic dependency graph: dependency-expr ignores binders, so a
13068−:: sample or other local binder with a top-level value's name reads as a
13069−:: dependency on it. The named value is on a cycle of that graph, but may
13070−:: only call into the value that failed, as when a binder in that value
13071−:: shadows the named one. It claims no error in the named value.
13072−++ module-missing-value
13073− |= [ds=(list def) env=ienv]
13075− =/ missing=(list term)
13078− ?. ?=(%value -.d) ~
13079− ?^ (ienv-lookup name.d env) ~
13082− =/ pending=ivisited (graph-nameset missing ~)
13083− =/ roots=(list term)
13086− ?. ?=(%value -.d) ~
13087− ?~ (~(get by pending) name.d) ~
13088− =/ deps=(list term) (dependency-expr val.d)
13089− ?. (levy deps |=(n=term |(=(n name.d) ?=(~ (~(get by pending) n))))) ~
13092− =/ seen=ivisited ~
13093− =/ here=term i.missing
13095− ?^ (~(get by seen) here) `here
13096− =/ next=(list term)
13100− ?. ?=(%value -.d) ~
13101− ?. =(here name.d) ~
13102− (skim (dependency-expr val.d) |=(n=term &(!=(n here) ?=(^ (~(get by pending) n)))))
13104− $(seen (~(put by seen) here &), here i.next)
13106−:: Finds the first missing value that is a gate whose own sample has the
13107−:: name of a value in scope. Partial inference rejects that sample ("sample
13108−:: shadows a name"), and it is an error (grammar, Modules). Mark names name
13109−:: molds and are left out, as are cell samples and binders deeper in the
13111−++ module-sample-shadow
13112− |= [ds=(list def) env=ienv values=(list term)]
13113− ^- (unit [name=term at=span])
13115− ?. ?=(%value -.i.ds) $(ds t.ds)
13116− ?^ (ienv-lookup name.i.ds env) $(ds t.ds)
13117− =/ e=expr val.i.ds
13118− ?. ?=(?(%gate %gate-wide) -.e) $(ds t.ds)
13119− =/ s=sample sample.e
13120− =/ name=(unit term)
13126− ?~ name $(ds t.ds)
13127− ?. (lien values |=(n=term =(n u.name))) $(ds t.ds)
13130−:: Select the first available reason in dependency order, rather than
13131−:: preferring one class of diagnostic across the whole module. Only the
13132−:: first 64 definitions are retried for pending tags, as before.
13133−++ module-unresolved-diagnostic
13134− |= [ds=(list def) env=ienv base=istate checked=(map term def) heads=(unit igate-prelude-evidence) failures=(list [name=term diag=idiag]) values=(list term) file=path src=@t fuel=@ud]
13138− =/ remaining=@ud ?:(=(0 fuel) 0 (dec fuel))
13139− ?: ?=(%mold -.d) $(ds t.ds, fuel remaining)
13140− ?^ (ienv-lookup name.d env) $(ds t.ds, fuel remaining)
13141− =/ found=(list [name=term diag=idiag])
13142− (skim failures |=(failure=[name=term diag=idiag] =(name.failure name.d)))
13143− ?^ found `(show-inference-diagnostic file src name.d diag.i.found)
13144− =/ pending=(unit [at=span msg=tape])
13146− (module-pending-tag-one d env base checked heads)
13148− `(show-error src [file line.beg.at.u.pending col.beg.at.u.pending msg.u.pending])
13149− =/ shadow=(unit [name=term at=span]) (module-sample-shadow ~[d] env values)
13151− =/ msg=tape "sample `{(trip name.u.shadow)}` shadows a name already in scope"
13152− `(show-error src [file line.beg.at.u.shadow col.beg.at.u.shadow msg])
13153− $(ds t.ds, fuel remaining)
13155:: Cache only completed interfaces for this invocation. The source bundle,
10796:: Cache only completed interfaces for this invocation. The source bundle,
13156:: imported Hoon types and prelude are fixed for the whole graph. Check the
10797:: imported Hoon types and prelude are fixed for the whole graph. Check the
13157:: active path and duplicate sources before consulting it, so a cache hit
10798:: active path and duplicate sources before consulting it, so a cache hit
@@ -13191,25 +10832,6 @@
13191 =(externals.g externals)
10832 =(externals.g externals)
13192 =(marks.g marks)
10833 =(marks.g marks)
13194−++ request-graph-bounded
13195− |= g=irequest-graph
13197− =/ total=@ud (add (lent requests.g) (lent stores.g))
13198− &((lte (lent ~(tap in:..zuse paths.g)) 256) (lte total 256))
13200−++ store-graph-requests-add
13201− |= [pending=(list istore-request-evidence) acc=(list istore-request-evidence) fuel=@ud]
13202− ^- (unit (list istore-request-evidence))
13205− =/ hit=(list istore-request-evidence)
13206− (skim acc |=(x=istore-request-evidence =(store-at.x store-at.i.pending)))
13208− ?. ?=([* ~] hit) ~
13209− ?. =(i.hit i.pending) ~
13210− $(pending t.pending, fuel (dec fuel))
13211− $(pending t.pending, acc [i.pending acc], fuel (dec fuel))
13213++ request-graph-merge
10835++ request-graph-merge
13214 |= [imports=ijimports g=irequest-graph fuel=@ud]
10836 |= [imports=ijimports g=irequest-graph fuel=@ud]
13215 ^- (unit irequest-graph)
10837 ^- (unit irequest-graph)
@@ -13230,13 +10852,8 @@
13230 =/ rs=(unit (list irequest-evidence))
10852 =/ rs=(unit (list irequest-evidence))
13231 (request-graph-requests-add requests.cg requests.g (add 1 (lent requests.cg)))
10853 (request-graph-requests-add requests.cg requests.g (add 1 (lent requests.cg)))
13232 ?~ rs ~
10854 ?~ rs ~
13233− =/ ss=(unit (list istore-request-evidence))
10855+ ?: &(?=(^ u.rs) |((gth (lent ~(tap in:..zuse merged)) 256) (gth (lent u.rs) 256))) ~
13234− (store-graph-requests-add stores.cg stores.g (add 1 (lent stores.cg)))
10856+ $(imports t.imports, g g(paths merged, requests u.rs), fuel (dec fuel))
13236− =/ total=@ud (add (lent u.rs) (lent u.ss))
13237− ?: &(?=(^ u.rs) |((gth (lent ~(tap in:..zuse merged)) 256) (gth total 256))) ~
13238− ?: &(?=(^ u.ss) |((gth (lent ~(tap in:..zuse merged)) 256) (gth total 256))) ~
13239− $(imports t.imports, g g(paths merged, requests u.rs, stores u.ss), fuel (dec fuel))
13240++ request-graph-reusable
10857++ request-graph-reusable
13241 |= [f=ifile src=@t externals=iexternals marks=imark-externals modules=jbundle active=(list path) values=(list term) molds=(list term) prelude=(unit ifile)]
10858 |= [f=ifile src=@t externals=iexternals marks=imark-externals modules=jbundle active=(list path) values=(list term) molds=(list term) prelude=(unit ifile)]
@@ -13251,40 +10868,33 @@
13251++ resolve-jibb-imports
10868++ resolve-jibb-imports
13252 |= [imports=(list import) externals=iexternals mark-externals=imark-externals modules=jbundle active=(list path) prelude-values=(list term) prelude-molds=(list term) cache=jcache prelude=(unit ifile)]
10869 |= [imports=(list import) externals=iexternals mark-externals=imark-externals modules=jbundle active=(list path) prelude-values=(list term) prelude-molds=(list term) cache=jcache prelude=(unit ifile)]
13253 ^- jimports-result
10870 ^- jimports-result
13254− =/ result=jimports-detailed-result
13255− (resolve-jibb-imports-detailed imports externals mark-externals modules active prelude-values prelude-molds cache prelude)
13256− ?: ?=(%| -.result) [%| message.p.result]
13258−++ resolve-jibb-imports-detailed
13259− |= [imports=(list import) externals=iexternals mark-externals=imark-externals modules=jbundle active=(list path) prelude-values=(list term) prelude-molds=(list term) cache=jcache prelude=(unit ifile)]
13260− ^- jimports-detailed-result
13261 ?~ imports [%& [~ cache]]
10871 ?~ imports [%& [~ cache]]
13262 ?. ?=(%jibb -.i.imports) $(imports t.imports)
10872 ?. ?=(%jibb -.i.imports) $(imports t.imports)
13263 =/ at=path (weld path.i.imports `path`~[%jibb])
10873 =/ at=path (weld path.i.imports `path`~[%jibb])
13264 ?: =(at /lib/jibb/internal/jibb)
10874 ?: =(at /lib/jibb/internal/jibb)
13265− [%| ['the prelude internal module is private' ~]]
10875+ [%| 'the prelude internal module is private']
13266 ?: =(at /lib/jibb/primitives/jibb)
10876 ?: =(at /lib/jibb/primitives/jibb)
13267− [%| ['the prelude primitive interface is private' ~]]
10877+ [%| 'the prelude primitive interface is private']
13268 ?: (lien active |=(p=path =(p at)))
10878 ?: (lien active |=(p=path =(p at)))
13269− [%| [(crip "import cycle at {(spud at)}") ~]]
10879+ [%| (crip "import cycle at {(spud at)}")]
13270 =/ found=jbundle (skim modules |=(m=jsource =(at at.m)))
10880 =/ found=jbundle (skim modules |=(m=jsource =(at at.m)))
13271− ?~ found [%| [(crip "module source missing: {(spud at)}") ~]]
10881+ ?~ found [%| (crip "module source missing: {(spud at)}")]
13272− ?^ t.found [%| [(crip "duplicate module sources: {(spud at)}") ~]]
10882+ ?^ t.found [%| (crip "duplicate module sources: {(spud at)}")]
13273 =/ cached=(unit ifile) (find-jibb-cache at cache)
10883 =/ cached=(unit ifile) (find-jibb-cache at cache)
13274− =/ iface=jfile-detailed-result
10884+ =/ iface=jfile-result
13275 ?^ cached
10885 ?^ cached
13276− ?. =(at.u.cached at) [%| ['cached module identity needs unsupported inference' ~]]
10886+ ?. =(at.u.cached at) [%| 'cached module identity needs unsupported inference']
13277 ?~ graph.u.cached
10887 ?~ graph.u.cached
13278 :: A detached legacy interface has unknown evidence. Rebuild it
10888 :: A detached legacy interface has unknown evidence. Rebuild it
13279 :: against the current graph, without retaining any stale entry.
10889 :: against the current graph, without retaining any stale entry.
13280 =/ clean=jcache (skim cache |=(x=[at=path iface=ifile] !=(at.x at)))
10890 =/ clean=jcache (skim cache |=(x=[at=path iface=ifile] !=(at.x at)))
13281− (infer-jibb-file-detailed at source.i.found externals mark-externals modules [at active] prelude-values prelude-molds clean prelude)
10891+ (infer-jibb-file at source.i.found externals mark-externals modules [at active] prelude-values prelude-molds clean prelude)
13282 ?. (request-graph-reusable u.cached source.i.found externals mark-externals modules active prelude-values prelude-molds prelude)
10892 ?. (request-graph-reusable u.cached source.i.found externals mark-externals modules active prelude-values prelude-molds prelude)
13283− [%| ['cached module evidence needs unsupported inference' ~]]
10893+ [%| 'cached module evidence needs unsupported inference']
13284 [%& [u.cached cache]]
10894 [%& [u.cached cache]]
13285− (infer-jibb-file-detailed at source.i.found externals mark-externals modules [at active] prelude-values prelude-molds cache prelude)
10895+ (infer-jibb-file at source.i.found externals mark-externals modules [at active] prelude-values prelude-molds cache prelude)
13286 ?: ?=(%| -.iface) [%| p.iface]
10896 ?: ?=(%| -.iface) [%| p.iface]
13287− =/ rest=jimports-detailed-result $(imports t.imports, cache cache.p.iface)
10897+ =/ rest=jimports-result $(imports t.imports, cache cache.p.iface)
13288 ?: ?=(%| -.rest) rest
10898 ?: ?=(%| -.rest) rest
13289 [%& [[[face.i.imports iface.p.iface] resolved.p.rest] cache.p.rest]]
10899 [%& [[[face.i.imports iface.p.iface] resolved.p.rest] cache.p.rest]]
@@ -13418,70 +11028,31 @@
13419 =/ path-names=(list term) (turn paths |=(p=iapi-path name.p))
11029 =/ path-names=(list term) (turn paths |=(p=iapi-path name.p))
13420 =/ derived=(list term) (weld path-names poke-names)
11030 =/ derived=(list term) (weld path-names poke-names)
13421− ?: (lien derived reserved-name) |
11031+ ?: (lien derived |=(n=term =(n %proj))) |
13422 =/ outer=(list term) (weld prelude-values (weld (global-value-names defs.mod) (api-import-faces imports.mod)))
11032 =/ outer=(list term) (weld prelude-values (weld (global-value-names defs.mod) (api-import-faces imports.mod)))
13423 (levy derived |=(n=term &((unique-value-name n derived) !(lien outer |=(x=term =(n x))))))
11033 (levy derived |=(n=term &((unique-value-name n derived) !(lien outer |=(x=term =(n x))))))
13425−:: The definite error behind some failures of the check above. An API
13426−:: exports `poke` when it declares `+$ poke`, and a request per case of a
13427−:: `+$ paths` that reads as path cases; these names surely exist, so a clash
13428−:: among them or with the module's scope is an error (grammar, Modules). A
13429−:: reserved `proj` stays unsupported, as in the check above.
13430−++ api-derived-clash
13431− |= [mod=module prelude-values=(list term)]
13433− =/ declared=(list term) (collect-mark-imports imports.mod)
13434− =/ declarations=(list def)
13435− (skim defs.mod |=(d=def &(?=(%mold -.d) =(%paths name.d))))
13436− =/ cases=(list [name=term at=span note=tape])
13437− ?. ?=([* ~] declarations) ~
13438− =/ decl=def i.declarations
13439− ?> ?=(%mold -.decl)
13440− =/ paths=(unit (list iapi-path)) (api-path-declaration shape.decl declared)
13442− (turn u.paths |=(p=iapi-path [name.p at.p "`{(trip name.p)}` is derived from this path case"]))
13443− =/ pokes=(list def)
13444− (skim defs.mod |=(d=def &(?=(%mold -.d) =(%poke name.d))))
13445− =/ derived=(list [name=term at=span note=tape])
13446− ?. ?=([* ~] pokes) cases
13447− (snoc cases [%poke at.i.pokes "`poke` is derived from this mold"])
13448− =/ names=(list term) (turn derived |=(x=[name=term at=span note=tape] name.x))
13449− =/ outer=(list term) (weld prelude-values (weld (global-value-names defs.mod) (api-import-faces imports.mod)))
13450− =/ clashes=(list term)
13453− ?| (reserved-name n)
13454− &((unique-value-name n names) !(lien outer |=(x=term =(n x))))
13457− =/ sites=(list [at=span note=tape])
13459− |= x=[name=term at=span note=tape]
13460− ?. =(i.clashes name.x) ~
13462− `(derived-name-clash "API" i.clashes sites mod)
13464:: Analysis only. Successful external entries must be unchanged results
11035:: Analysis only. Successful external entries must be unchanged results
13465:: produced for the declared marks; no request interface is produced.
11036:: produced for the declared marks; no request interface is produced.
13466+$ iapi-mark-type [name=term typ=itype]
11037+$ iapi-mark-type [name=term typ=itype]
13467+$ iapi-path-typed [path=iapi-path full=itype diffs=(list iapi-mark-type)]
11038+$ iapi-path-typed [path=iapi-path full=itype diffs=(list iapi-mark-type)]
13468++ api-diff-types
11039++ api-diff-types
13469− |= [names=(list term) externals=imark-externals declared=(list term) prelude=ifile]
11040+ |= [names=(list term) externals=imark-externals declared=(list term)]
13470 ^- (unit (list iapi-mark-type))
11041 ^- (unit (list iapi-mark-type))
13471 ?~ names `~
11042 ?~ names `~
13472− =/ typ=(unit itype) (find-imported-mark-prelude i.names externals declared prelude)
11043+ =/ typ=(unit itype) (find-imported-mark i.names externals declared)
13473 ?~ typ ~
11044 ?~ typ ~
13474 =/ tail=(unit (list iapi-mark-type)) $(names t.names)
11045 =/ tail=(unit (list iapi-mark-type)) $(names t.names)
13475 ?~ tail ~
11046 ?~ tail ~
13476 `[[i.names u.typ] u.tail]
11047 `[[i.names u.typ] u.tail]
13478++ api-path-types
11049++ api-path-types
13479− |= [paths=(list iapi-path) externals=imark-externals declared=(list term) prelude=ifile]
11050+ |= [paths=(list iapi-path) externals=imark-externals declared=(list term)]
13480 ^- (unit (list iapi-path-typed))
11051 ^- (unit (list iapi-path-typed))
13481 ?~ paths `~
11052 ?~ paths `~
13482− =/ full=(unit itype) (find-imported-mark-prelude full.i.paths externals declared prelude)
11053+ =/ full=(unit itype) (find-imported-mark full.i.paths externals declared)
13483 ?~ full ~
11054 ?~ full ~
13484− =/ diffs=(unit (list iapi-mark-type)) (api-diff-types diffs.i.paths externals declared prelude)
11055+ =/ diffs=(unit (list iapi-mark-type)) (api-diff-types diffs.i.paths externals declared)
13485 ?~ diffs ~
11056 ?~ diffs ~
13486 =/ tail=(unit (list iapi-path-typed)) $(paths t.paths)
11057 =/ tail=(unit (list iapi-path-typed)) $(paths t.paths)
13487 ?~ tail ~
11058 ?~ tail ~
@@ -13501,7 +11072,7 @@
13501 `~[u.name]
11072 `~[u.name]
13503++ api-path-analysis
11074++ api-path-analysis
13504− |= [mod=module externals=imark-externals prelude-values=(list term) prelude-molds=(list term) prelude=ifile]
11075+ |= [mod=module externals=imark-externals prelude-values=(list term) prelude-molds=(list term)]
13505 ^- (unit (list iapi-path-typed))
11076 ^- (unit (list iapi-path-typed))
13506 ?: (lien defs.mod def-has-hole) ~
11077 ?: (lien defs.mod def-has-hole) ~
13507 ?^ (duplicate-defs defs.mod) ~
11078 ?^ (duplicate-defs defs.mod) ~
@@ -13522,9 +11093,8 @@
13522 ?> ?=(%mold -.decl)
11093 ?> ?=(%mold -.decl)
13523 =/ paths=(unit (list iapi-path)) (api-path-declaration shape.decl declared)
11094 =/ paths=(unit (list iapi-path)) (api-path-declaration shape.decl declared)
13524 ?~ paths ~
11095 ?~ paths ~
13525− =/ derived-pokes=(list term) ?~(pokes ~ ~[%poke])
11096+ ?. (api-derived-names-valid u.paths u.poke-names mod prelude-values) ~
13526− ?. (api-derived-names-valid u.paths derived-pokes mod prelude-values) ~
11097+ (api-path-types u.paths externals declared)
13527− (api-path-types u.paths externals declared prelude)
13529:: Source/graph entry for path analysis only. The returned paths retain
11099:: Source/graph entry for path analysis only. The returned paths retain
13530:: reader-derived mark types and import resolution has checked reachable
11100:: reader-derived mark types and import resolution has checked reachable
@@ -13538,16 +11108,12 @@
13538 =/ duplicate=(unit idiag) (duplicate-defs defs.p.parsed)
11108 =/ duplicate=(unit idiag) (duplicate-defs defs.p.parsed)
13539 ?^ duplicate [%| (show-duplicate-fields file src u.duplicate)]
11109 ?^ duplicate [%| (show-duplicate-fields file src u.duplicate)]
13540 ?~ prepared [%| 'API path analysis needs the prepared prelude']
11110 ?~ prepared [%| 'API path analysis needs the prepared prelude']
13541− =/ public=ifile iface.u.prepared
13542− :: The analysis below would call a derived-name clash unsupported.
13543− =/ clash=(unit idiag) (api-derived-clash p.parsed values.u.prepared)
13544− ?^ clash [%| (show-duplicate-fields file src u.clash)]
13545 =/ prelude=(unit ifile) `iface.u.prepared
11111 =/ prelude=(unit ifile) `iface.u.prepared
13546 =/ deps=jimports-result
11112 =/ deps=jimports-result
13547 (resolve-jibb-imports imports.p.parsed externals marks modules ~[file] values.u.prepared molds.u.prepared ~ prelude)
11113 (resolve-jibb-imports imports.p.parsed externals marks modules ~[file] values.u.prepared molds.u.prepared ~ prelude)
13548 ?: ?=(%| -.deps) [%| p.deps]
11114 ?: ?=(%| -.deps) [%| p.deps]
13549 =/ paths=(unit (list iapi-path-typed))
11115 =/ paths=(unit (list iapi-path-typed))
13550− (api-path-analysis p.parsed marks values.u.prepared molds.u.prepared public)
11116+ (api-path-analysis p.parsed marks values.u.prepared molds.u.prepared)
13551 ?~ paths [%| 'API path declaration needs unsupported analysis']
11117 ?~ paths [%| 'API path declaration needs unsupported analysis']
13552 [%& u.paths]
11118 [%& u.paths]
@@ -13567,15 +11133,12 @@
13567 =/ duplicate=(unit idiag) (duplicate-defs defs.p.parsed)
11133 =/ duplicate=(unit idiag) (duplicate-defs defs.p.parsed)
13568 ?^ duplicate [%| (show-duplicate-fields file src u.duplicate)]
11134 ?^ duplicate [%| (show-duplicate-fields file src u.duplicate)]
13569 ?~ prepared [%| 'API path evidence needs the prepared prelude']
11135 ?~ prepared [%| 'API path evidence needs the prepared prelude']
13570− :: The analysis below would call a derived-name clash unsupported.
13571− =/ clash=(unit idiag) (api-derived-clash p.parsed values.u.prepared)
13572− ?^ clash [%| (show-duplicate-fields file src u.clash)]
13573 =/ public=ifile iface.u.prepared
11136 =/ public=ifile iface.u.prepared
13574 =/ deps=jimports-result
11137 =/ deps=jimports-result
13575 (resolve-jibb-imports imports.p.parsed externals marks modules ~[file] values.u.prepared molds.u.prepared ~ `public)
11138 (resolve-jibb-imports imports.p.parsed externals marks modules ~[file] values.u.prepared molds.u.prepared ~ `public)
13576 ?: ?=(%| -.deps) [%| p.deps]
11139 ?: ?=(%| -.deps) [%| p.deps]
13577 =/ paths=(unit (list iapi-path-typed))
11140 =/ paths=(unit (list iapi-path-typed))
13578− (api-path-analysis p.parsed marks values.u.prepared molds.u.prepared public)
11141+ (api-path-analysis p.parsed marks values.u.prepared molds.u.prepared)
13579 ?~ paths [%| 'API path declaration needs unsupported analysis']
11142 ?~ paths [%| 'API path declaration needs unsupported analysis']
13580 [%& [file src u.prepared externals marks cache.p.deps u.paths]]
11143 [%& [file src u.prepared externals marks cache.p.deps u.paths]]
13581:: Graph-aware variant preserves the caller active stack and cache.
11144:: Graph-aware variant preserves the caller active stack and cache.
@@ -13591,15 +11154,12 @@
13591 =/ duplicate=(unit idiag) (duplicate-defs defs.p.parsed)
11154 =/ duplicate=(unit idiag) (duplicate-defs defs.p.parsed)
13592 ?^ duplicate [%| (show-duplicate-fields file src u.duplicate)]
11155 ?^ duplicate [%| (show-duplicate-fields file src u.duplicate)]
13593 ?~ prepared [%| 'API path evidence needs the prepared prelude']
11156 ?~ prepared [%| 'API path evidence needs the prepared prelude']
13594− :: The analysis below would call a derived-name clash unsupported.
13595− =/ clash=(unit idiag) (api-derived-clash p.parsed values.u.prepared)
13596− ?^ clash [%| (show-duplicate-fields file src u.clash)]
13597 =/ public=ifile iface.u.prepared
11157 =/ public=ifile iface.u.prepared
13598 =/ deps=jimports-result
11158 =/ deps=jimports-result
13599 (resolve-jibb-imports imports.p.parsed externals marks modules active values.u.prepared molds.u.prepared cache `public)
11159 (resolve-jibb-imports imports.p.parsed externals marks modules active values.u.prepared molds.u.prepared cache `public)
13600 ?: ?=(%| -.deps) [%| p.deps]
11160 ?: ?=(%| -.deps) [%| p.deps]
13601 =/ paths=(unit (list iapi-path-typed))
11161 =/ paths=(unit (list iapi-path-typed))
13602− (api-path-analysis p.parsed marks values.u.prepared molds.u.prepared public)
11162+ (api-path-analysis p.parsed marks values.u.prepared molds.u.prepared)
13603 ?~ paths [%| 'API path declaration needs unsupported analysis']
11163 ?~ paths [%| 'API path declaration needs unsupported analysis']
13604 [%& [file src u.prepared externals marks cache.p.deps u.paths]]
11164 [%& [file src u.prepared externals marks cache.p.deps u.paths]]
@@ -13686,7 +11246,7 @@
13686 =/ vals=(list term) (global-value-names ordinary)
11246 =/ vals=(list term) (global-value-names ordinary)
13687 ?: (lien vals |=(n=term =(n %main))) [%| 'API module kind needs unsupported inference']
11247 ?: (lien vals |=(n=term =(n %main))) [%| 'API module kind needs unsupported inference']
13688 =/ declared=(list term) (collect-mark-imports imports.mod)
11248 =/ declared=(list term) (collect-mark-imports imports.mod)
13689− =/ mark-types=(unit (list iapi-mark-type)) (api-diff-types declared marks declared iface.prep)
11249+ =/ mark-types=(unit (list iapi-mark-type)) (api-diff-types declared marks declared)
13690 ?~ mark-types [%| 'API declared marks need unsupported inference']
11250 ?~ mark-types [%| 'API declared marks need unsupported inference']
13691 =/ prelude=(unit ifile) `iface.prep
11251 =/ prelude=(unit ifile) `iface.prep
13692 =/ deps=jimports-result
11252 =/ deps=jimports-result
@@ -13697,7 +11257,7 @@
13697 =/ surs=(list term) (collect-sur-imports imports.mod)
11257 =/ surs=(list term) (collect-sur-imports imports.mod)
13698 =/ reserved=(list term) (weld molds.prep (turn resolved.p.deps |=(j=[face=term interface=ifile] face.j)))
11258 =/ reserved=(list term) (weld molds.prep (turn resolved.p.deps |=(j=[face=term interface=ifile] face.j)))
13699 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
11259 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
13700− =/ state=istate [0 ~ ~ ~ molds globals externals surs marks declared resolved.p.deps reserved ~ ~ ~ | file top prelude ~ 256 ~ ~ ~ ~ ~ ~]
11260+ =/ state=istate [0 ~ ~ ~ molds globals externals surs marks declared resolved.p.deps reserved ~ ~ ~ | file top prelude ~ 256 ~ ~ ~]
13701 =/ mts=(each imold-types @t) (module-mold-types molds state)
11261 =/ mts=(each imold-types @t) (module-mold-types molds state)
13702 ?: ?=(%| -.mts) [%| p.mts]
11262 ?: ?=(%| -.mts) [%| p.mts]
13703 =/ resolution=iresolved (resolve-groups ordinary molds globals externals surs marks declared resolved.p.deps reserved file prelude)
11263 =/ resolution=iresolved (resolve-groups ordinary molds globals externals surs marks declared resolved.p.deps reserved file prelude)
@@ -13720,7 +11280,7 @@
13720 =/ vals=(list term) (global-value-names ordinary)
11280 =/ vals=(list term) (global-value-names ordinary)
13721 ?: (lien vals |=(n=term =(n %main))) [%| 'API module kind needs unsupported inference']
11281 ?: (lien vals |=(n=term =(n %main))) [%| 'API module kind needs unsupported inference']
13722 =/ declared=(list term) (collect-mark-imports imports.mod)
11282 =/ declared=(list term) (collect-mark-imports imports.mod)
13723− =/ mark-types=(unit (list iapi-mark-type)) (api-diff-types declared marks declared iface.prep)
11283+ =/ mark-types=(unit (list iapi-mark-type)) (api-diff-types declared marks declared)
13724 ?~ mark-types [%| 'API declared marks need unsupported inference']
11284 ?~ mark-types [%| 'API declared marks need unsupported inference']
13725 =/ prelude=(unit ifile) `iface.prep
11285 =/ prelude=(unit ifile) `iface.prep
13726 =/ deps=jimports-result
11286 =/ deps=jimports-result
@@ -13731,7 +11291,7 @@
13731 =/ surs=(list term) (collect-sur-imports imports.mod)
11291 =/ surs=(list term) (collect-sur-imports imports.mod)
13732 =/ reserved=(list term) (weld molds.prep (turn resolved.p.deps |=(j=[face=term interface=ifile] face.j)))
11292 =/ reserved=(list term) (weld molds.prep (turn resolved.p.deps |=(j=[face=term interface=ifile] face.j)))
13733 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
11293 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
13734− =/ state=istate [0 ~ ~ ~ molds globals externals surs marks declared resolved.p.deps reserved ~ ~ ~ | file top prelude ~ 256 ~ ~ ~ ~ ~ ~]
11294+ =/ state=istate [0 ~ ~ ~ molds globals externals surs marks declared resolved.p.deps reserved ~ ~ ~ | file top prelude ~ 256 ~ ~ ~]
13735 =/ mts=(each imold-types @t) (module-mold-types molds state)
11295 =/ mts=(each imold-types @t) (module-mold-types molds state)
13736 ?: ?=(%| -.mts) [%| p.mts]
11296 ?: ?=(%| -.mts) [%| p.mts]
13737 =/ resolution=iresolved (resolve-groups ordinary molds globals externals surs marks declared resolved.p.deps reserved file prelude)
11297 =/ resolution=iresolved (resolve-groups ordinary molds globals externals surs marks declared resolved.p.deps reserved file prelude)
@@ -13744,29 +11304,6 @@
13744:: Value watchability remains unproved even for a watchable declaration.
11304:: Value watchability remains unproved even for a watchable declaration.
13745+$ ione-request-interface
11305+$ ione-request-interface
13746 [support=iapi-support-evidence parts=iapi-request-parts iface=ifile]
11306 [support=iapi-support-evidence parts=iapi-request-parts iface=ifile]
13747−++ compatible-raw-poke
13748− |= prelude=iprelude
13750− =/ public=ifile iface.prelude
13751− ?. =(at.public /lib/jibb/prelude/jibb) ~
13752− =/ poke=(unit ischeme) (find-jibb-mold %raw-poke public)
13755− ?. ?=(%union -.typ.u.poke) ~
13756− ?^ args.typ.u.poke ~
13757− ?. =(origin.typ.u.poke `[/lib/jibb/internal/jibb %raw-poke]) ~
13758− ?: (itype-has-tag typ.u.poke) ~
13759− =/ private=(list iwidth-dependency)
13760− (skim dependencies.public |=(d=iwidth-dependency =(at.d /lib/jibb/internal/jibb)))
13761− ?. ?=([* ~] private) ~
13762− ?~ source.i.private ~
13763− =/ agent-case=itype
13764− [%cell [%const [%term %tas %agent '%agent']] [%cell [%face %agent [%atom %tas]] [%cell [%face %mark [%atom %tas]] [%face %payload [%noun ~]]]]]
13765− =/ store-case=itype
13766− [%cell [%const [%term %tas %store '%store']] [%cell [%face %module [%atom %t]] [%cell [%face %action [%atom %tas]] [%face %payload [%noun ~]]]]]
13767− ?. =(cases.typ.u.poke ~[agent-case store-case]) ~
13770++ request-compatible-ask
11307++ request-compatible-ask
13771 |= prelude=iprelude
11308 |= prelude=iprelude
13772 ^- (unit ischeme)
11309 ^- (unit ischeme)
@@ -13863,7 +11400,7 @@
13863 ?~ source.i.private [%| 'request internal source needs unsupported inference']
11400 ?~ source.i.private [%| 'request internal source needs unsupported inference']
13864 =/ req=irequest-evidence
11401 =/ req=irequest-evidence
13865 [file name.path.p p src u.source.public u.source.i.private values.prelude molds.prelude externals marks]
11402 [file name.path.p p src u.source.public u.source.i.private values.prelude molds.prelude externals marks]
13866− =/ interface=ifile [~[[name.path.p scheme]] exports file ~ ~ ~ `src `[(silt `(list path)`~[file]) ~[req] ~ modules `public values.prelude molds.prelude externals marks]]
11403+ =/ interface=ifile [~[[name.path.p scheme]] exports file ~ ~ ~ `src `[(silt `(list path)`~[file]) ~[req] modules `public values.prelude molds.prelude externals marks]]
13867 [%& [support u.parts interface]]
11404 [%& [support u.parts interface]]
13868:: Graph-aware request artifact; resolver use remains type-only.
11405:: Graph-aware request artifact; resolver use remains type-only.
13869++ one-request-interface-graph
11406++ one-request-interface-graph
@@ -13917,14 +11454,14 @@
13917 ?~ source.i.private [%| 'request internal source needs unsupported inference']
11454 ?~ source.i.private [%| 'request internal source needs unsupported inference']
13918 =/ req=irequest-evidence
11455 =/ req=irequest-evidence
13919 [file name.path.p p src u.source.public u.source.i.private values.prelude molds.prelude externals marks]
11456 [file name.path.p p src u.source.public u.source.i.private values.prelude molds.prelude externals marks]
13920− =/ interface=ifile [~[[name.path.p scheme]] exports file ~ ~ ~ `src `[(silt `(list path)`~[file]) ~[req] ~ modules `public values.prelude molds.prelude externals marks]]
11457+ =/ interface=ifile [~[[name.path.p scheme]] exports file ~ ~ ~ `src `[(silt `(list path)`~[file]) ~[req] modules `public values.prelude molds.prelude externals marks]]
13921 [%& [support u.parts interface]]
11458 [%& [support u.parts interface]]
13923++ api-mark-exports
11460++ api-mark-exports
13924− |= [marks=(list term) all=(list term) externals=imark-externals prelude=ifile]
11461+ |= [marks=(list term) all=(list term) externals=imark-externals]
13925 ^- imold-types
11462 ^- imold-types
13926 ?~ marks ~
11463 ?~ marks ~
13927− =/ t=(unit itype) (find-imported-mark-prelude i.marks externals all prelude)
11464+ =/ t=(unit itype) (find-imported-mark i.marks externals all)
13928 ?~ t $(marks t.marks)
11465 ?~ t $(marks t.marks)
13929 [[i.marks [u.t ~]] $(marks t.marks)]
11466 [[i.marks [u.t ~]] $(marks t.marks)]
@@ -13933,54 +11470,37 @@
13933++ api-poke-interface
11470++ api-poke-interface
13934 |= [at=path mod=module mark-externals=imark-externals prelude-values=(list term) prelude-molds=(list term) prelude=(unit ifile)]
11471 |= [at=path mod=module mark-externals=imark-externals prelude-values=(list term) prelude-molds=(list term) prelude=(unit ifile)]
13935 ^- (unit ifile)
11472 ^- (unit ifile)
13936− =/ out=(each ifile @t)
11473+ ?: (lien defs.mod def-has-hole) ~
13937− (api-poke-interface-result at mod mark-externals prelude-values prelude-molds prelude)
11474+ ?. ?=([%ui %api @ %jibb ~] at) ~
13938− ?:(?=(%& -.out) `p.out ~)
11475+ ?^ (duplicate-defs defs.mod) ~
13939−::
11476+ ?~ prelude ~
13940−:: The same check, naming the part that stopped it. Each reason says which
11477+ ?. =(at.u.prelude /lib/jibb/prelude/jibb) ~
13941−:: part is outside this fragment and claims no error in the module, except
11478+ =/ poke=(unit ischeme) (find-jibb-mold %poke u.prelude)
13942−:: duplicate definitions, an error the full check reports first, as for
11479+ ?~ poke ~
13943−:: other modules.
11480+ ?. ?=(%union -.typ.u.poke) ~
13944−++ api-poke-interface-result
11481+ ?^ vars.u.poke ~
13945− |= [at=path mod=module mark-externals=imark-externals prelude-values=(list term) prelude-molds=(list term) prelude=(unit ifile)]
13946− ^- (each ifile @t)
13947− ?: (lien defs.mod def-has-hole) [%| 'API holes need unsupported inference']
13948− ?. ?=([%ui %api @ %jibb ~] at) [%| 'API path evidence requires /ui/api/<agent>.jibb']
13949− ?^ (duplicate-defs defs.mod) [%| 'API has duplicate definitions']
13950− ?~ prelude [%| 'API poke prelude needs unsupported inference']
13951− ?. =(at.u.prelude /lib/jibb/prelude/jibb) [%| 'API poke prelude needs unsupported inference']
13952− =/ poke=(unit ischeme) (find-jibb-mold %raw-poke u.prelude)
13953− ?~ poke [%| 'API poke prelude needs unsupported inference']
13954− ?. ?=(%union -.typ.u.poke) [%| 'API poke prelude needs unsupported inference']
13955− ?^ vars.u.poke [%| 'API poke prelude needs unsupported inference']
13956 =/ compatible=?
11482 =/ compatible=?
13957 %+ lien cases.typ.u.poke
11483 %+ lien cases.typ.u.poke
13958 |= c=itype
11484 |= c=itype
13959 ?=([%cell [%const [%term %tas %agent *]] [%cell [%face %agent [%atom %tas]] [%cell [%face %mark [%atom %tas]] [%face %payload [%noun ~]]]]] c)
11485 ?=([%cell [%const [%term %tas %agent *]] [%cell [%face %agent [%atom %tas]] [%cell [%face %mark [%atom %tas]] [%face %payload [%noun ~]]]]] c)
13960− ?. compatible [%| 'API poke prelude needs unsupported inference']
11486+ ?. compatible ~
13961− :: Definitions come before imports so that a module with more than a
11487+ ?. (module-scope-valid mod(defs ~) prelude-values prelude-molds) ~
13962− :: `+$ poke` is not described by its imports.
11488+ ?. (levy imports.mod |=(i=import ?=(%mark -.i))) ~
13963− =/ ds=(list def) defs.mod
13964− ?. ?=([[%mold *] ~] ds) [%| 'poke-only API definitions need unsupported inference']
13965− ?. =(%poke name.i.ds) [%| 'poke-only API definitions need unsupported inference']
13966− ?. (module-scope-valid mod(defs ~) prelude-values prelude-molds) [%| 'API import scope needs unsupported inference']
13967− ?. (levy imports.mod |=(i=import ?=(%mark -.i))) [%| 'poke-only API imports need unsupported inference']
13968 =/ marks=(list term) (collect-mark-imports imports.mod)
11489 =/ marks=(list term) (collect-mark-imports imports.mod)
13969− ?. ?=([@ ~] marks) [%| 'poke-only API mark imports need unsupported inference']
11490+ ?. ?=([@ ~] marks) ~
11491+ =/ ds=(list def) defs.mod
11492+ ?. ?=([[%mold *] ~] ds) ~
11493+ ?. =(%poke name.i.ds) ~
13970 =/ sh=shape shape.i.ds
11494 =/ sh=shape shape.i.ds
13971− ?. ?=([%ref *] sh) [%| 'API poke mold needs unsupported inference']
11495+ ?. ?=([%ref *] sh) ~
13972− ?. ?=([@ ~] names.sh) [%| 'API poke mold needs unsupported inference']
11496+ ?. ?=([@ ~] names.sh) ~
13973 =/ n=term i.names.sh
11497 =/ n=term i.names.sh
13974− ?. (unique-value-name n marks) [%| 'API poke mold needs unsupported inference']
11498+ ?. (unique-value-name n marks) ~
13975− ?: |((lien prelude-values |=(x=term =(n x))) (lien prelude-molds |=(x=term =(n x)))) [%| 'API poke mold needs unsupported inference']
11499+ ?: |((lien prelude-values |=(x=term =(n x))) (lien prelude-molds |=(x=term =(n x)))) ~
13976− =/ results=@ud (lent (skim mark-externals |=(e=[mark=term result=*] =(n mark.e))))
11500+ =/ mark=(unit itype) (find-imported-mark n mark-externals marks)
13977− ?: =(0 results) [%| (crip "API poke mark %{(trip n)} has no reader result")]
11501+ ?~ mark ~
13978− ?. =(1 results) [%| (crip "API poke mark %{(trip n)} has duplicate reader results")]
11502+ =/ sc=ischeme [[%fn u.mark typ.u.poke] ~]
13979− =/ mark=(unit itype) (find-imported-mark-prelude n mark-externals marks u.prelude)
11503+ `[~[[n sc]] (api-mark-exports marks marks mark-externals) at ~[[n i.t.t.at n]] ~ ~ ~ ~]
13980− ?~ mark [%| 'API poke mark reader result needs unsupported inference']
13981− =/ sc=(unit ischeme) (derived-poke-command-scheme u.prelude u.mark)
13982− ?~ sc [%| 'API poke command needs unsupported inference']
13983− [%& [~[[%poke u.sc]] (api-mark-exports marks marks mark-externals u.prelude) at ~[[n i.t.t.at n]] ~ ~ ~ ~]]
13985:: Source-proven ordinary helpers validate each selected /sur dependency.
11505:: Source-proven ordinary helpers validate each selected /sur dependency.
13986:: Unused or less direct cores remain unsupported by this first interface.
11506:: Unused or less direct cores remain unsupported by this first interface.
@@ -14103,1579 +11623,26 @@
14103 [%| 'API exported molds need unsupported inference']
11623 [%| 'API exported molds need unsupported inference']
14104 =/ env=ienv (weld values.u.gates (weld values.u.poke values.support))
11624 =/ env=ienv (weld values.u.gates (weld values.u.poke values.support))
14105 =/ graph=irequest-graph
11625 =/ graph=irequest-graph
14106− [(silt `(list path)`~[file]) requests.u.gates ~ modules `public values.prep molds.prep externals marks]
11626+ [(silt `(list path)`~[file]) requests.u.gates modules `public values.prep molds.prep externals marks]
14107 =/ iface=ifile
11627 =/ iface=ifile
14108 [env exports file derived.u.poke elaborations.support ~ `src `graph]
11628 [env exports file derived.u.poke elaborations.support ~ `src `graph]
14109 [%& [iface dependencies.ev]]
11629 [%& [iface dependencies.ev]]
14111−:: A checked program main is only the direct four-component source call.
14112−:: Grouping is transparent, but aliases, qualified wings and other module
14113−:: kinds remain outside this slice.
14114−++ program-main-def
14118− ?: &(?=(%value -.i.ds) =(%main name.i.ds)) `i.ds
14121−++ program-main-wing
14124− ?: ?=(%group -.e) $(e inner.e)
14125− ?. ?=(%wing -.e) ~
14126− ?. ?=([@ ~] names.e) ~
14129−++ program-main-args
14131− ^- (unit (list expr))
14132− ?. ?=(%value -.d) ~
14134− ?: ?=(%group -.val.d) $(val.d inner.val.d)
14135− ?. ?=(%call -.val.d) ~
14136− =/ head=(unit term) (program-main-wing head.val.d)
14138− ?. =(%program u.head) ~
14139− ?. ?=([* * * * ~] args.val.d) ~
14142−++ program-main-parts
14144− ^- (unit [init=term update=term view=term subs=term])
14145− ?. ?=(%value -.d) ~
14147− ?: ?=(%group -.val.d) $(val.d inner.val.d)
14148− ?. ?=(%call -.val.d) ~
14149− =/ head=(unit term) (program-main-wing head.val.d)
14151− ?. =(%program u.head) ~
14152− ?. ?=([* * * * ~] args.val.d) ~
14153− =/ args=(list expr) args.val.d
14154− ?> ?=([* * * * ~] args)
14155− =/ init=(unit term) (program-main-wing i.args)
14156− =/ update=(unit term) (program-main-wing i.t.args)
14157− =/ view=(unit term) (program-main-wing i.t.t.args)
14158− =/ subs=(unit term) (program-main-wing i.t.t.t.args)
14163− `[u.init u.update u.view u.subs]
14165−:: A data page is only the direct two-component source call. Grouping is
14166−:: transparent, but page aliases, qualified wings and other kinds are not.
14169− ^- (unit [load=term view=term])
14170− ?. ?=(%value -.d) ~
14172− ?: ?=(%group -.val.d) $(val.d inner.val.d)
14173− ?. ?=(%call -.val.d) ~
14174− =/ head=(unit term) (program-main-wing head.val.d)
14176− ?. =(%page u.head) ~
14177− ?. ?=([* * ~] args.val.d) ~
14178− =/ args=(list expr) args.val.d
14179− ?> ?=([* * ~] args)
14180− =/ load=(unit term) (program-main-wing i.args)
14181− =/ view=(unit term) (program-main-wing i.t.args)
14186−:: A store main is only the direct two-wing source call. Its local poke mold
14187−:: is checked here and remains in ordinary mold/value inference.
14188−++ store-main-parts
14190− ^- (unit [init=term update=term])
14191− ?. ?=(%value -.d) ~
14193− ?: ?=(%group -.val.d) $(val.d inner.val.d)
14194− ?. ?=(%call -.val.d) ~
14195− =/ head=(unit term) (program-main-wing head.val.d)
14197− ?. =(%store u.head) ~
14198− ?. ?=([* * ~] args.val.d) ~
14199− =/ args=(list expr) args.val.d
14200− ?> ?=([* * ~] args)
14201− =/ init=(unit term) (program-main-wing i.args)
14202− =/ update=(unit term) (program-main-wing i.t.args)
14205− `[u.init u.update]
14207−+$ istore-declaration [action=term defs=(list def)]
14208−:: A failure carries a diagnostic only when it is a definite error of the
14209−:: source; every other failure is unsupported and carries none.
14210−++ store-declaration
14211− |= [mod=module prelude-values=(list term) prelude-molds=(list term)]
14212− ^- (each istore-declaration (unit idiag))
14213− =/ ds=(list def) defs.mod
14214− =/ pokes=(list def)
14215− (skim ds |=(d=def &(?=(%mold -.d) =(%poke name.d))))
14216− ?. ?=([* ~] pokes) [%| ~]
14217− =/ states=(list def)
14218− (skim ds |=(d=def &(?=(%mold -.d) =(%state name.d))))
14219− ?. ?=([* ~] states) [%| ~]
14220− =/ poke=def i.pokes
14221− =/ state=def i.states
14222− ?> &(?=(%mold -.poke) ?=(%mold -.state))
14223− ?: ?=(%generic -.shape.state) [%| ~]
14224− ?: ?=(%generic -.shape.poke) [%| ~]
14225− =/ action=term %poke
14226− =/ ordinary=(list def) ds
14227− =/ derived=(list term) ~[%state action]
14228− ?: (lien derived reserved-name) [%| ~]
14229− =/ outer=(list term)
14230− (weld prelude-values (weld (global-value-names ordinary) (api-import-faces imports.mod)))
14231− =/ clashes=(list term)
14232− (skip derived |=(n=term &((unique-value-name n derived) !(lien outer |=(x=term =(n x))))))
14233− :: main's `store` is the prelude's builder when the prelude declares it and
14234− :: nothing local takes the name. Only then do the derived names surely
14235− :: exist, and then a clash is an error even where the scope also fails, as
14236− :: for an import face that clashes with both a derived name and its mold.
14238− ?& (lien prelude-values |=(x=term =(x %store)))
14239− !(lien (global-value-names ds) |=(x=term =(x %store)))
14240− !(lien (import-binding-names imports.mod) |=(x=term =(x %store)))
14242− ?: &(?=(^ clashes) builder (lien outer |=(x=term =(x i.clashes))))
14243− =/ from=span ?:(=(%state i.clashes) at.state at.poke)
14244− =/ derived=[at=span note=tape] [from "`{(trip i.clashes)}` is derived from this mold"]
14245− [%| `(derived-name-clash "store" i.clashes ~[derived] mod)]
14246− ?. (module-scope-valid mod prelude-values prelude-molds) [%| ~]
14248− [%& [action ordinary]]
14250−:: A store or API exports names derived from its declarations, and a
14251−:: clashing derived name is an error (grammar, Modules). Show where the name
14252−:: is derived and the definition, import face or other derived name it
14253−:: clashes with; a prelude name has no site in the module.
14254−++ derived-name-clash
14255− |= [kind=tape n=term derived=(list [at=span note=tape]) mod=module]
14257− =/ values=(list span)
14258− (murn defs.mod |=(d=def ?.(&(?=(%value -.d) =(n name.d)) ~ `at.d)))
14259− =/ faces=(list span)
14260− %+ murn imports.mod
14264− %sur ?.(=(n name.i) ~ `at.i)
14265− %jibb ?.(=(n face.i) ~ `at.i)
14267− =/ head=tape "{kind} derived name `{(trip n)}` clashes with"
14269− ["{head} a definition" (weld derived ~[[i.values "clashing definition"]])]
14271− ["{head} an import face" (weld derived ~[[i.faces "clashing import face"]])]
14272− ?: ?=([* * *] derived)
14273− ["{head} another derived name" derived]
14274− ["{head} a prelude name" derived]
14276−++ program-empty-null
14280− %lit =(%null form.lit.e)
14282− %group $(e inner.e)
14283− %body ?~(defs.e $(e final.e) |)
14287−++ program-subs-empty
14290− ?. ?=(%value -.d) |
14292− %gate (program-empty-null body.val.d)
14293− %gate-wide (program-empty-null body.val.d)
14297−++ program-transparent
14301− %group $(e inner.e)
14303− %body ?~(defs.e $(e final.e) e)
14307−:: Recover only the update of an already recognized direct program main.
14308−:: Its written sample determines the message/model relationship; the canonical
14309−:: cmd, unit and update slot determine the result context. Publication is
14310−:: component-local so later subscription/view/initializer retries can accumulate.
14311−++ program-update-context
14312− |= [main=def parts=[init=term update=term view=term subs=term] ds=(list def) resolution=iresolved initial=istate]
14313− ^- (unit iresolved)
14314− =/ env=ienv env.resolution
14315− ?^ (ienv-lookup %main env) ~
14316− ?^ (ienv-lookup update.parts env) ~
14317− =/ updates=(list def)
14318− (skim ds |=(d=def &(?=(%value -.d) =(update.parts name.d))))
14319− ?. ?=([* ~] updates) ~
14320− =/ update-def=def i.updates
14321− ?> ?=(%value -.update-def)
14322− =/ written-update=(unit sample) (direct-gate-sample update-def)
14323− ?~ written-update ~
14324− ?. ?=(%cell -.u.written-update) ~
14325− ?. ?=([* * ~] items.u.written-update) ~
14326− ?~ prelude.initial ~
14327− =/ program=(unit ischeme) (ienv-lookup %program values.u.prelude.initial)
14329− =/ command=(unit ischeme) (find-jibb-mold %cmd u.prelude.initial)
14330− =/ list-template=(unit ischeme) (find-jibb-mold %list u.prelude.initial)
14332− ?~ list-template ~
14333− =/ heads=(unit igate-prelude-evidence) (direct-prelude-evidence ds prelude.initial)
14335− =/ written=(unit def) (~(get by gates.u.heads) %program)
14337− =/ written-sample=(unit sample) (direct-gate-sample u.written)
14338− ?~ written-sample ~
14339− ?. ?=(%cell -.u.written-sample) ~
14340− ?. ?=([* * * * ~] items.u.written-sample) ~
14341− =/ checked=(map term def)
14342− (~(put by (direct-checked-gates ds env)) update.parts update-def)
14344− (turn molds.u.prelude.initial |=(x=[name=term template=ischeme] [name.x template.x]))
14345− =/ fresh=(unit @ud)
14346− (ienv-fresh-id (weld env (weld values.u.prelude.initial templates)))
14348− =. next.initial u.fresh
14349− =/ update-state=istate (reserve-def-caps val.update-def initial)
14350− =/ sam=isample-result (infer-sample u.written-update env update-state)
14352− =/ actual-sample=itype (itype-normalize typ.p.sam sub.state.p.sam)
14353− ?. ?=(%cell -.actual-sample) ~
14354− =/ message=(unit itype)
14355− (direct-slot-body hed.actual-sample (direct-sample-name i.items.u.written-update))
14356− =/ model=(unit itype)
14357− (direct-slot-body tal.actual-sample (direct-sample-name i.t.items.u.written-update))
14360− =/ cmd=(unit itype) (template-apply u.command ~[u.message])
14362− =/ command-result=(unit itype) (template-apply u.list-template ~[u.cmd])
14363− ?~ command-result ~
14364− =/ product=itype [%cell u.model u.command-result]
14365− =/ instance=[typ=itype state=istate] (instantiate-scheme u.program state.p.sam)
14366− ?. ?=(%fn -.typ.instance) ~
14367− ?. ?=(%cell -.sample.typ.instance) ~
14368− ?. ?=(%cell -.tal.sample.typ.instance) ~
14369− =/ expected-update=(unit itype)
14370− (direct-slot-body hed.tal.sample.typ.instance (direct-sample-name i.t.items.u.written-sample))
14371− ?~ expected-update ~
14372− ?. ?=(%fn -.u.expected-update) ~
14373− :: Sample binders are not value faces. Strip only those two slot faces
14374− :: for the invariant canonical-gate proof; the source-faced gate is still
14375− :: used by the complete positional call and final ordinary result cast.
14376− =/ canonical-candidate=itype [%fn [%cell u.message u.model] product]
14378− (direct-invariant canonical-candidate u.expected-update sub.state.instance next.state.instance)
14379− ?. ?=(%ok -.gate-fit) ~
14381− (itype-normalize [%fn typ.p.sam product] sub.gate-fit)
14382− ?. ?=(%fn -.closed) ~
14383− :: The closed product no longer needs the canonical slot substitutions.
14384− :: Start the body at its ordinary sample state so existing branch retries
14385− :: keep their substitution guards, but retain the shared fresh-ID high water.
14386− =/ st=istate state.p.sam(next next.gate-fit, gate-defs checked, head-evidence heads)
14388− ?- -.val.update-def
14389− %gate body.val.update-def
14390− %gate-wide body.val.update-def
14393− =/ inferred=iresult
14394− (infer-call-context-arg body product.closed env.p.sam st (span-of body))
14395− ?: ?=(%| -.inferred) ~
14396− =/ product-fit=ifit
14397− (itype-fit typ.p.inferred product.closed sub.state.p.inferred next.state.p.inferred)
14398− ?. ?=(%ok -.product-fit) ~
14399− =/ merged-product=itype
14400− (itype-merge-faces typ.p.inferred product.closed sub.product-fit)
14401− =/ actual-cast=itype [%fn typ.p.sam merged-product]
14403− (itype-fit actual-cast closed sub.product-fit next.product-fit)
14404− ?. ?=(%ok -.cast) ~
14405− =/ merged=itype (itype-merge-faces actual-cast closed sub.cast)
14406− =/ adjusted=iresult
14407− [%& merged state.p.inferred(sub sub.cast, next next.cast)]
14408− =/ added=(unit iadded-definition)
14409− (add-supported-result update-def adjusted update-state env checked artifacts.resolution)
14411− =/ recovered=(unit ischeme) (ienv-lookup update.parts env.u.added)
14413− ?. ?=(~ vars.u.recovered) ~
14414− ?. ?=(~ (itype-vars typ.u.recovered)) ~
14415− `[env.u.added grouped.resolution artifacts.u.added failures.resolution]
14417−++ program-inferred-slot
14418− |= [typ=itype name=(unit term)]
14421− ?: &(?=(%face -.typ) =(name.typ u.name)) body.typ
14424−++ program-inferred-sample
14425− |= [typ=itype sam=sample]
14427− (program-inferred-slot typ (direct-sample-name sam))
14429−++ program-two-slot-names
14431− ^- (unit [first=(unit term) second=(unit term)])
14434− ?. ?=([* * ~] items.sam) ~
14435− `[(direct-sample-name i.items.sam) (direct-sample-name i.t.items.sam)]
14437− ?. ?=(%cell -.shape.sam) ~
14438− ?. ?=([* * ~] fields.shape.sam) ~
14439− `[(direct-field-name i.fields.shape.sam) (direct-field-name i.t.fields.shape.sam)]
14443−:: Read message/model from the checked update and its written source layout.
14444−:: The source names strip only top-level sample binder faces; nested value
14445−:: faces remain part of the canonical message and model.
14446−++ program-update-relation
14447− |= [name=term ds=(list def) env=ienv]
14448− ^- (unit [message=itype model=itype])
14449− =/ update=(unit ischeme) (ienv-lookup name env)
14451− ?. ?=(~ vars.u.update) ~
14452− ?. ?=(~ (itype-vars typ.u.update)) ~
14453− ?. ?=(%fn -.typ.u.update) ~
14454− ?. ?=(%cell -.sample.typ.u.update) ~
14455− =/ defs=(list def)
14456− (skim ds |=(d=def &(?=(%value -.d) =(name name.d))))
14457− ?. ?=([* ~] defs) ~
14458− =/ written=(unit sample) (direct-gate-sample i.defs)
14460− ?. ?=(%cell -.u.written) ~
14461− ?. ?=([* * ~] items.u.written) ~
14462− =/ message=(unit itype)
14463− (direct-slot-body hed.sample.typ.u.update (direct-sample-name i.items.u.written))
14464− =/ model=(unit itype)
14465− (direct-slot-body tal.sample.typ.u.update (direct-sample-name i.t.items.u.written))
14468− `[u.message u.model]
14470−:: Recover an unannotated direct subscription component from the checked
14471−:: update relation and canonical fourth program slot. This establishes only
14472−:: the value type; the final program watch proof remains separate.
14473−++ program-subs-context
14474− |= [parts=[init=term update=term view=term subs=term] ds=(list def) resolution=iresolved initial=istate]
14475− ^- (unit iresolved)
14476− =/ env=ienv env.resolution
14477− ?^ (ienv-lookup %main env) ~
14478− ?^ (ienv-lookup subs.parts env) ~
14479− =/ relation=(unit [message=itype model=itype])
14480− (program-update-relation update.parts ds env)
14482− =/ subs=(list def)
14483− (skim ds |=(d=def &(?=(%value -.d) =(subs.parts name.d))))
14484− ?. ?=([* ~] subs) ~
14485− =/ subs-def=def i.subs
14486− ?> ?=(%value -.subs-def)
14487− =/ written-subs=(unit sample) (direct-gate-sample subs-def)
14489− ?~ prelude.initial ~
14490− =/ program=(unit ischeme) (ienv-lookup %program values.u.prelude.initial)
14491− =/ sub=(unit ischeme) (find-jibb-mold %sub u.prelude.initial)
14492− =/ list-template=(unit ischeme) (find-jibb-mold %list u.prelude.initial)
14495− ?~ list-template ~
14496− =/ heads=(unit igate-prelude-evidence) (direct-prelude-evidence ds prelude.initial)
14498− =/ written=(unit def) (~(get by gates.u.heads) %program)
14500− =/ written-sample=(unit sample) (direct-gate-sample u.written)
14501− ?~ written-sample ~
14502− ?. ?=(%cell -.u.written-sample) ~
14503− ?. ?=([* * * * ~] items.u.written-sample) ~
14504− =/ checked=(map term def) (direct-checked-gates ds env)
14506− (turn molds.u.prelude.initial |=(x=[name=term template=ischeme] [name.x template.x]))
14507− =/ fresh=(unit @ud)
14508− (ienv-fresh-id (weld env (weld values.u.prelude.initial templates)))
14510− =. next.initial u.fresh
14511− =/ subs-state=istate (reserve-def-caps val.subs-def initial)
14512− =/ sam=isample-result (infer-sample u.written-subs env subs-state)
14514− =/ actual-model=itype (program-inferred-sample typ.p.sam u.written-subs)
14515− ?. ?=(~ (itype-vars actual-model)) ~
14516− ?: (itype-has-tag actual-model) ~
14518− (direct-invariant actual-model model.u.relation sub.state.p.sam next.state.p.sam)
14519− ?. ?=(%ok -.model-fit) ~
14520− =/ message-sub=(unit itype) (template-apply u.sub ~[message.u.relation])
14522− =/ product=(unit itype) (template-apply u.list-template ~[u.message-sub])
14524− =/ instance=[typ=itype state=istate]
14525− (instantiate-scheme u.program state.p.sam(sub sub.model-fit, next next.model-fit))
14526− ?. ?=(%fn -.typ.instance) ~
14527− ?. ?=(%cell -.sample.typ.instance) ~
14528− ?. ?=(%cell -.tal.sample.typ.instance) ~
14529− ?. ?=(%cell -.tal.tal.sample.typ.instance) ~
14530− =/ expected-subs=(unit itype)
14531− (direct-slot-body tal.tal.tal.sample.typ.instance (direct-sample-name i.t.t.t.items.u.written-sample))
14532− ?~ expected-subs ~
14533− ?. ?=(%fn -.u.expected-subs) ~
14534− =/ canonical=itype [%fn model.u.relation u.product]
14536− (direct-invariant canonical u.expected-subs sub.state.instance next.state.instance)
14537− ?. ?=(%ok -.gate-fit) ~
14539− (itype-normalize [%fn typ.p.sam u.product] sub.gate-fit)
14540− ?. ?=(%fn -.closed) ~
14543− %gate body.val.subs-def
14544− %gate-wide body.val.subs-def
14548− state.p.sam(next next.gate-fit, gate-defs checked, head-evidence heads)
14549− =/ inferred=iresult
14550− (infer-call-context-arg body product.closed env.p.sam st (span-of body))
14551− ?: ?=(%| -.inferred) ~
14552− =/ product-fit=ifit
14553− (itype-fit typ.p.inferred product.closed sub.state.p.inferred next.state.p.inferred)
14554− ?. ?=(%ok -.product-fit) ~
14555− =/ merged-product=itype
14556− (itype-merge-faces typ.p.inferred product.closed sub.product-fit)
14557− =/ actual-cast=itype [%fn typ.p.sam merged-product]
14559− (itype-fit actual-cast closed sub.product-fit next.product-fit)
14560− ?. ?=(%ok -.cast) ~
14561− =/ merged=itype (itype-merge-faces actual-cast closed sub.cast)
14562− =/ adjusted=iresult
14563− [%& merged state.p.inferred(sub sub.cast, next next.cast)]
14564− =/ added=(unit iadded-definition)
14565− (add-supported-result subs-def adjusted subs-state env checked artifacts.resolution)
14567− =/ recovered=(unit ischeme) (ienv-lookup subs.parts env.u.added)
14569− ?. ?=(~ vars.u.recovered) ~
14570− ?. ?=(~ (itype-vars typ.u.recovered)) ~
14571− `[env.u.added grouped.resolution artifacts.u.added failures.resolution]
14573−+$ iview-site [xs=expr mapper=term]
14574−++ program-view-site
14576− ^- (unit iview-site)
14577− =. e (program-transparent e)
14578− ?. ?=(%call -.e) ~
14579− ?. ?=([* ~] args.e) ~
14580− =/ each=expr (program-transparent head.e)
14581− ?. ?=(%wing -.each) ~
14582− ?. ?=([%each ~] names.each) ~
14583− =/ turned=expr (program-transparent i.args.e)
14584− ?. ?=(%call -.turned) ~
14585− ?. ?=([* * ~] args.turned) ~
14586− =/ turn=expr (program-transparent head.turned)
14587− ?. ?=(%wing -.turn) ~
14588− ?. ?=([%turn ~] names.turn) ~
14589− =/ xs=expr (program-transparent i.args.turned)
14590− ?. ?=(%wing -.xs) ~
14592− =/ mapper=(unit term) (program-main-wing i.t.args.turned)
14596−++ program-sample-binders
14603− %cell (zing (turn items.sam |=(s=sample (program-sample-binders s))))
14607−++ program-pattern-binders
14612− %cell (zing (turn items.pat |=(p=pattern (program-pattern-binders p))))
14616−++ program-view-sites-merge
14617− |= [a=(unit (list iview-site)) b=(unit (list iview-site))]
14618− ^- (unit (list iview-site))
14623−++ program-view-sites-exprs
14624− |= [xs=(list expr) locals=(list term)]
14625− ^- (unit (list iview-site))
14627− (program-view-sites-merge (program-view-sites i.xs locals) $(xs t.xs))
14629−++ program-view-sites-items
14630− |= [xs=(list item) locals=(list term)]
14631− ^- (unit (list iview-site))
14633− (program-view-sites-merge (program-view-sites val.i.xs locals) $(xs t.xs))
14635−++ program-view-sites-pieces
14636− |= [xs=(list piece) locals=(list term)]
14637− ^- (unit (list iview-site))
14639− =/ here=(unit (list iview-site))
14641− %expr (program-view-sites p.i.xs locals)
14644− (program-view-sites-merge here $(xs t.xs))
14646−++ program-view-sites-qsegs
14647− |= [xs=(list qseg) locals=(list term)]
14648− ^- (unit (list iview-site))
14650− =/ here=(unit (list iview-site))
14652− %expr (program-view-sites p.i.xs locals)
14655− (program-view-sites-merge here $(xs t.xs))
14657−++ program-view-sites-edits
14658− |= [xs=(list edit) locals=(list term)]
14659− ^- (unit (list iview-site))
14661− (program-view-sites-merge (program-view-sites val.i.xs locals) $(xs t.xs))
14663−++ program-view-sites-defs
14664− |= [xs=(list def) locals=(list term)]
14665− ^- (unit (list iview-site))
14667− =/ here=(unit (list iview-site))
14668− ?: ?=(%mold -.i.xs) `~
14669− (program-view-sites val.i.xs locals)
14670− (program-view-sites-merge here $(xs t.xs))
14672−++ program-view-sites-arms
14673− |= [xs=(list arm) locals=(list term)]
14674− ^- (unit (list iview-site))
14676− =/ nested=(list term) (weld (program-pattern-binders pat.i.xs) locals)
14677− (program-view-sites-merge (program-view-sites val.i.xs nested) $(xs t.xs))
14679−++ program-view-sites
14680− |= [e=expr locals=(list term)]
14681− ^- (unit (list iview-site))
14682− =/ site=(unit iview-site) (program-view-site e)
14684− =/ names=(list term) ~[%each %turn mapper.u.site]
14685− ?> ?=(%wing -.xs.u.site)
14686− =/ root=term (rear names.xs.u.site)
14687− ?: |((lien names |=(n=term (lien locals |=(x=term =(n x))))) (lien locals |=(x=term =(root x))))
14691− %str (program-view-sites-pieces pieces.e locals)
14692− %qath (program-view-sites-qsegs segs.e locals)
14693− %change (program-view-sites-edits edits.e locals)
14694− %pair (program-view-sites val.e locals)
14695− %unit (program-view-sites val.e locals)
14696− %group (program-view-sites inner.e locals)
14697− %list (program-view-sites-exprs items.e locals)
14698− %tuple (program-view-sites-items items.e locals)
14700− (program-view-sites body.e (weld (program-sample-binders sample.e) locals))
14702− (program-view-sites body.e (weld (program-sample-binders sample.e) locals))
14704− (program-view-sites-merge (program-view-sites head.e locals) (program-view-sites-exprs args.e locals))
14705− %cast (program-view-sites val.e locals)
14707− (program-view-sites-merge (program-view-sites val.e locals) (program-view-sites then.e locals))
14709− (program-view-sites-merge (program-view-sites subject.e locals) (program-view-sites-arms arms.e locals))
14711− =/ nested=(list term) (weld (global-value-names defs.e) locals)
14712− (program-view-sites-merge (program-view-sites-defs defs.e nested) (program-view-sites final.e nested))
14716−++ program-union-tag-case
14717− |= [expected=itype tag=@]
14719− ?. ?=(%union -.expected) ~
14720− =/ remaining=(list itype) cases.expected
14721− =/ found=(unit itype) ~
14722− =/ seen=(set @) *(set @)
14724− ?~ remaining found
14725− =/ case=itype i.remaining
14727− ?: ?=(%const -.case) `val.literal.case
14728− ?. ?=(%cell -.case) ~
14729− ?. ?=(%const -.hed.case) ~
14730− `val.literal.hed.case
14732− ?: (~(has in:..zuse seen) u.head) ~
14733− =. seen (~(put in:..zuse seen) u.head)
14734− =? found =(tag u.head)
14736− $(remaining t.remaining)
14738−++ program-single-case-fit
14739− |= [actual=itype expected=itype sub=isub next=@ud]
14741− =. actual (itype-normalize actual sub)
14742− =. expected (itype-normalize expected sub)
14743− ?. ?=(%union -.expected) [%unknown ~]
14744− =/ found=(unit itype)
14745− ?: ?=(%const -.actual) `actual
14746− ?: ?=(%tag -.actual) `actual
14747− ?: ?=(%cell -.actual) `actual
14748− ?. ?=(%union -.actual) ~
14749− ?. ?=([* ~] cases.actual) ~
14751− ?~ found [%unknown ~]
14752− =/ case=itype u.found
14754− ?: ?=(%const -.case) `literal.case
14755− ?: ?=(%tag -.case) `literal.case
14756− ?. ?=(%cell -.case) ~
14757− =/ head=itype (projection-field-target hed.case)
14758− ?: ?=(%const -.head) `literal.head
14759− ?: ?=(%tag -.head) `literal.head
14761− ?~ tag [%unknown ~]
14762− =/ chosen=(unit itype) (program-union-tag-case expected val.u.tag)
14763− ?~ chosen [%unknown ~]
14764− ?: |(?=(%const -.case) ?=(%tag -.case))
14765− ?. ?=(%const -.u.chosen) [%unknown ~]
14766− (itype-fit case u.chosen sub next)
14767− ?. ?=(%cell -.case) [%unknown ~]
14768− ?. ?=(%cell -.u.chosen) [%unknown ~]
14769− =/ head-fit=ifit (itype-fit hed.case hed.u.chosen sub next)
14770− ?. ?=(%ok -.head-fit) head-fit
14771− (itype-fit tal.case tal.u.chosen sub.head-fit next.head-fit)
14773−++ program-single-generic-fit
14774− |= [actual=itype expected=itype sub=isub next=@ud]
14776− =. actual (itype-normalize actual sub)
14777− =. expected (itype-normalize expected sub)
14778− ?. &(?=(%union -.actual) ?=(%union -.expected)) [%unknown ~]
14779− ?~ origin.actual [%unknown ~]
14780− ?. =(origin.actual origin.expected) [%unknown ~]
14781− ?. ?=([* ~] args.actual) [%unknown ~]
14782− ?. ?=([* ~] args.expected) [%unknown ~]
14783− =/ argument-fit=ifit (direct-invariant i.args.actual i.args.expected sub next)
14784− ?: ?=(%ok -.argument-fit) argument-fit
14785− (program-single-case-fit i.args.actual i.args.expected sub next)
14787−++ program-keyed-product-fit
14788− |= [actual=itype expected=itype element=ischeme sub=isub next=@ud]
14790− =. actual (itype-normalize actual sub)
14791− =. expected (itype-normalize expected sub)
14792− ?. &(?=(%cell -.actual) ?=(%cell -.expected)) [%unknown ~]
14794− (itype-fit (projection-field-target hed.actual) (projection-field-target hed.expected) sub next)
14795− ?. ?=(%ok -.key-fit) key-fit
14796− =/ actual-el=itype
14797− (itype-normalize (projection-field-target tal.actual) sub.key-fit)
14798− =/ expected-el=itype
14799− (itype-normalize (projection-field-target tal.expected) sub.key-fit)
14800− ?. &(?=(%union -.actual-el) ?=(%union -.expected-el)) [%unknown ~]
14801− ?. =(origin.actual-el origin.expected-el) [%unknown ~]
14802− ?. ?=([* ~] args.actual-el) [%unknown ~]
14803− ?. ?=([* ~] args.expected-el) [%unknown ~]
14804− =/ canonical-actual=(unit itype)
14805− (template-apply element ~[i.args.actual-el])
14806− =/ canonical-expected=(unit itype)
14807− (template-apply element ~[i.args.expected-el])
14808− ?~ canonical-actual [%unknown ~]
14809− ?~ canonical-expected [%unknown ~]
14810− =/ actual-check=ifit
14811− (direct-invariant actual-el u.canonical-actual sub.key-fit next.key-fit)
14812− ?. ?=(%ok -.actual-check) actual-check
14813− =/ expected-check=ifit
14814− (direct-invariant expected-el u.canonical-expected sub.actual-check next.actual-check)
14815− ?. ?=(%ok -.expected-check) expected-check
14817− (program-single-case-fit i.args.actual-el i.args.expected-el sub.expected-check next.expected-check)
14820−:: A direct view without a keyed each/turn site still needs the message type
14821−:: from the checked update. Recover only that closed component; final main
14822−:: checking remains the canonical program-kind boundary.
14823−++ program-plain-view-context
14824− |= [parts=[init=term update=term view=term subs=term] ds=(list def) resolution=iresolved initial=istate]
14825− ^- (unit iresolved)
14826− =/ env=ienv env.resolution
14827− ?^ (ienv-lookup %main env) ~
14828− ?^ (ienv-lookup view.parts env) ~
14829− =/ relation=(unit [message=itype model=itype])
14830− (program-update-relation update.parts ds env)
14832− =/ views=(list def)
14833− (skim ds |=(d=def &(?=(%value -.d) =(view.parts name.d))))
14834− ?. ?=([* ~] views) ~
14835− =/ view-def=def i.views
14836− ?> ?=(%value -.view-def)
14837− =/ written-view=(unit sample) (direct-gate-sample view-def)
14841− %gate body.val.view-def
14842− %gate-wide body.val.view-def
14845− =/ sites=(unit (list iview-site)) (program-view-sites body ~)
14848− ?~ prelude.initial ~
14849− ?~ (ienv-lookup %program values.u.prelude.initial) ~
14850− =/ element=(unit ischeme) (find-jibb-mold %element u.prelude.initial)
14852− =/ heads=(unit igate-prelude-evidence) (direct-prelude-evidence ds prelude.initial)
14854− ?~ (~(get by gates.u.heads) %program) ~
14855− =/ checked=(map term def) (direct-checked-gates ds env)
14857− (turn molds.u.prelude.initial |=(x=[name=term template=ischeme] [name.x template.x]))
14858− =/ fresh=(unit @ud)
14859− (ienv-fresh-id (weld env (weld values.u.prelude.initial templates)))
14861− =. next.initial u.fresh
14862− =/ view-state=istate (reserve-def-caps val.view-def initial)
14863− =/ sam=isample-result (infer-sample u.written-view env view-state)
14865− =/ actual-model=itype (program-inferred-sample typ.p.sam u.written-view)
14866− ?. ?=(~ (itype-vars actual-model)) ~
14867− ?: (itype-has-tag actual-model) ~
14869− (direct-invariant actual-model model.u.relation sub.state.p.sam next.state.p.sam)
14870− ?. ?=(%ok -.model-fit) ~
14871− =/ product=(unit itype) (template-apply u.element ~[message.u.relation])
14874− state.p.sam(sub sub.model-fit, next next.model-fit, gate-defs checked, head-evidence heads)
14875− =/ inferred=iresult
14876− (infer-call-context-arg body u.product env.p.sam st (span-of body))
14877− ?: ?=(%| -.inferred) ~
14878− =/ product-fit=ifit
14879− (itype-fit typ.p.inferred u.product sub.state.p.inferred next.state.p.inferred)
14880− ?. ?=(%ok -.product-fit) ~
14881− =/ merged-product=itype
14882− (itype-merge-faces typ.p.inferred u.product sub.product-fit)
14883− =/ actual-cast=itype [%fn typ.p.sam merged-product]
14884− =/ closed=itype [%fn typ.p.sam u.product]
14886− (itype-fit actual-cast closed sub.product-fit next.product-fit)
14887− ?. ?=(%ok -.cast) ~
14888− =/ merged=itype (itype-merge-faces actual-cast closed sub.cast)
14889− =/ adjusted=iresult
14890− [%& merged state.p.inferred(sub sub.cast, next next.cast)]
14891− =/ added=(unit iadded-definition)
14892− (add-supported-result view-def adjusted view-state env checked artifacts.resolution)
14894− =/ recovered=(unit ischeme) (ienv-lookup view.parts env.u.added)
14896− ?. ?=(~ vars.u.recovered) ~
14897− ?. ?=(~ (itype-vars typ.u.recovered)) ~
14898− `[env.u.added grouped.resolution artifacts.u.added failures.resolution]
14900−:: Recover exactly one direct keyed each/turn row mapper, then its view.
14901−:: The prelude's own each and turn schemes determine the mapper gate: the
14902−:: key is inferred from the mapper body, never selected by this recovery.
14903−++ program-view-context
14904− |= [parts=[init=term update=term view=term subs=term] ds=(list def) resolution=iresolved initial=istate]
14905− ^- (unit iresolved)
14906− =/ env=ienv env.resolution
14907− ?^ (ienv-lookup %main env) ~
14908− ?^ (ienv-lookup view.parts env) ~
14909− =/ relation=(unit [message=itype model=itype])
14910− (program-update-relation update.parts ds env)
14912− =/ views=(list def)
14913− (skim ds |=(d=def &(?=(%value -.d) =(view.parts name.d))))
14914− ?. ?=([* ~] views) ~
14915− =/ view-def=def i.views
14916− ?> ?=(%value -.view-def)
14917− =/ written-view=(unit sample) (direct-gate-sample view-def)
14921− %gate body.val.view-def
14922− %gate-wide body.val.view-def
14925− =/ sites=(unit (list iview-site)) (program-view-sites view-body ~)
14927− ?. ?=([* ~] u.sites) ~
14928− =/ site=iview-site i.u.sites
14929− =/ component-names=(list term) ~[init.parts update.parts view.parts subs.parts]
14930− ?: (lien component-names |=(n=term =(n mapper.site))) ~
14931− ?^ (ienv-lookup mapper.site env) ~
14932− =/ mappers=(list def)
14933− (skim ds |=(d=def &(?=(%value -.d) =(mapper.site name.d))))
14934− ?. ?=([* ~] mappers) ~
14935− =/ mapper-def=def i.mappers
14936− ?> ?=(%value -.mapper-def)
14937− =/ written-mapper=(unit sample) (direct-gate-sample mapper-def)
14938− ?~ written-mapper ~
14939− ?~ prelude.initial ~
14940− =/ program=(unit ischeme) (ienv-lookup %program values.u.prelude.initial)
14941− =/ each-scheme=(unit ischeme) (ienv-lookup %each values.u.prelude.initial)
14942− =/ turn-scheme=(unit ischeme) (ienv-lookup %turn values.u.prelude.initial)
14943− =/ element=(unit ischeme) (find-jibb-mold %element u.prelude.initial)
14944− =/ list-template=(unit ischeme) (find-jibb-mold %list u.prelude.initial)
14949− ?~ list-template ~
14950− =/ heads=(unit igate-prelude-evidence) (direct-prelude-evidence ds prelude.initial)
14952− =/ written-program=(unit def) (~(get by gates.u.heads) %program)
14953− =/ written-each=(unit def) (~(get by gates.u.heads) %each)
14954− =/ written-turn=(unit def) (~(get by gates.u.heads) %turn)
14955− ?~ written-program ~
14958− =/ program-sample=(unit sample) (direct-gate-sample u.written-program)
14959− =/ each-sample=(unit sample) (direct-gate-sample u.written-each)
14960− =/ turn-sample=(unit sample) (direct-gate-sample u.written-turn)
14961− ?~ program-sample ~
14964− ?. ?=(%cell -.u.program-sample) ~
14965− ?. ?=([* * * * ~] items.u.program-sample) ~
14966− =/ turn-names=(unit [first=(unit term) second=(unit term)])
14967− (program-two-slot-names u.turn-sample)
14969− =/ checked=(map term def) (direct-checked-gates ds env)
14971− (turn molds.u.prelude.initial |=(x=[name=term template=ischeme] [name.x template.x]))
14972− =/ fresh=(unit @ud)
14973− (ienv-fresh-id (weld env (weld values.u.prelude.initial templates)))
14975− =. next.initial u.fresh
14976− =/ view-state=istate (reserve-def-caps val.view-def initial)
14977− =/ sam=isample-result (infer-sample u.written-view env view-state)
14979− =/ actual-model=itype (program-inferred-sample typ.p.sam u.written-view)
14981− (direct-invariant actual-model model.u.relation sub.state.p.sam next.state.p.sam)
14982− ?. ?=(%ok -.model-fit) ~
14983− =/ xs-result=iresult
14984− (infer-fragment xs.site env.p.sam state.p.sam(sub sub.model-fit, next next.model-fit))
14985− ?: ?=(%| -.xs-result) ~
14986− =/ element-var=itype [%var next.state.p.xs-result]
14987− =/ list-a=(unit itype) (template-apply u.list-template ~[element-var])
14990− (itype-fit typ.p.xs-result u.list-a sub.state.p.xs-result +(next.state.p.xs-result))
14991− ?. ?=(%ok -.xs-fit) ~
14992− =/ closed-xs=itype (itype-normalize u.list-a sub.xs-fit)
14993− ?^ (itype-vars closed-xs) ~
14994− ?: (itype-has-tag closed-xs) ~
14995− =/ each-instance=[typ=itype state=istate]
14996− (instantiate-scheme u.each-scheme state.p.xs-result(sub sub.xs-fit, next next.xs-fit))
14997− ?. ?=(%fn -.typ.each-instance) ~
14998− =/ turn-instance=[typ=itype state=istate]
14999− (instantiate-scheme u.turn-scheme state.each-instance)
15000− ?. ?=(%fn -.typ.turn-instance) ~
15001− ?. ?=(%cell -.sample.typ.turn-instance) ~
15002− =/ element-message=(unit itype)
15003− (template-apply u.element ~[message.u.relation])
15004− ?~ element-message ~
15006− (itype-fit product.typ.each-instance u.element-message sub.state.turn-instance next.state.turn-instance)
15007− ?. ?=(%ok -.each-fit) ~
15008− =/ each-input=itype
15009− (program-inferred-sample sample.typ.each-instance u.each-sample)
15011− (itype-fit product.typ.turn-instance each-input sub.each-fit next.each-fit)
15012− ?. ?=(%ok -.turn-fit) ~
15013− =/ turn-list=itype
15014− (program-inferred-slot hed.sample.typ.turn-instance first.u.turn-names)
15016− (itype-fit closed-xs turn-list sub.turn-fit next.turn-fit)
15017− ?. ?=(%ok -.list-fit) ~
15018− =/ mapper-type=itype
15019− (program-inferred-slot tal.sample.typ.turn-instance second.u.turn-names)
15020− =/ expected-mapper=itype (itype-normalize mapper-type sub.list-fit)
15021− ?. ?=(%fn -.expected-mapper) ~
15022− ?^ (itype-vars sample.expected-mapper) ~
15023− ?: (itype-has-tag sample.expected-mapper) ~
15024− :: These faces come from the source-backed each sample. Keeping them in
15025− :: the expected mapper product lets ordinary tuple inference supply key/el.
15026− ?. ?=(%cell -.product.expected-mapper) ~
15027− ?. ?=(%face -.hed.product.expected-mapper) ~
15028− ?. =(%key name.hed.product.expected-mapper) ~
15029− ?. ?=(%face -.tal.product.expected-mapper) ~
15030− ?. =(%el name.tal.product.expected-mapper) ~
15031− =/ mapper-state=istate
15032− (reserve-def-caps val.mapper-def initial(next next.list-fit))
15033− =/ mapper-sam=isample-result (infer-sample u.written-mapper env mapper-state)
15034− ?: ?=(%| -.mapper-sam) ~
15035− =/ mapper-input=itype (program-inferred-sample typ.p.mapper-sam u.written-mapper)
15036− =/ mapper-sample-fit=ifit
15037− (direct-invariant mapper-input sample.expected-mapper sub.state.p.mapper-sam next.state.p.mapper-sam)
15038− ?. ?=(%ok -.mapper-sample-fit) ~
15039− =/ mapper-product=itype
15040− (itype-normalize product.expected-mapper sub.mapper-sample-fit)
15041− =/ mapper-body=expr
15042− ?- -.val.mapper-def
15043− %gate body.val.mapper-def
15044− %gate-wide body.val.mapper-def
15047− =/ mapper-inferred=iresult
15048− (infer-call-context-arg mapper-body mapper-product env.p.mapper-sam state.p.mapper-sam(sub sub.mapper-sample-fit, next next.mapper-sample-fit) (span-of mapper-body))
15049− ?: ?=(%| -.mapper-inferred) ~
15050− =/ ordinary-product-fit=ifit
15051− (itype-fit typ.p.mapper-inferred mapper-product sub.state.p.mapper-inferred next.state.p.mapper-inferred)
15052− =/ mapper-product-fit=ifit
15053− ?: ?=(%ok -.ordinary-product-fit) ordinary-product-fit
15054− (program-keyed-product-fit typ.p.mapper-inferred mapper-product u.element sub.state.p.mapper-inferred next.state.p.mapper-inferred)
15055− ?. ?=(%ok -.mapper-product-fit) ~
15056− =/ closed-mapper-product=itype
15057− (itype-normalize mapper-product sub.mapper-product-fit)
15058− ?^ (itype-vars closed-mapper-product) ~
15059− ?: (itype-has-tag closed-mapper-product) ~
15060− =/ merged-mapper-product=itype
15061− (itype-merge-faces typ.p.mapper-inferred closed-mapper-product sub.mapper-product-fit)
15062− =/ mapper-cast=itype [%fn typ.p.mapper-sam merged-mapper-product]
15063− =/ closed-mapper=itype [%fn typ.p.mapper-sam closed-mapper-product]
15064− =/ mapper-cast-fit=ifit
15065− (itype-fit mapper-cast closed-mapper sub.mapper-product-fit next.mapper-product-fit)
15066− ?. ?=(%ok -.mapper-cast-fit) ~
15067− =/ merged-mapper=itype
15068− (itype-merge-faces mapper-cast closed-mapper sub.mapper-cast-fit)
15069− =/ mapper-adjusted=iresult
15070− [%& merged-mapper state.p.mapper-inferred(sub sub.mapper-cast-fit, next next.mapper-cast-fit)]
15071− =/ mapper-added=(unit iadded-definition)
15072− (add-supported-result mapper-def mapper-adjusted mapper-state env checked artifacts.resolution)
15074− =/ mapper-scheme=(unit ischeme) (ienv-lookup mapper.site env.u.mapper-added)
15075− ?~ mapper-scheme ~
15076− ?. ?=(~ vars.u.mapper-scheme) ~
15077− ?. ?=(~ (itype-vars typ.u.mapper-scheme)) ~
15078− =/ program-instance=[typ=itype state=istate]
15079− (instantiate-scheme u.program state.p.sam(next next.mapper-cast-fit))
15080− ?. ?=(%fn -.typ.program-instance) ~
15081− ?. ?=(%cell -.sample.typ.program-instance) ~
15082− ?. ?=(%cell -.tal.sample.typ.program-instance) ~
15083− ?. ?=(%cell -.tal.tal.sample.typ.program-instance) ~
15084− =/ expected-view=(unit itype)
15085− (direct-slot-body hed.tal.tal.sample.typ.program-instance (direct-sample-name i.t.t.items.u.program-sample))
15086− ?~ expected-view ~
15087− ?. ?=(%fn -.u.expected-view) ~
15088− =/ canonical-view=itype [%fn model.u.relation u.element-message]
15090− (direct-invariant canonical-view u.expected-view sub.state.program-instance next.state.program-instance)
15091− ?. ?=(%ok -.view-fit) ~
15092− =/ closed-view=itype
15093− (itype-normalize [%fn typ.p.sam u.element-message] sub.view-fit)
15094− ?. ?=(%fn -.closed-view) ~
15095− =/ view-env=ienv [[mapper.site u.mapper-scheme] env.p.sam]
15096− =/ final-view-state=istate
15097− (reserve-def-caps val.view-def state.p.sam(next next.view-fit, gate-defs checked.u.mapper-added, head-evidence heads))
15098− =/ inferred=iresult
15099− (infer-call-context-arg view-body product.closed-view view-env final-view-state (span-of view-body))
15100− ?: ?=(%| -.inferred) ~
15101− =/ product-fit=ifit
15102− (itype-fit typ.p.inferred product.closed-view sub.state.p.inferred next.state.p.inferred)
15103− ?. ?=(%ok -.product-fit) ~
15104− =/ merged-product=itype
15105− (itype-merge-faces typ.p.inferred product.closed-view sub.product-fit)
15106− =/ actual-cast=itype [%fn typ.p.sam merged-product]
15108− (itype-fit actual-cast closed-view sub.product-fit next.product-fit)
15109− ?. ?=(%ok -.cast) ~
15110− =/ merged=itype (itype-merge-faces actual-cast closed-view sub.cast)
15111− =/ adjusted=iresult
15112− [%& merged state.p.inferred(sub sub.cast, next next.cast)]
15113− =/ added=(unit iadded-definition)
15114− (add-supported-result view-def adjusted final-view-state env.u.mapper-added checked.u.mapper-added artifacts.u.mapper-added)
15116− =/ recovered=(unit ischeme) (ienv-lookup view.parts env.u.added)
15118− ?. ?=(~ vars.u.recovered) ~
15119− ?. ?=(~ (itype-vars typ.u.recovered)) ~
15120− `[env.u.added grouped.resolution artifacts.u.added failures.resolution]
15122−:: The model a direct program's initializer must produce. Update's written
15123−:: two-item sample gives it when it can be read. Otherwise main's own program
15124−:: fit does: update, view and subs are fitted together against the prelude
15125−:: program's sample, as main's call will fit them, with the initializer an
15126−:: open variable. Only the initializer's data may stay open, a replay of the
15127−:: fit must not move, and the model must come out closed and tag-free.
15128−++ program-init-model
15129− |= [main=def parts=[init=term update=term view=term subs=term] ds=(list def) env=ienv program=ischeme program-def=def initial=istate]
15131− =/ relation=(unit [message=itype model=itype])
15132− (program-update-relation update.parts ds env)
15133− ?^ relation `model.u.relation
15134− =/ args=(unit (list expr)) (program-main-args main)
15136− =/ written=(unit sample) (direct-gate-sample program-def)
15138− ?. ?=(%cell -.u.written) ~
15139− ?~ items.u.written ~
15140− =/ update=(unit ischeme) (ienv-lookup update.parts env)
15141− =/ view=(unit ischeme) (ienv-lookup view.parts env)
15142− =/ subs=(unit ischeme) (ienv-lookup subs.parts env)
15146− =/ instance=[typ=itype state=istate] (instantiate-scheme program initial)
15147− ?. ?=(%fn -.typ.instance) ~
15148− ?. ?=(%cell -.sample.typ.instance) ~
15149− =/ expected-init=(unit itype)
15150− (direct-slot-body hed.sample.typ.instance (direct-sample-name i.items.u.written))
15151− ?~ expected-init ~
15152− ?. ?=(%fn -.u.expected-init) ~
15153− ?. ?=(%var -.sample.u.expected-init) ~
15154− =/ data=@ud id.sample.u.expected-init
15155− =/ init-var=itype [%var next.state.instance]
15156− =/ up=[typ=itype state=istate]
15157− (instantiate-scheme u.update state.instance(next +(next.state.instance)))
15158− =/ vw=[typ=itype state=istate] (instantiate-scheme u.view state.up)
15159− =/ sb=[typ=itype state=istate] (instantiate-scheme u.subs state.vw)
15160− =/ st=istate state.sb
15161− =/ actual=itype [%cell init-var [%cell typ.up [%cell typ.vw typ.sb]]]
15163− (direct-positional-fit u.args items.u.written actual sample.typ.instance env st sub.st next.st)
15164− ?. ?=(%ok -.fit) ~
15165− =/ actual-final=itype (itype-normalize actual sub.fit)
15166− =/ expected-final=itype (itype-normalize sample.typ.instance sub.fit)
15167− =/ open=(list @ud)
15168− (unique-type-vars (weld (itype-vars actual-final) (itype-vars expected-final)))
15169− ?. (levy open |=(n=@ud =(data n))) ~
15170− ?: |((itype-has-tag actual-final) (itype-has-tag expected-final)) ~
15172− (direct-positional-fit u.args items.u.written actual sample.typ.instance env st sub.fit next.fit)
15173− ?. ?=(%ok -.replay) ~
15174− ?. &(=(sub.fit sub.replay) =(next.fit next.replay)) ~
15175− =/ expected=itype (itype-normalize u.expected-init sub.fit)
15176− ?. ?=(%fn -.expected) ~
15177− ?^ (itype-vars product.expected) ~
15180−:: The product of an initializer inferred ordinarily, as a whole gate with no
15181−:: expected type, for a body that context inference cannot take, such as a
15182−:: branch over a nested call's union. Its sample must fit the written one.
15183−++ program-init-ordinary
15184− |= [init-def=def env=ienv sample=itype state=istate]
15186− ?> ?=(%value -.init-def)
15187− =/ gate=iresult (infer-fragment val.init-def env state)
15188− =? gate ?=(%| -.gate) (infer-recursive-gate init-def env state)
15189− ?: ?=(%| -.gate) gate
15190− ?. ?=(%fn -.typ.p.gate) [%| ["initializer is not a gate" ~]]
15192− (itype-fit sample.typ.p.gate sample sub.state.p.gate next.state.p.gate)
15193− ?. ?=(%ok -.fit) [%| ["initializer sample differs" ~]]
15194− [%& product.typ.p.gate state.p.gate(sub sub.fit, next next.fit)]
15196−:: Recover a direct program's initializer once update, view and
15197−:: subscriptions are resolved: its body is inferred against their closed
15198−:: model (+program-init-model), under its own closed written sample. This one
15199−:: path replaced a separate retry for bodies ending in null and a gate that
15200−:: took only a null sample, so any body and any closed sample check the same
15201−:: way (review question 8). The fresh ordinary main inference afterwards
15202−:: checks that all four components agree.
15203−++ program-plain-init-context
15204− |= [main=def parts=[init=term update=term view=term subs=term] ds=(list def) resolution=iresolved initial=istate]
15205− ^- (unit iresolved)
15206− =/ env=ienv env.resolution
15207− ?^ (ienv-lookup %main env) ~
15208− ?^ (ienv-lookup init.parts env) ~
15209− ?~ (ienv-lookup update.parts env) ~
15210− ?~ (ienv-lookup view.parts env) ~
15211− ?~ (ienv-lookup subs.parts env) ~
15212− =/ inits=(list def)
15213− (skim ds |=(d=def &(?=(%value -.d) =(init.parts name.d))))
15214− ?. ?=([* ~] inits) ~
15215− =/ init-def=def i.inits
15216− ?> ?=(%value -.init-def)
15217− =/ written=(unit sample) (direct-gate-sample init-def)
15221− %gate body.val.init-def
15222− %gate-wide body.val.init-def
15225− ?~ prelude.initial ~
15226− =/ program=(unit ischeme) (ienv-lookup %program values.u.prelude.initial)
15228− =/ heads=(unit igate-prelude-evidence) (direct-prelude-evidence ds prelude.initial)
15230− =/ program-def=(unit def) (~(get by gates.u.heads) %program)
15232− =/ checked=(map term def) (direct-checked-gates ds env)
15234− (turn molds.u.prelude.initial |=(x=[name=term template=ischeme] [name.x template.x]))
15235− =/ fresh=(unit @ud)
15236− (ienv-fresh-id (weld env (weld values.u.prelude.initial templates)))
15238− =. next.initial u.fresh
15239− =/ model=(unit itype)
15240− %: program-init-model
15241− main parts ds env u.program u.program-def
15242− initial(gate-defs checked, head-evidence heads)
15245− =/ init-state=istate (reserve-def-caps val.init-def initial)
15246− =/ sam=isample-result (infer-sample u.written env init-state)
15248− ?. ?=(~ (itype-vars typ.p.sam)) ~
15249− ?: (itype-has-tag typ.p.sam) ~
15250− =/ st=istate state.p.sam(gate-defs checked, head-evidence heads)
15251− =/ contextual=iresult
15252− (infer-call-context-arg body u.model env.p.sam st (span-of body))
15253− =/ inferred=iresult
15254− ?: ?=(%& -.contextual) contextual
15255− (program-init-ordinary init-def env typ.p.sam init-state(gate-defs checked, head-evidence heads))
15256− ?: ?=(%| -.inferred) ~
15257− =/ product-fit=ifit
15258− (itype-fit typ.p.inferred u.model sub.state.p.inferred next.state.p.inferred)
15259− ?. ?=(%ok -.product-fit) ~
15260− =/ merged-product=itype
15261− (itype-merge-faces typ.p.inferred u.model sub.product-fit)
15262− =/ actual-cast=itype [%fn typ.p.sam merged-product]
15263− =/ closed=itype [%fn typ.p.sam u.model]
15265− (itype-fit actual-cast closed sub.product-fit next.product-fit)
15266− ?. ?=(%ok -.cast) ~
15267− =/ merged=itype (itype-merge-faces actual-cast closed sub.cast)
15268− =/ adjusted=iresult
15269− [%& merged state.p.inferred(sub sub.cast, next next.cast)]
15270− =/ added=(unit iadded-definition)
15271− (add-supported-result init-def adjusted init-state env checked artifacts.resolution)
15273− =/ recovered=(unit ischeme) (ienv-lookup init.parts env.u.added)
15275− ?. ?=(~ vars.u.recovered) ~
15276− ?. ?=(~ (itype-vars typ.u.recovered)) ~
15277− `[env.u.added grouped.resolution artifacts.u.added failures.resolution]
15279−++ derived-poke-command-scheme
15280− |= [prelude=ifile action=itype]
15282− =/ prep=iprelude [prelude ~ ~]
15283− =/ raw=(unit ischeme) (compatible-raw-poke prep)
15285− =/ command=(unit ischeme) (find-jibb-mold %cmd prelude)
15286− =/ unit-template=(unit ischeme) (find-jibb-mold %unit prelude)
15288− ?~ unit-template ~
15289− ?. (standard-unit-template u.unit-template /lib/jibb/prelude/jibb) ~
15290− ?. ?=([@ ~] vars.u.command) ~
15291− ?. ?=(%union -.typ.u.command) ~
15292− ?. =(origin.typ.u.command `[/lib/jibb/prelude/jibb %cmd]) ~
15293− ?. (identity-union-parameters vars.u.command args.typ.u.command) ~
15294− =/ m=@ud i.vars.u.command
15295− ?: (itype-var-is-atom m typ.u.command) ~
15296− ?. (levy (itype-vars typ.u.command) |=(n=@ud =(n m))) ~
15297− ?: (itype-has-tag typ.u.command) ~
15298− =/ error=(unit itype) (template-apply u.unit-template ~[[%atom %t]])
15300− ?. ?=(%union -.typ.u.raw) ~
15301− =/ poke-case=itype
15302− [%cell [%const [%term %tas %poke '%poke']] [%cell [%face %p typ.u.raw(label `'raw-poke')] [%face %reply [%fn u.error [%var m]]]]]
15304− [%cell [%const [%term %tas %go '%go']] [%face %url [%atom %t]]]
15305− =/ wait-case=itype
15306− [%cell [%const [%term %tas %wait '%wait']] [%cell [%face %gap [%atom %dr]] [%face %msg [%var m]]]]
15308− [%cell [%const [%term %tas %now '%now']] [%face %reply [%fn [%atom %da] [%var m]]]]
15310− [%cell [%const [%term %tas %who '%who']] [%face %reply [%fn [%atom %p] [%var m]]]]
15311− ?. =(cases.typ.u.command ~[poke-case go-case wait-case now-case who-case]) ~
15312− =/ command-result=(unit itype) (template-apply u.command ~[[%var 0]])
15313− ?~ command-result ~
15314− `[[%fn [%cell action [%fn u.error [%var 0]]] u.command-result] ~[0]]
15316−++ store-derived-schemes
15317− |= [prelude=ifile values=(list term) molds=(list term) state=itype action=itype]
15318− ^- (unit [state=ischeme action=ischeme])
15319− =/ prep=iprelude [prelude values molds]
15320− =/ ask=(unit ischeme) (request-compatible-ask prep)
15322− ?^ (itype-vars state) ~
15323− ?^ (itype-vars action) ~
15324− ?: |((itype-has-tag state) (itype-has-tag action)) ~
15325− =/ result=(unit itype) (template-apply u.ask ~[[%var 0]])
15327− =/ request=ischeme [[%fn [%fn state [%var 0]] u.result] ~[0]]
15328− =/ constructor=(unit ischeme) (derived-poke-command-scheme prelude action)
15330− `[request u.constructor]
15332−++ program-subs-watch
15333− |= [d=def imports=ijimports graph=irequest-graph prelude=ifile]
15335− ?. ?=(%value -.d) |
15336− ?. |(?=(%gate -.val.d) ?=(%gate-wide -.val.d)) |
15340− %gate-wide body.val.d
15343− =. body (program-transparent body)
15344− ?. ?=(%list -.body) |
15345− ?. ?=([* ~] items.body) |
15346− =/ watch=expr (program-transparent i.items.body)
15347− ?. ?=(%tuple -.watch) |
15348− ?. ?=([* * ~] items.watch) |
15349− =/ tag=item i.items.watch
15350− =/ payload=item i.t.items.watch
15351− ?. &(?=(~ face.tag) ?=(~ face.payload)) |
15352− =/ tag-expr=expr (program-transparent val.tag)
15353− ?. ?=(%lit -.tag-expr) |
15354− ?. &(?=(%term form.lit.tag-expr) =(%watch val.lit.tag-expr)) |
15355− =/ request=expr (program-transparent val.payload)
15356− ?. ?=(%call -.request) |
15357− ?. ?=([* ~] args.request) |
15358− =/ head=expr (program-transparent head.request)
15359− ?. ?=(%wing -.head) |
15360− ?. ?=([@ @ ~] names.head) |
15361− =/ case=term i.names.head
15362− =/ face=term i.t.names.head
15363− =/ callback=expr (program-transparent i.args.request)
15364− ?. ?=(%ctor -.callback) |
15365− ?. ?=(%term form.tag.callback) |
15366− ?| ?=(^ (derived-request-member case face imports graph prelude))
15367− ?=(^ (derived-store-request-member case face imports graph prelude))
15370−:: Exact derived-member and request-evidence identity, shared by direct
15371−:: program watches and direct data-page loads. Only a plain request in the
15372−:: selected interface's own source-backed graph can establish this shape.
15373−++ derived-request-member
15374− |= [case=term face=term imports=ijimports graph=irequest-graph prelude=ifile]
15376− =/ selected=(list [face=term interface=ifile])
15377− (skim imports |=(j=[face=term interface=ifile] =(face face.j)))
15378− ?. ?=([* ~] selected) ~
15379− =/ iface=ifile interface.i.selected
15380− =/ member=(unit ischeme) (ienv-lookup case values.iface)
15383− =/ evidence=(list irequest-evidence)
15384− (skim requests.graph |=(r=irequest-evidence &(=(api-at.r at.iface) =(name.r case))))
15385− ?. ?=([* ~] evidence) ~
15386− =/ request-evidence=irequest-evidence i.evidence
15387− ?. =(u.source.iface api-source.request-evidence) ~
15388− ?. =(name.path.path.request-evidence case) ~
15390− ?. (lien requests.u.graph.iface |=(r=irequest-evidence =(r request-evidence))) ~
15391− ?. ?=(~ scry.path.path.request-evidence) ~
15392− ?. &(?=(~ diffs.path.request-evidence) ?=(~ diffs.path.path.request-evidence)) ~
15393− ?: (lien segments.path.path.request-evidence |=(p=pseg !?=(%knot -.p))) ~
15394− ?. ?=([@ ~] vars.u.member) ~
15395− =/ message=@ud i.vars.u.member
15396− ?. ?=(%fn -.typ.u.member) ~
15397− ?. ?=(%fn -.sample.typ.u.member) ~
15398− ?. =(sample.sample.typ.u.member full.path.request-evidence) ~
15399− ?. =(product.sample.typ.u.member [%var message]) ~
15400− =/ prep=iprelude [prelude prelude-values.graph prelude-molds.graph]
15401− =/ ask=(unit ischeme) (request-compatible-ask prep)
15403− =/ result=(unit itype) (template-apply u.ask ~[[%var message]])
15405− ?. =(product.typ.u.member u.result) ~
15408−:: Store state is watchable by definition, but only the actual derived member
15409−:: of the uniquely selected source-bound store interface proves that fact.
15410−++ derived-store-request-member
15411− |= [case=term face=term imports=ijimports graph=irequest-graph prelude=ifile]
15413− ?. =(%state case) ~
15414− =/ selected=(list [face=term interface=ifile])
15415− (skim imports |=(j=[face=term interface=ifile] =(face face.j)))
15416− ?. ?=([* ~] selected) ~
15417− =/ iface=ifile interface.i.selected
15418− =/ member=(unit ischeme) (ienv-lookup %state values.iface)
15421− =/ evidence=(list istore-request-evidence)
15422− (skim stores.graph |=(r=istore-request-evidence =(store-at.r at.iface)))
15423− ?. ?=([* ~] evidence) ~
15424− =/ request=istore-request-evidence i.evidence
15425− ?. =(u.source.iface source.request) ~
15427− ?. (lien stores.u.graph.iface |=(r=istore-request-evidence =(r request))) ~
15428− =/ derived=(unit [state=ischeme action=ischeme])
15429− (store-derived-schemes prelude prelude-values.graph prelude-molds.graph state.request action.request)
15431− ?. =(u.member state.u.derived) ~
15432− =/ constructor=(unit ischeme) (ienv-lookup action-name.request values.iface)
15434− ?. =(u.constructor action.u.derived) ~
15437−++ program-main-context
15438− |= [main=def ds=(list def) resolution=iresolved initial=istate]
15440− ?^ (ienv-lookup %main env.resolution) resolution
15441− =/ heads=(unit igate-prelude-evidence)
15442− (direct-prelude-evidence ds prelude.initial)
15443− ?~ heads resolution
15444− =/ checked=(map term def) (direct-checked-gates ds env.resolution)
15445− =/ completed=[env=ienv artifacts=(list iwidth-definition) failures=(list [name=term diag=idiag])]
15446− (add-supported-defs-core ~[main] checked heads env.resolution molds.initial globals.initial externals.initial surs.initial mark-externals.initial marks.initial jimports.initial reserved-molds.initial at.initial prelude.initial artifacts.resolution grec-index.initial)
15447− [env.completed grouped.resolution artifacts.completed failures.resolution]
15449−:: A static main may retain a generic element message in its ordinary
15450−:: scheme. Instantiate that scheme, specialize it to canonical element !!,
15451−:: and publish only the resulting closed scheme.
15452−++ static-main-specialized
15453− |= [env=ienv prelude=(unit ifile)]
15456− =/ element=(unit ischeme) (find-jibb-mold %element u.prelude)
15458− =/ main=(unit ischeme) (ienv-lookup %main env)
15460− =/ canonical=(unit itype) (template-apply u.element ~[[%empty ~]])
15462− =/ instance=[typ=itype state=istate] (instantiate-scheme u.main *istate)
15463− =/ fit=ifit (itype-fit typ.instance u.canonical ~ next.state.instance)
15464− ?. ?=(%ok -.fit) ~
15465− =/ closed=itype (itype-normalize typ.instance sub.fit)
15466− ?^ (itype-vars closed) ~
15467− ?: (itype-has-tag closed) ~
15468− ?. ?=(%union -.closed) ~
15469− ?. ?=(%union -.u.canonical) ~
15470− ?. &(=(origin.closed origin.u.canonical) =(args.closed args.u.canonical)) ~
15471− =/ exact=ifit (direct-invariant closed u.canonical ~ next.fit)
15472− ?. ?=(%ok -.exact) ~
15475−:: The load of a direct data page must itself be a direct gate whose
15476−:: transparent body is one plain derived request with a wing or ctor reply.
15477−++ page-load-derived
15478− |= [name=term ds=(list def) imports=ijimports graph=irequest-graph prelude=ifile]
15480− =/ loads=(list def)
15481− (skim ds |=(d=def &(?=(%value -.d) =(name name.d))))
15482− ?. ?=([* ~] loads) |
15483− =/ load=def i.loads
15484− ?> ?=(%value -.load)
15485− ?. |(?=(%gate -.val.load) ?=(%gate-wide -.val.load)) |
15488− %gate body.val.load
15489− %gate-wide body.val.load
15492− =. body (program-transparent body)
15493− ?. ?=(%call -.body) |
15494− ?. ?=([* ~] args.body) |
15495− =/ head=expr (program-transparent head.body)
15496− ?. ?=(%wing -.head) |
15497− ?. ?=([@ @ ~] names.head) |
15498− =/ reply=expr (program-transparent i.args.body)
15499− ?. ?| &(?=(%wing -.reply) ?=([@ ~] names.reply))
15500− &(?=(%ctor -.reply) ?=(%term form.tag.reply))
15503− ?=(^ (derived-request-member i.names.head i.t.names.head imports graph prelude))
15505−++ page-main-closed
15506− |= [parts=[load=term view=term] ds=(list def) env=ienv prelude=(unit ifile) imports=ijimports graph=irequest-graph]
15509− =/ page=(unit ischeme) (find-jibb-mold %page u.prelude)
15511− =/ main=(unit ischeme) (ienv-lookup %main env)
15513− ?. ?=(~ vars.u.main) |
15514− ?. ?=(~ (itype-vars typ.u.main)) |
15515− =/ instance=[typ=itype state=istate] (instantiate-scheme u.page *istate)
15516− =/ main-fit=ifit (direct-invariant typ.u.main typ.instance ~ next.state.instance)
15517− ?. ?=(%ok -.main-fit) |
15518− (page-load-derived load.parts ds imports graph u.prelude)
15520−++ program-main-closed
15521− |= [parts=[init=term update=term view=term subs=term] ds=(list def) env=ienv prelude=(unit ifile) imports=ijimports graph=irequest-graph]
15524− ?~ (ienv-lookup %program values.u.prelude) |
15525− =/ program=(unit ischeme) (find-jibb-mold %program u.prelude)
15527− =/ main=(unit ischeme) (ienv-lookup %main env)
15529− ?. ?=(~ vars.u.main) |
15530− ?. ?=(~ (itype-vars typ.u.main)) |
15531− =/ instance=[typ=itype state=istate] (instantiate-scheme u.program *istate)
15532− =/ main-fit=ifit (direct-invariant typ.u.main typ.instance ~ next.state.instance)
15533− ?. ?=(%ok -.main-fit) |
15534− =/ init=(unit ischeme) (ienv-lookup init.parts env)
15536− ?. ?=(~ vars.u.init) |
15537− ?. ?=(%fn -.typ.u.init) |
15538− ?. ?=(~ (itype-vars sample.typ.u.init)) |
15539− ?. ?=(~ (itype-vars product.typ.u.init)) |
15540− =/ data=igate-free (gate-free-type sample.typ.u.init 256 ~)
15541− ?. =(%yes verdict.data) |
15542− =/ model=igate-free (gate-free-type product.typ.u.init left.data ~)
15543− ?. =(%yes verdict.model) |
15544− =/ subs=(list def)
15545− (skim ds |=(d=def &(?=(%value -.d) =(subs.parts name.d))))
15546− ?. ?=([* ~] subs) |
15547− |((program-subs-empty i.subs) (program-subs-watch i.subs imports graph u.prelude))
15549−:: The two outer sample faces are binder names, not part of the action/state
15550−:: relation. Leave every face inside either component untouched.
15551−++ store-update-unfaced
15554− ?. ?=(%fn -.typ) typ
15555− ?. ?=(%cell -.sample.typ) typ
15556− =/ head=itype hed.sample.typ
15557− =/ tail=itype tal.sample.typ
15558− =? head ?=(%face -.head) body.head
15559− =? tail ?=(%face -.tail) body.tail
15560− typ(sample [%cell head tail])
15562−:: The builder erases the action from main. Recover it only from the local
15563−:: poke mold and check both ordinary components invariantly.
15564−++ store-main-closed
15565− |= [parts=[init=term update=term] action=term env=ienv molds=imold-types prelude=(unit ifile)]
15568− =/ builder=(unit ischeme) (ienv-lookup %store values.u.prelude)
15570− ?. ?=([@ @ ~] vars.u.builder) ~
15571− =/ state-var=@ud i.vars.u.builder
15572− =/ action-var=@ud i.t.vars.u.builder
15573− ?: =(state-var action-var) ~
15574− =/ builder-sample=itype
15575− [%cell [%face %init [%var state-var]] [%face %update [%fn [%cell [%var action-var] [%var state-var]] [%var state-var]]]]
15576− =/ builder-product=itype [%cell [%face %init [%var state-var]] [%face %update [%noun ~]]]
15577− ?. =(typ.u.builder [%fn builder-sample builder-product]) ~
15578− =/ store=(unit ischeme) (find-jibb-mold %store u.prelude)
15580− ?. ?=([@ ~] vars.u.store) ~
15581− ?. =(typ.u.store [%cell [%face %init [%var i.vars.u.store]] [%face %update [%noun ~]]]) ~
15582− =/ state=(unit ischeme) (find-jibb-mold %state [~ molds /tmp ~ ~ ~ ~ ~])
15584− =/ action-mold=(unit ischeme) (find-jibb-mold action [~ molds /tmp ~ ~ ~ ~ ~])
15586− ?. &(?=(~ vars.u.state) ?=(~ (itype-vars typ.u.state))) ~
15587− ?. &(?=(~ vars.u.action-mold) ?=(~ (itype-vars typ.u.action-mold))) ~
15588− =/ canonical=(unit itype) (template-apply u.store ~[typ.u.state])
15590− =/ main=(unit ischeme) (ienv-lookup %main env)
15591− =/ main-fit=(unit ifit)
15592− ?~(main ~ `(direct-invariant typ.u.main u.canonical ~ 0))
15595− ?. ?=(~ vars.u.main) |
15596− ?. ?=(~ (itype-vars typ.u.main)) |
15598− ?=(%ok -.u.main-fit)
15600− =/ init=(unit ischeme) (ienv-lookup init.parts env)
15602− ?. ?=(~ vars.u.init) ~
15603− ?. ?=(~ (itype-vars typ.u.init)) ~
15604− =/ init-fit=ifit (direct-invariant typ.u.init typ.u.state ~ 0)
15605− ?. ?=(%ok -.init-fit) ~
15606− =/ update=(unit ischeme) (ienv-lookup update.parts env)
15608− ?. ?=(~ vars.u.update) ~
15609− ?. ?=(~ (itype-vars typ.u.update)) ~
15610− =/ expected=itype [%fn [%cell typ.u.action-mold typ.u.state] typ.u.state]
15611− =/ update-fit=ifit (direct-invariant (store-update-unfaced typ.u.update) expected ~ 0)
15612− ?. ?=(%ok -.update-fit) ~
15615++ infer-jibb-file
11631++ infer-jibb-file
15616 |= [at=path src=@t externals=iexternals mark-externals=imark-externals modules=jbundle active=(list path) prelude-values=(list term) prelude-molds=(list term) cache=jcache prelude=(unit ifile)]
11632 |= [at=path src=@t externals=iexternals mark-externals=imark-externals modules=jbundle active=(list path) prelude-values=(list term) prelude-molds=(list term) cache=jcache prelude=(unit ifile)]
15617 ^- jfile-result
11633 ^- jfile-result
15618− =/ out=jfile-detailed-result
15619− (infer-jibb-file-detailed at src externals mark-externals modules active prelude-values prelude-molds cache prelude)
15620− ?: ?=(%| -.out) [%| message.p.out]
15622−:: Returns structured root-source overlap evidence after the same full check.
15623−++ infer-jibb-file-detailed
15624− |= [at=path src=@t externals=iexternals mark-externals=imark-externals modules=jbundle active=(list path) prelude-values=(list term) prelude-molds=(list term) cache=jcache prelude=(unit ifile)]
15625− ^- jfile-detailed-result
15626 =/ parsed (parse at src)
11634 =/ parsed (parse at src)
15627− ?: ?=(%| -.parsed) [%| [(crip "module source does not parse: {(spud at)}") ~]]
11635+ ?: ?=(%| -.parsed) [%| (crip "module source does not parse: {(spud at)}")]
15628 =/ mod=module p.parsed
11636 =/ mod=module p.parsed
15629 =/ duplicate=(unit idiag) (duplicate-defs defs.mod)
11637 =/ duplicate=(unit idiag) (duplicate-defs defs.mod)
15630− ?^ duplicate [%| [(show-duplicate-fields at src u.duplicate) ~]]
11638+ ?^ duplicate [%| (show-duplicate-fields at src u.duplicate)]
15631− ?: &(?=([%ui %api *] at) ?=(^ (program-main-def defs.mod)))
15632− [%| [(crip "module kind needs unsupported inference: {(spud at)}") ~]]
15633 ?: ?=([%ui %api *] at)
11639 ?: ?=([%ui %api *] at)
15634− =/ poke=(each ifile @t)
11640+ =/ iface=(unit ifile) (api-poke-interface at mod mark-externals prelude-values prelude-molds prelude)
15635− (api-poke-interface-result at mod mark-externals prelude-values prelude-molds prelude)
11641+ ?^ iface
15636− ?: ?=(%& -.poke)
11642+ =/ checked=ifile u.iface(source `src, graph `[(silt `(list path)`~[at]) ~ modules prelude prelude-values prelude-molds externals mark-externals])
15637− =/ iface=ifile p.poke
15638− =/ checked=ifile iface(source `src, graph `[(silt `(list path)`~[at]) ~ ~ modules prelude prelude-values prelude-molds externals mark-externals])
15639 [%& [checked [[at checked] cache]]]
11643 [%& [checked [[at checked] cache]]]
15640− :: A clashing derived name is an error wherever the checks below stop.
11644+ ?~ prelude [%| (crip "API module needs unsupported inference: {(spud at)}")]
15641− =/ clash=(unit idiag)
15642− ?. ?=([%ui %api @ %jibb ~] at) ~
15643− (api-derived-clash mod prelude-values)
15644− ?^ clash [%| [(show-duplicate-fields at src u.clash) ~]]
15645− :: So is a name conflict in its scope, reported as for other modules.
15646− :: `+$ paths` and `+$ poke` are declarations, not molds (overview), and
15647− :: a `/%` mark names a mold, so it conflicts only with another mark or
15648− :: mold: `/% %todos` beside the request `todos` is the usual API.
15649− =/ ordinary=(list def)
15650− (skim defs.mod |=(d=def !&(?=(%mold -.d) |(=(%paths name.d) =(%poke name.d)))))
15651− =/ marks=(list term) (collect-mark-imports imports.mod)
15652− =/ mold-names=(list term)
15653− (turn (collect-simple-molds ordinary) |=(m=[name=term body=shape] name.m))
15654− =/ faces=(list import) (skip imports.mod |=(i=import ?=(%mark -.i)))
15655− ?. ?& (module-scope-valid mod(defs ordinary, imports faces) prelude-values prelude-molds)
15658− ?& (unique-value-name n marks)
15659− !(lien mold-names |=(m=term =(m n)))
15660− !(lien prelude-molds |=(m=term =(m n)))
15663− =/ scope=(unit iscope-diagnostic)
15664− (module-scope-diagnostic mod(defs ordinary, imports faces) prelude-values prelude-molds)
15665− ?^ scope [%| [(show-scope-diagnostic at src u.scope prelude) ~]]
15666− [%| [(crip "module has conflicting names: {(spud at)}") ~]]
15667− ?~ prelude [%| [(crip "API module needs unsupported inference: {(spud at)}") ~]]
15668 =/ prepared=iprelude [u.prelude prelude-values prelude-molds]
11645 =/ prepared=iprelude [u.prelude prelude-values prelude-molds]
15669− :: A failing Jibb import gives its own error, which may be definite, as
15670− :: it does for other modules; the constructors below would only wrap it.
15671− :: They resolve the same imports again, from the interfaces cached here.
15672− =/ js=jimports-detailed-result
15673− (resolve-jibb-imports-detailed imports.mod externals mark-externals modules active prelude-values prelude-molds cache prelude)
15674− ?: ?=(%| -.js) [%| p.js]
15675− :: Without `+$ paths` only the poke-only interface applies; keep its reason.
15676− ?. (lien defs.mod |=(d=def &(?=(%mold -.d) =(%paths name.d))))
15677− [%| [(crip "API module needs unsupported inference: {(spud at)}: {(trip p.poke)}") ~]]
15678− :: Each constructor names the part that stopped it; keep that reason.
15679 =/ narrow=?
11646 =/ narrow=?
15680 ?. ?=([[%mark *] ~] imports.mod) |
11647 ?. ?=([[%mark *] ~] imports.mod) |
15681 ?. ?=([[%mold *] ~] defs.mod) |
11648 ?. ?=([[%mold *] ~] defs.mod) |
@@ -15683,168 +11650,39 @@
15683 !?=(%union -.shape.i.defs.mod)
11650 !?=(%union -.shape.i.defs.mod)
15684 ?: narrow
11651 ?: narrow
15685 =/ request=(each ione-request-interface @t)
11652 =/ request=(each ione-request-interface @t)
15686− (one-request-interface-graph at src externals mark-externals modules active cache.p.js `prepared)
11653+ (one-request-interface-graph at src externals mark-externals modules active cache `prepared)
15687− ?: ?=(%| -.request) [%| [(crip "API module needs unsupported inference: {(spud at)}: {(trip p.request)}") ~]]
11654+ ?: ?=(%| -.request) [%| (crip "API module needs unsupported inference: {(spud at)}")]
15688 =/ checked=ifile iface.p.request
11655 =/ checked=ifile iface.p.request
15689 [%& [checked [[at checked] dependencies.paths.support.p.request]]]
11656 [%& [checked [[at checked] dependencies.paths.support.p.request]]]
15690 =/ multi=(each [iface=ifile cache=jcache] @t)
11657 =/ multi=(each [iface=ifile cache=jcache] @t)
15691− (multi-request-interface-graph at src externals mark-externals modules active cache.p.js `prepared)
11658+ (multi-request-interface-graph at src externals mark-externals modules active cache `prepared)
15692− ?: ?=(%| -.multi) [%| [(crip "API module needs unsupported inference: {(spud at)}: {(trip p.multi)}") ~]]
11659+ ?: ?=(%| -.multi) [%| (crip "API module needs unsupported inference: {(spud at)}")]
15693 [%& [iface.p.multi [[at iface.p.multi] cache.p.multi]]]
11660 [%& [iface.p.multi [[at iface.p.multi] cache.p.multi]]]
15694− =/ main=(unit def) (program-main-def defs.mod)
11661+ ?. (module-scope-valid mod prelude-values prelude-molds)
15695− =/ main-parts=(unit [init=term update=term view=term subs=term])
11662+ ?: (pending-declared-poke at mod prelude-values prelude-molds)
15696− ?~(main ~ (program-main-parts u.main))
11663+ [%| (crip "module kind or scope needs unsupported inference: {(spud at)}")]
15697− =/ page-parts=(unit [load=term view=term])
11664+ [%| (crip "module has conflicting names: {(spud at)}")]
15698− ?~(main ~ (page-main-parts u.main))
11665+ =/ vals=(list term) (global-value-names defs.mod)
15699− =/ store-parts=(unit [init=term update=term])
11666+ ?: (lien vals |=(n=term =(n %main)))
15700− ?~(main ~ (store-main-parts u.main))
11667+ [%| (crip "module kind needs unsupported inference: {(spud at)}")]
15701− =/ declaration=(each istore-declaration (unit idiag))
11668+ =/ js=jimports-result (resolve-jibb-imports imports.mod externals mark-externals modules active prelude-values prelude-molds cache prelude)
15702− ?~(store-parts [%| ~] (store-declaration mod prelude-values prelude-molds))
15703− =/ clash=(unit idiag) ?:(?=(%| -.declaration) p.declaration ~)
15704− ?^ clash [%| [(show-duplicate-fields at src u.clash) ~]]
15705− =/ declared=(unit istore-declaration)
15706− ?:(?=(%| -.declaration) ~ `p.declaration)
15707− ?: &(?=(^ store-parts) ?=(~ declared))
15708− [%| [(crip "module kind or scope needs unsupported inference: {(spud at)}") ~]]
15709− ?: &(?=([%ui %stores *] at) ?=(^ main) ?=(~ store-parts))
15710− [%| [(crip "module kind needs unsupported inference: {(spud at)}") ~]]
15711− =/ ds=(list def) ?~(declared defs.mod defs.u.declared)
15712− =/ checking=module mod(defs ds)
15713− ?. (module-scope-valid checking prelude-values prelude-molds)
15714− =/ scope=(unit iscope-diagnostic)
15715− (module-scope-diagnostic checking prelude-values prelude-molds)
15716− ?^ scope [%| [(show-scope-diagnostic at src u.scope prelude) ~]]
15717− [%| [(crip "module has conflicting names: {(spud at)}") ~]]
15718− =/ vals=(list term) (global-value-names ds)
15719− =/ js=jimports-detailed-result (resolve-jibb-imports-detailed imports.mod externals mark-externals modules active prelude-values prelude-molds cache prelude)
15720 ?: ?=(%| -.js) [%| p.js]
11669 ?: ?=(%| -.js) [%| p.js]
15721− =/ collected=grec-collected
11670+ =/ molds=imolds (collect-simple-molds defs.mod)
15722− ?^ imports.mod [(collect-simple-molds ds) *(map term shape)]
15723− (grec-collect-molds ds)
15724− =/ molds=imolds molds.collected
15725 =/ globals=(list term) (weld prelude-values (weld (import-binding-names imports.mod) vals))
11671 =/ globals=(list term) (weld prelude-values (weld (import-binding-names imports.mod) vals))
15726 =/ surs=(list term) (collect-sur-imports imports.mod)
11672 =/ surs=(list term) (collect-sur-imports imports.mod)
15727 =/ marks=(list term) (collect-mark-imports imports.mod)
11673 =/ marks=(list term) (collect-mark-imports imports.mod)
15728 =/ reserved=(list term) (weld prelude-molds (turn resolved.p.js |=(j=[face=term interface=ifile] face.j)))
11674 =/ reserved=(list term) (weld prelude-molds (turn resolved.p.js |=(j=[face=term interface=ifile] face.j)))
15729 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
11675 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
15730− =/ state=istate [0 ~ ~ ~ molds globals externals surs mark-externals marks resolved.p.js reserved ~ ~ ~ | at top prelude ~ 256 ~ ~ ~ ~ ~ ~]
11676+ =/ state=istate [0 ~ ~ ~ molds globals externals surs mark-externals marks resolved.p.js reserved ~ ~ ~ | at top prelude ~ 256 ~ ~ ~]
15731− :: Source and scope were checked above; preserve that exact root and prelude.
11677+ =/ mts=(each imold-types @t) (module-mold-types molds state)
15732− :: This first integration only indexes import-free library sources.
11678+ ?: ?=(%| -.mts) [%| (crip "{(trip p.mts)}: {(spud at)}")]
15733− =/ index=(unit [at=path source=@t prelude=ifile shapes=(map term shape)])
11679+ =/ resolution=iresolved (resolve-groups defs.mod molds globals externals surs mark-externals marks resolved.p.js reserved at prelude)
15736− =/ standard=(unit ischeme) (find-jibb-mold %list u.prelude)
15738− ?. =(u.standard [[%collection %list ~[[%var 0]]] ~[0]]) ~
15739− =/ index=(map term shape) proofs.collected
15740− ?. !=(index *(map term shape)) ~
15741− ?: (lien molds |=(m=[name=term body=shape] =(%list name.m))) ~
15742− `[at src u.prelude index]
15743− =. grec-index.state index
15744− =/ mts=(each imold-types imold-failure) (module-mold-types-detail molds state)
15746− ?~ overlap.p.mts [%| [(crip "{(trip message.p.mts)}: {(spud at)}") ~]]
15747− =/ witness=[name=term cases=upair] u.overlap.p.mts
15748− =/ first=@t (show-error src [at line.beg.first.cases.witness col.beg.first.cases.witness "first union case"])
15749− =/ second=@t (show-error src [at line.beg.second.cases.witness col.beg.second.cases.witness "overlapping case"])
15750− =/ msg=@t (of-wain:format ~[(crip "module mold {(trip name.witness)} has overlapping cases") first second])
15751− [%| [msg `[at src name.witness cases.witness]]]
15752− =/ resolution=iresolved
15754− (resolve-groups ds molds globals externals surs mark-externals marks resolved.p.js reserved at prelude)
15755− (resolve-groups-core ds molds globals externals surs mark-externals marks resolved.p.js reserved at prelude index)
15756 =/ env=ienv env.resolution
11680 =/ env=ienv env.resolution
15757− =/ recovered=iresolved
11681+ ?. (module-values-complete defs.mod env)
15758− ?~ main resolution
11682+ [%| (crip "module definitions need unsupported inference: {(spud at)}")]
15759− ?~ main-parts resolution
11683+ =/ initial=irequest-graph [(silt `(list path)`~[at]) ~ modules prelude prelude-values prelude-molds externals mark-externals]
15760− =/ updated=(unit iresolved)
15761− (program-update-context u.main u.main-parts ds resolution state)
15762− =/ with-update=iresolved ?~(updated resolution u.updated)
15763− =/ subscribed=(unit iresolved)
15764− (program-subs-context u.main-parts ds with-update state)
15765− =/ with-subs=iresolved ?~(subscribed with-update u.subscribed)
15766− =/ viewed=(unit iresolved)
15767− (program-view-context u.main-parts ds with-subs state)
15768− =/ with-keyed-view=iresolved ?~(viewed with-subs u.viewed)
15769− =/ plain-view=(unit iresolved)
15770− ?^(viewed ~ (program-plain-view-context u.main-parts ds with-keyed-view state))
15771− =/ with-view=iresolved ?~(plain-view with-keyed-view u.plain-view)
15772− =/ initialized=(unit iresolved)
15773− (program-plain-init-context u.main u.main-parts ds with-view state)
15774− =/ components=iresolved ?~(initialized with-view u.initialized)
15775− (program-main-context u.main ds components state)
15776− =. env env.recovered
15777− =. artifacts.resolution artifacts.recovered
15779− ?: (module-values-complete ds env) env
15780− ?: |(?=([%ui %stores *] at) ?=(^ imports.mod) ?=(^ prelude) ?=(^ prelude-values) ?=(^ prelude-molds)) env
15781− ?: (gth (met 3 src) 65.536) env
15782− ?: (gth (lent ds) 64) env
15783− ?. (dg-source-candidate ds 64) env
15784− =/ transaction=(unit dgcommit) (dg-root-source at src)
15785− ?~ transaction env
15786− ?: (dg-interface-safe env.u.transaction) env.u.transaction
15788− =/ required=(list def)
15790− (skim ds |=(d=def !&(?=(%value -.d) =(%main name.d))))
15791− ?. (module-values-complete required env)
15792− =/ components=icomponents (graph-components required (global-value-names required))
15793− =/ ordered=(list def) (dependency-order required components)
15794− =/ values=(list term) (weld prelude-values (weld (api-import-faces imports.mod) vals))
15795− =/ checked=(map term def) (direct-checked-gates required env)
15796− =/ heads=(unit igate-prelude-evidence) (direct-prelude-evidence required prelude.state)
15797− =/ diagnostic=(unit @t)
15798− (module-unresolved-diagnostic ordered env state checked heads failures.resolution values at src 64)
15799− ?^ diagnostic [%| [u.diagnostic ~]]
15800− =/ missing=(unit term) (module-missing-value required env)
15801− =/ named=tape ?~(missing "" ": ++ {(trip u.missing)}")
15802− [%| [(crip "module definitions need unsupported inference: {(spud at)}{named}") ~]]
15803− =/ initial=irequest-graph [(silt `(list path)`~[at]) ~ ~ modules prelude prelude-values prelude-molds externals mark-externals]
15804 =/ graph=(unit irequest-graph) (request-graph-merge resolved.p.js initial (add 1 (lent resolved.p.js)))
11684 =/ graph=(unit irequest-graph) (request-graph-merge resolved.p.js initial (add 1 (lent resolved.p.js)))
15805− ?~ graph [%| ['module request evidence needs unsupported inference' ~]]
11685+ ?~ graph [%| 'module request evidence needs unsupported inference']
15806− =/ static-main=(unit ischeme)
15811− (static-main-specialized env prelude)
15812− =? env ?=(^ static-main)
15813− [[%main u.static-main] (skim env |=(entry=[name=term scheme=ischeme] !=(%main name.entry)))]
15814− =/ store-main=(unit ischeme)
15817− (store-main-closed u.store-parts action.u.declared env p.mts prelude)
15818− =? env ?=(^ store-main)
15819− [[%main u.store-main] (skim env |=(entry=[name=term scheme=ischeme] !=(%main name.entry)))]
15822− ?^ main-parts (program-main-closed u.main-parts ds env prelude resolved.p.js u.graph)
15823− ?^ page-parts (page-main-closed u.page-parts ds env prelude resolved.p.js u.graph)
15824− ?^ store-parts ?=(^ store-main)
15827− [%| [(crip "module kind needs unsupported inference: {(spud at)}") ~]]
15828− =/ store-derived=(unit [values=ienv evidence=istore-request-evidence])
15831− =/ state=(unit ischeme) (find-jibb-mold %state [~ p.mts at ~ ~ ~ ~ ~])
15833− =/ action-mold=(unit ischeme) (find-jibb-mold action.u.declared [~ p.mts at ~ ~ ~ ~ ~])
15835− =/ schemes=(unit [state=ischeme action=ischeme])
15836− (store-derived-schemes u.prelude prelude-values prelude-molds typ.u.state typ.u.action-mold)
15838− =/ evidence=istore-request-evidence
15839− [at src typ.u.state action.u.declared typ.u.action-mold]
15840− `[~[[%state state.u.schemes] [action.u.declared action.u.schemes]] evidence]
15841− ?: &(?=(^ declared) ?=(~ store-derived))
15842− [%| [(crip "store derived gates need unsupported inference: {(spud at)}") ~]]
15843− =? env ?=(^ store-derived) (weld values.u.store-derived env)
15844− =? graph ?=(^ store-derived)
15845− `u.graph(stores [evidence.u.store-derived stores.u.graph])
15846− ?. (request-graph-bounded u.graph)
15847− [%| ['module request evidence needs unsupported inference' ~]]
15848 =/ iface=ifile [env p.mts at ~ artifacts.resolution ~ `src graph]
11686 =/ iface=ifile [env p.mts at ~ artifacts.resolution ~ `src graph]
15849 [%& [iface [[at iface] cache.p.js]]]
11687 [%& [iface [[at iface] cache.p.js]]]
@@ -15891,7 +11729,7 @@
15891 =/ declared=(list term) (collect-mark-imports imports.mod)
11729 =/ declared=(list term) (collect-mark-imports imports.mod)
15892 =/ reserved=(list term) (weld molds.u.prepared (turn resolved.p.js |=(j=[face=term interface=ifile] face.j)))
11730 =/ reserved=(list term) (weld molds.u.prepared (turn resolved.p.js |=(j=[face=term interface=ifile] face.j)))
15893 =/ top=(list term) (turn ms |=(m=[name=term body=shape] name.m))
11731 =/ top=(list term) (turn ms |=(m=[name=term body=shape] name.m))
15894− =/ state=istate [0 ~ ~ ~ ms globals externals surs marks declared resolved.p.js reserved ~ ~ ~ | file top `public ~ 256 ~ ~ ~ ~ ~ ~]
11732+ =/ state=istate [0 ~ ~ ~ ms globals externals surs marks declared resolved.p.js reserved ~ ~ ~ | file top `public ~ 256 ~ ~ ~]
15895 =/ inferred=(unit [template=ischeme state=istate])
11733 =/ inferred=(unit [template=ischeme state=istate])
15896 (infer-mold-template shape.i.selected state(active ~[name], in-mold &))
11734 (infer-mold-template shape.i.selected state(active ~[name], in-mold &))
15897 ?~ inferred [%| 'selected mold needs unsupported inference']
11735 ?~ inferred [%| 'selected mold needs unsupported inference']
@@ -15954,13 +11792,15 @@
15954 =/ prelude-molds=(list term) molds.u.prepared
11792 =/ prelude-molds=(list term) molds.u.prepared
15955 =/ iface=(unit ifile) `iface.u.prepared
11793 =/ iface=(unit ifile) `iface.u.prepared
15956 ?. (module-scope-valid p.parsed prelude-values prelude-molds)
11794 ?. (module-scope-valid p.parsed prelude-values prelude-molds)
11795+ ?: (pending-declared-poke file p.parsed prelude-values prelude-molds)
11796+ 'partial inference; module not checked\0amodule kind or scope needs unsupported inference'
15957 'partial inference; module not checked\0amodule has conflicting names'
11797 'partial inference; module not checked\0amodule has conflicting names'
15958 =/ js=jimports-result
11798 =/ js=jimports-result
15959 (resolve-jibb-imports imports.p.parsed externals mark-externals modules ~[file] prelude-values prelude-molds ~ iface)
11799 (resolve-jibb-imports imports.p.parsed externals mark-externals modules ~[file] prelude-values prelude-molds ~ iface)
15960 ?: ?=(%| -.js) (of-wain:format ~['partial inference; module not checked' p.js])
11800 ?: ?=(%| -.js) (of-wain:format ~['partial inference; module not checked' p.js])
15961 =/ scope-values=(list term)
11801 =/ scope-values=(list term)
15962 (weld prelude-values (weld (collect-sur-imports imports.p.parsed) (collect-mark-imports imports.p.parsed)))
11802 (weld prelude-values (weld (collect-sur-imports imports.p.parsed) (collect-mark-imports imports.p.parsed)))
15963− (golden-types-in-context-core file src externals mark-externals resolved.p.js scope-values prelude-molds iface prepared)
11803+ (golden-types-in-context file src externals mark-externals resolved.p.js scope-values prelude-molds iface)
15965:: +golden-types-with-marks: supply declared mark types separately from /sur
11805:: +golden-types-with-marks: supply declared mark types separately from /sur
15966:: entries, as [mark result] with the result from +read-mark:jibb-import.
11806:: entries, as [mark result] with the result from +read-mark:jibb-import.
@@ -15991,17 +11831,13 @@
15991++ golden-types-in-context
11831++ golden-types-in-context
15992 |= [file=path src=@t externals=iexternals mark-externals=imark-externals jimports=ijimports prelude-values=(list term) reserved-molds=(list term) prelude=(unit ifile)]
11832 |= [file=path src=@t externals=iexternals mark-externals=imark-externals jimports=ijimports prelude-values=(list term) reserved-molds=(list term) prelude=(unit ifile)]
15994− (golden-types-in-context-core file src externals mark-externals jimports prelude-values reserved-molds prelude ~)
15995−++ golden-types-in-context-core
15996− |= [file=path src=@t externals=iexternals mark-externals=imark-externals jimports=ijimports prelude-values=(list term) reserved-molds=(list term) prelude=(unit ifile) prepared=(unit iprelude)]
15998 =. reserved-molds (weld reserved-molds (turn jimports |=(j=[face=term interface=ifile] face.j)))
11834 =. reserved-molds (weld reserved-molds (turn jimports |=(j=[face=term interface=ifile] face.j)))
15999 =/ parsed (parse file src)
11835 =/ parsed (parse file src)
16000 ?: ?=(%| -.parsed) (show-error src p.parsed)
11836 ?: ?=(%| -.parsed) (show-error src p.parsed)
16001 =/ duplicate=(unit idiag) (duplicate-defs defs.p.parsed)
11837 =/ duplicate=(unit idiag) (duplicate-defs defs.p.parsed)
16002 ?^ duplicate (duplicate-fields-report file src u.duplicate)
11838 ?^ duplicate (duplicate-fields-report file src u.duplicate)
16003− ?: (module-has-reserved p.parsed)
11839+ ?: (module-has-reserved-proj p.parsed)
16004− 'module has a reserved proj or unface name'
11840+ 'module has reserved proj name'
16005 =/ ds=(list def) defs.p.parsed
11841 =/ ds=(list def) defs.p.parsed
16006 =/ molds=imolds (collect-simple-molds ds)
11842 =/ molds=imolds (collect-simple-molds ds)
16007 =/ globals=(list term) (weld prelude-values (weld (turn jimports |=(j=[face=term interface=ifile] face.j)) (global-value-names ds)))
11843 =/ globals=(list term) (weld prelude-values (weld (turn jimports |=(j=[face=term interface=ifile] face.j)) (global-value-names ds)))
@@ -16010,39 +11846,6 @@
16010 =/ resolution=iresolved (resolve-groups ds molds globals externals surs mark-externals marks jimports reserved-molds file prelude)
11846 =/ resolution=iresolved (resolve-groups ds molds globals externals surs mark-externals marks jimports reserved-molds file prelude)
16011 =/ cycles=(list icycle) (definite-value-cycles ds globals)
11847 =/ cycles=(list icycle) (definite-value-cycles ds globals)
16012 =/ env=ienv env.resolution
11848 =/ env=ienv env.resolution
16013− =/ recovered=(list term) ~
16015− ?& ?=(~ imports.p.parsed)
16017− !?=([%ui %api *] file)
16018− !?=([%ui %stores *] file)
16019− !(lien (global-value-names ds) |=(n=term =(n %main)))
16020− !(module-values-complete ds env)
16021− (lte (met 3 src) 65.536)
16022− (lte (lent ds) 64)
16023− ?| &(?=(~ prepared) ?=(~ prelude) ?=(~ prelude-values) ?=(~ reserved-molds) (module-scope-valid p.parsed ~ ~) (dg-source-candidate ds 64))
16026− =(u.prelude iface.u.prepared)
16027− =(prelude-values values.u.prepared)
16028− =(reserved-molds molds.u.prepared)
16029− (module-scope-valid p.parsed values.u.prepared molds.u.prepared)
16030− (dg-prepared-candidate ds 64)
16034− =/ transaction=(unit dgcommit)
16036− ?~ prepared (dg-root-source file src)
16037− (dg-root-prepared file src u.prepared)
16040− ?. &((module-values-complete ds env.u.transaction) (dg-interface-safe env.u.transaction)) ~
16041− (turn (skim env.u.transaction |=(entry=[name=term scheme=ischeme] ?=(~ (ienv-lookup name.entry env)))) |=(entry=[name=term scheme=ischeme] name.entry))
16043− ?~ transaction env
16044− ?: &((module-values-complete ds env.u.transaction) (dg-interface-safe env.u.transaction)) env.u.transaction
16046 =/ source-defs=(map term def) (direct-checked-gates ds env)
11849 =/ source-defs=(map term def) (direct-checked-gates ds env)
16047 =/ heads=(unit igate-prelude-evidence) (direct-prelude-evidence ds prelude)
11850 =/ heads=(unit igate-prelude-evidence) (direct-prelude-evidence ds prelude)
16048 =/ lines=(list @t) ~
11851 =/ lines=(list @t) ~
@@ -16057,16 +11860,6 @@
16057 ?^ cycle
11860 ?^ cycle
16058 =/ diag=idiag ["non-gate value depends on itself through a cycle" ~[[first.i.cycle "value in cycle"] [next.i.cycle "dependency in cycle"]]]
11861 =/ diag=idiag ["non-gate value depends on itself through a cycle" ~[[first.i.cycle "value in cycle"] [next.i.cycle "dependency in cycle"]]]
16059 $(ds t.ds, lines [(show-inference-diagnostic file src name.d diag) lines])
11862 $(ds t.ds, lines [(show-inference-diagnostic file src name.d diag) lines])
16060− ?: (lien recovered |=(n=term =(n name.d)))
16061− =/ found=(unit ischeme) (ienv-lookup name.d env)
16062− ?~ found $(ds t.ds, lines [(crip "++ {(trip name.d)}: committed definition unavailable") lines])
16063− ?: (itype-has-hidden-recursive typ.u.found)
16064− $(ds t.ds, lines [(crip "++ {(trip name.d)}: recursive mold name is not available in this scope") lines])
16065− ?: (itype-has-hidden-generic typ.u.found)
16066− $(ds t.ds, lines [(crip "++ {(trip name.d)}: generic union name is not available in this scope") lines])
16067− =/ typ=itype (canonical-itype typ.u.found vars.u.found)
16068− =/ line=@t (crip "++ {(trip name.d)}: {(show-itype typ ~)}{(show-atom-constraint typ)}")
16069− $(ds t.ds, lines [line lines])
16070 ?: (lien grouped.resolution |=(n=term =(n name.d)))
11863 ?: (lien grouped.resolution |=(n=term =(n name.d)))
16071 =/ found=(unit ischeme) (ienv-lookup name.d env)
11864 =/ found=(unit ischeme) (ienv-lookup name.d env)
16072 ?~ found $(ds t.ds, lines [(crip "++ {(trip name.d)}: recursive group unavailable") lines])
11865 ?~ found $(ds t.ds, lines [(crip "++ {(trip name.d)}: recursive group unavailable") lines])
@@ -16074,12 +11867,12 @@
16074 =/ line=@t (crip "++ {(trip name.d)}: {(show-itype typ ~)}{(show-atom-constraint typ)}")
11867 =/ line=@t (crip "++ {(trip name.d)}: {(show-itype typ ~)}{(show-atom-constraint typ)}")
16075 $(ds t.ds, lines [line lines])
11868 $(ds t.ds, lines [line lines])
16076 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
11869 =/ top=(list term) (turn molds |=(m=[name=term body=shape] name.m))
16077− =/ initial=istate [0 ~ ~ ~ molds globals externals surs mark-externals marks jimports reserved-molds ~ ~ ~ | file top prelude ~ 256 ~ ~ ~ ~ ~ ~]
11870+ =/ initial=istate [0 ~ ~ ~ molds globals externals surs mark-externals marks jimports reserved-molds ~ ~ ~ | file top prelude ~ 256 ~ ~ ~]
16078 =. gate-defs.initial source-defs
11871 =. gate-defs.initial source-defs
16079 =. head-evidence.initial heads
11872 =. head-evidence.initial heads
16080 =. initial (reserve-def-caps val.d initial)
11873 =. initial (reserve-def-caps val.d initial)
16081 =/ result=iresult
11874 =/ result=iresult
16082− ?: |(?=(%gate -.val.d) ?=(%gate-wide -.val.d) ?=(^ (unfaced-gate val.d env initial)))
11875+ ?: |(?=(%gate -.val.d) ?=(%gate-wide -.val.d))
16083 (infer-recursive-gate d env initial)
11876 (infer-recursive-gate d env initial)
16084 (infer-fragment val.d env initial)
11877 (infer-fragment val.d env initial)
16085 ?: ?=(%| -.result)
11878 ?: ?=(%| -.result)
@@ -16109,702 +11902,11 @@
16109 ?: (unsupported-atom-vars typ caps.state.p.result binders.state.p.result sub.state.p.result)
11902 ?: (unsupported-atom-vars typ caps.state.p.result binders.state.p.result sub.state.p.result)
16110 $(ds t.ds, lines [(crip "++ {(trip name.d)}: unresolved aura-variable inference") lines])
11903 $(ds t.ds, lines [(crip "++ {(trip name.d)}: unresolved aura-variable inference") lines])
16111 =/ vars=(list @ud) (unique-type-vars (itype-vars typ))
11904 =/ vars=(list @ud) (unique-type-vars (itype-vars typ))
11905+ ?: (gth (lent vars) 26)
11906+ $(ds t.ds, lines [(crip "++ {(trip name.d)}: too many variables for partial printer") lines])
16112 ?~ (width-finalize projections.state.p.result sub.state.p.result vars)
11907 ?~ (width-finalize projections.state.p.result sub.state.p.result vars)
16113 $(ds t.ds, lines [(crip "++ {(trip name.d)}: record projection elaboration needs unsupported inference") lines])
11908 $(ds t.ds, lines [(crip "++ {(trip name.d)}: record projection elaboration needs unsupported inference") lines])
16114− =/ named=[typ=itype vars=(list @ud)] (cap-names typ vars caps.state.p.result sub.state.p.result)
11909+ =/ printable=itype (canonical-itype typ vars)
16115− =/ printable=itype (canonical-itype named)
16116 =/ line=@t (crip "++ {(trip name.d)}: {(show-itype printable ~)}{(show-atom-constraint printable)}")
11910 =/ line=@t (crip "++ {(trip name.d)}: {(show-itype printable ~)}{(show-atom-constraint printable)}")
16117 $(ds t.ds, lines [line lines])
11911 $(ds t.ds, lines [line lines])
16118−:: Experimental module-owned pending-constraint generalization only.
16119−:: Inputs, IDs and substitution come from one checker-owned transaction.
16120−+$ dgscan [ids=(list @ud) fuel=@ud]
16122− |= [todo=(list itype) sub=isub fuel=@ud ids=(list @ud)]
16124− ?~ todo `[ids fuel]
16126− =. fuel (dec fuel)
16128− ?: ?=(?(%var %fvar %avar %rvar %nvar %rnvar %tag) -.t)
16129− =/ node-id=@ud ?:(?=(%tag -.t) id.t +.t)
16130− =/ found=(unit itype) (itype-lookup node-id sub)
16131− ?~ found $(todo t.todo, ids [node-id ids])
16132− ?: &(?=(?(%rvar %rnvar) -.u.found) =(node-id +.u.found))
16133− $(todo t.todo, ids [node-id ids])
16134− $(todo [u.found t.todo])
16135− ?: ?=(%jrec -.t) $(todo t.todo)
16137− %collection $(todo (weld args.t t.todo))
16138− %union $(todo (weld args.t (weld cases.t t.todo)))
16139− %face $(todo [body.t t.todo])
16140− %fn $(todo [sample.t product.t t.todo])
16141− %cell $(todo [hed.t tal.t t.todo])
16142− %atom $(todo t.todo)
16143− %any-atom $(todo t.todo)
16144− %flag $(todo t.todo)
16145− %noun $(todo t.todo)
16146− %empty $(todo t.todo)
16147− %const $(todo t.todo)
16151− |= [ids=(list @ud) sub=isub fuel=@ud blocked=(list @ud)]
16153− ?~ ids `[blocked fuel]
16154− =/ one=(unit dgscan) (dg-scan ~[[%var i.ids]] sub fuel blocked)
16156− $(ids t.ids, fuel fuel.u.one, blocked ids.u.one)
16159− |= [env=ienv sub=isub fuel=@ud blocked=(list @ud)]
16161− ?~ env `[blocked fuel]
16162− =/ sc=ischeme scheme.i.env
16163− :: Quantifiers are local to the scheme: first find raw free IDs, then
16164− :: follow those IDs in the module substitution without capturing them.
16165− =/ raw=(unit dgscan) (dg-scan ~[typ.sc] ~ fuel ~)
16167− =/ free=(list @ud) (skim ids.u.raw |=(n=@ud !(lien vars.sc |=(q=@ud =(q n)))))
16168− =/ resolved=(unit dgscan) (dg-scan-ids free sub fuel.u.raw blocked)
16170− $(env t.env, fuel fuel.u.resolved, blocked ids.u.resolved)
16173− |= [pending=(list dgo) sub=isub fuel=@ud blocked=(list @ud)]
16175− ?~ pending `[blocked fuel]
16176− =/ found=(unit dgscan) (dg-scan ~[left.i.pending right.i.pending] sub fuel blocked)
16178− $(pending t.pending, fuel fuel.u.found, blocked ids.u.found)
16181− |= [tags=(list ipending) sub=isub fuel=@ud blocked=(list @ud)]
16183− ?~ tags `[blocked fuel]
16185− =/ found=(unit itype) (itype-lookup id.i.tags sub)
16186− ?~ found $(tags t.tags, fuel (dec fuel), blocked [id.i.tags blocked])
16187− :: Until this entry is explicitly discharged, retain variables reachable
16188− :: through its binding; mere existence of a substitution is not proof.
16189− =/ reached=(unit dgscan) (dg-scan ~[u.found] sub (dec fuel) blocked)
16191− $(tags t.tags, fuel fuel.u.reached, blocked ids.u.reached)
16194− |= [typ=itype env=ienv pending=(list dgo) tags=(list ipending) captured=(list @ud) state=istate fuel=@ud]
16196− :: Bound the obligation list and all graph/substitution walks. The
16197− :: substitution is assumed checker-owned and occurs-checked.
16198− ?: (gth (lent pending) 64) ~
16199− =/ capt=(unit dgscan) (dg-scan-ids captured sub.state fuel ~)
16201− =/ env-free=(unit dgscan) (dg-env env sub.state fuel.u.capt ids.u.capt)
16203− =/ obligations=(unit dgscan) (dg-obligations pending sub.state fuel.u.env-free ids.u.env-free)
16205− =/ tagged=(unit dgscan) (dg-tags tags sub.state fuel.u.obligations ids.u.obligations)
16207− =/ bounded=(unit dgscan) (dg-scan ~[typ] sub.state fuel.u.tagged ~)
16209− =/ normalized=itype (itype-normalize typ sub.state)
16210− =/ vars=(list @ud) (unique-type-vars (itype-vars normalized))
16211− =/ quantified=(list @ud) (skim vars |=(n=@ud !(lien ids.u.tagged |=(b=@ud =(b n)))))
16212− `(cap-names normalized quantified caps.state sub.state)
16214−+$ dgcommit [env=ienv state=istate]
16215−:: A branch literal must not acquire a value face through replay.
16216−++ dg-literal-target-safe
16219− ?: ?=(%union -.target)
16220− (levy cases.target |=(c=itype ?=(?(%const %cell) -.c)))
16221− ?=(?(%const %atom %any-atom %flag %noun) -.target)
16224− |= [edges=(list dgo) state=istate fuel=@ud]
16228− =/ trial=ifit (itype-fit left.i.edges right.i.edges sub.state next.state)
16229− ?. ?=(%ok -.trial) ~
16231− ?: ?=(%tag -.left.i.edges)
16232− ?. constructor.left.i.edges
16233− =/ closed=(unit dgscan) (dg-scan ~[right.i.edges] sub.trial 512 ~)
16236− (dg-literal-target-safe (itype-normalize right.i.edges sub.trial))
16237− =((itype-walk left.i.edges sub.trial) (itype-walk right.i.edges sub.trial))
16238− =((itype-walk left.i.edges sub.trial) (itype-walk right.i.edges sub.trial))
16240− $(edges t.edges, state state(sub sub.trial, next next.trial), fuel (dec fuel))
16243− |= [env=ienv sub=isub fuel=@ud]
16247− =/ s=ischeme scheme.i.env
16248− :: Quantified IDs are scheme-local and cannot be rewritten on publication.
16249− ?. (levy vars.s |=(n=@ud ?=(~ (itype-lookup n sub)))) ~
16250− =/ bounded=(unit dgscan) (dg-scan ~[typ.s] sub (dec fuel) ~)
16252− =/ normalized=itype (itype-normalize typ.s sub)
16253− ?: (itype-has-tag normalized) ~
16254− =/ vars=(list @ud) (unique-type-vars (itype-vars normalized))
16255− ?. (levy vars |=(n=@ud (lien vars.s |=(v=@ud =(v n))))) ~
16256− =/ rest=(unit ienv) (dg-close-env t.env sub fuel.u.bounded)
16258− `[[name.i.env [normalized vars.s]] u.rest]
16260−:: A deferred boolean branch has exactly the two literal flag patterns.
16261−:: Arms are inferred in order. Equal types are retained; two direct pending
16262−:: literals may instead retain source-owned obligations for later context.
16263−++ dg-boolean-patterns
16266− ?. ?=(%branch -.e) |
16271− =/ y=arm i.t.arms.e
16272− ?. &(?=(%lit -.pat.x) ?=(%lit -.pat.y)) |
16273− ?. &(=(%loobean form.lit.pat.x) =(%loobean form.lit.pat.y)) |
16274− !=(val.lit.pat.x val.lit.pat.y)
16275−:: Only a direct source literal which created its own unbound pending tag
16276−:: may create a branch edge. The caller must retain the exact source and state.
16277−++ dg-owned-arm-literal
16278− |= [e=expr t=itype tags=(list ipending) sub=isub initial=@ud]
16282− ?: constructor.t |
16283− ?. =(lit.e literal.t) |
16284− ?: (lth id.t initial) |
16285− ?^ (itype-lookup id.t sub) |
16286− (lien tags |=(x=ipending &(=(id.x id.t) =(literal.x literal.t))))
16287−++ dg-boolean-branch
16288− |= [e=expr env=ienv state=istate]
16290− ?. (dg-boolean-patterns e) [%| ["deferred branch patterns need unsupported inference" ~]]
16291− ?> ?=(%branch -.e)
16295− =/ y=arm i.t.arms.e
16296− =/ subject=iresult (infer-fragment subject.e env state)
16297− ?: ?=(%| -.subject) subject
16298− =/ su=(unit isub) (itype-unify typ.p.subject [%flag ~] sub.state.p.subject)
16299− ?~ su [%| ["deferred branch subject does not unify with ?" ~]]
16300− =/ left=iresult (infer-fragment val.x env state.p.subject(sub u.su))
16301− ?: ?=(%| -.left) left
16302− =/ right=iresult (infer-fragment val.y env state.p.left)
16303− ?: ?=(%| -.right) right
16304− =/ joined=(unit [typ=itype sub=isub]) (itype-branch-join typ.p.left typ.p.right sub.state.p.right)
16305− ?^ joined [%& typ.u.joined state.p.right(sub sub.u.joined)]
16306− ?. (dg-stable-fit typ.p.left typ.p.right sub.state.p.right)
16307− =/ st=istate state.p.right
16308− ?. (dg-owned-arm-literal val.x typ.p.left tags.st sub.st next.state)
16309− [%| ["deferred branch arm context needs unsupported inference" ~]]
16310− ?. (dg-owned-arm-literal val.y typ.p.right tags.st sub.st next.state)
16311− [%| ["deferred branch arm context needs unsupported inference" ~]]
16312− ?> ?=(%tag -.typ.p.left)
16313− ?> ?=(%tag -.typ.p.right)
16314− ?: =(id.typ.p.left id.typ.p.right)
16315− [%| ["deferred branch arm context needs unsupported inference" ~]]
16316− ?: (gth (lent obligations.st) 62)
16317− [%| ["deferred branch arm context needs unsupported inference" ~]]
16318− =/ result=itype [%var next.st]
16319− =/ ex=dgo [typ.p.left result (span-of val.x) (span-of e)]
16320− =/ ey=dgo [typ.p.right result (span-of val.y) (span-of e)]
16321− [%& result st(next +(next.st), obligations [ex ey obligations.st])]
16322− [%& typ.p.left state.p.right]
16324−:: A direct tuple literal may wait for a later exact result context.
16325−:: Each pending literal retains its source tag and its own fit obligation.
16326−++ dg-infer-tuple-items
16327− |= [items=(list item) env=ienv state=istate]
16329− ?~ items [%| ["empty cell is not supported by partial inference" ~]]
16330− =/ head=iresult (infer-fragment val.i.items env state)
16331− ?: ?=(%| -.head) head
16332− =/ typ=itype typ.p.head
16333− =/ st=istate state.p.head
16334− =/ adjusted=(unit [typ=itype state=istate])
16335− ?. (dg-owned-arm-literal val.i.items typ tags.st sub.st next.state) `[typ st]
16336− ?: (gth (lent obligations.st) 63) ~
16337− =/ pending=itype [%var next.st]
16338− =/ edge=dgo [typ pending (span-of val.i.items) at.i.items]
16339− `[pending st(next +(next.st), obligations [edge obligations.st])]
16340− ?~ adjusted [%| ["deferred tuple context needs unsupported inference" ~]]
16341− =. typ typ.u.adjusted
16342− =. st state.u.adjusted
16343− =. typ ?~(face.i.items typ [%face u.face.i.items typ])
16344− ?~ t.items [%& typ st]
16345− =/ tail=iresult $(items t.items, state st)
16346− ?: ?=(%| -.tail) tail
16347− [%& [%cell typ typ.p.tail] state.p.tail]
16349−:: Deferred inference uses only source forms whose successful fit sites are
16350−:: guarded below; a shared source-node budget bounds this screen.
16351−++ dg-safe-expressions
16352− |= [todo=(list expr) fuel=@ud]
16355− =/ first=(unit @ud) (dg-safe-expression i.todo fuel)
16357− $(todo t.todo, fuel u.first)
16359− |= [items=(list item) fuel=@ud]
16362− =/ first=(unit @ud) (dg-safe-expression val.i.items fuel)
16364− $(items t.items, fuel u.first)
16365−++ dg-safe-expression
16366− |= [e=expr fuel=@ud]
16369− =. fuel (dec fuel)
16371− ?(%lit %ctor) `fuel
16372− %wing ?:(?=([@ ~] names.e) `fuel ~)
16374− ?. (levy pieces.e |=(p=piece ?=(%text -.p))) ~
16376− %group $(e inner.e, fuel fuel)
16379− $(e final.e, fuel fuel)
16380− %gate $(e body.e, fuel fuel)
16381− %gate-wide $(e body.e, fuel fuel)
16382− %tuple (dg-safe-items items.e fuel)
16384− ?. (dg-boolean-patterns e) ~
16387− =/ subject=(unit @ud) $(e subject.e, fuel fuel)
16389− (dg-safe-expressions ~[val.i.arms.e val.i.t.arms.e] u.subject)
16390− %cast $(e val.e, fuel fuel)
16392− =/ head=(unit @ud) $(e head.e, fuel fuel)
16394− (dg-safe-expressions args.e u.head)
16396−:: Exact normalized equality is preserved by all later substitutions.
16397−:: The bounded scan declines opaque types and oversized inputs.
16399− |= [actual=itype expected=itype sub=isub]
16401− ?~ (dg-scan ~[actual expected] sub 512 ~) |
16402− =((itype-normalize actual sub) (itype-normalize expected sub))
16404−:: A positional call peels sample-slot faces during its separate face check.
16405−:: Require its argument, sample and result closed so that check stays valid.
16406−++ dg-stable-call-fit
16407− |= [actual=itype expected=itype product=itype sub=isub positional=?]
16409− =/ checked=(unit dgscan) (dg-scan ~[actual expected product] sub 512 ~)
16411− ?: &(positional ?=(^ ids.u.checked)) |
16412− =((itype-normalize actual sub) (itype-normalize expected sub))
16414−:: One definition attempt retains state only when inference succeeds.
16415−+$ dg-step [env=ienv state=istate pending=(list dgo)]
16417− |= [d=def env=ienv state=istate]
16420− ?~ (dg-safe-expression val.d 512) ~
16421− =/ local=istate (reserve-def-caps val.d state)
16422− :: This first slice declines all written capitals and holes/projections.
16424− =/ ordinary=iresult (infer-fragment val.d env local)
16425− ?: ?=(%| -.ordinary) ~
16426− =/ typ=itype typ.p.ordinary
16427− =/ after=istate state.p.ordinary
16428− =/ edges=(list dgo) obligations.after
16429− ?. =(binders.after binders.state) ~
16430− ?. =(molds.after molds.state) ~
16431− ?. =(globals.after globals.state) ~
16432− ?. =(externals.after externals.state) ~
16433− ?. =(surs.after surs.state) ~
16434− ?. =(mark-externals.after mark-externals.state) ~
16435− ?. =(marks.after marks.state) ~
16436− ?. =(jimports.after jimports.state) ~
16437− ?. =(reserved-molds.after reserved-molds.state) ~
16438− ?. =(params.after params.state) ~
16439− ?. =(active.after active.state) ~
16440− ?. =(in-mold.after in-mold.state) ~
16441− ?. =(at.after at.state) ~
16442− ?. =(top-molds.after top-molds.state) ~
16443− ?. =(prelude.after prelude.state) ~
16444− ?. =(gate-defs.after gate-defs.state) ~
16445− ?. =(head-evidence.after head-evidence.state) ~
16446− ?. =(grec-index.after grec-index.state) ~
16447− ?. =(defer.after defer.state) ~
16448− ?. =(holes.after holes.state) ~
16449− ?. =(caps.after caps.state) ~
16450− ?. =(projections.after projections.state) ~
16451− ?: (unsupported-atom-vars (itype-normalize typ sub.after) caps.after binders.after sub.after) ~
16452− ?: (itype-has-nvar (itype-normalize typ sub.after)) ~
16453− =/ scheme=(unit ischeme) (dg-generalize typ env edges tags.after ~ after 32.768)
16455− `[[[name.d u.scheme] env] after edges]
16456−:: Retry only definitions that did not infer. Successful definitions are
16457−:: committed into the local transaction, never published until all close.
16459− |= [ds=(list def) base=ienv env=ienv state=istate pending=(list dgo) fuel=@ud]
16460− ^- (unit dgcommit)
16461− ?: (gth fuel 64) ~
16462− ?: (gth (lent ds) fuel) ~
16463− =/ remaining=(list def) ds
16464− =/ waiting=(list def) ~
16466− =/ attempts=@ud (mul fuel fuel)
16471− $(remaining (flop waiting), waiting ~, progress |)
16472− =/ replayed=(unit istate) (dg-replay-edges pending state 64)
16474− ?: (pending-tags tags.u.replayed sub.u.replayed) ~
16475− =/ closed-edges=(unit dgscan) (dg-obligations pending sub.u.replayed 32.768 ~)
16477− ?^ ids.u.closed-edges ~
16478− =/ rechecked=(unit istate) (dg-replay-edges pending u.replayed 64)
16480− ?. =(sub.u.rechecked sub.u.replayed) ~
16481− ?. =(next.u.rechecked next.u.replayed) ~
16482− =/ closed=(unit ienv) (dg-close-env env sub.u.replayed 32.768)
16484− `[[u.closed u.replayed(defer ~, obligations ~)]]
16485− ?: =(0 attempts) ~
16486− =. attempts (dec attempts)
16487− =/ d=def i.remaining
16488− ?: ?=(%mold -.d) $(remaining t.remaining)
16489− ?^ (ienv-lookup name.d base) $(remaining t.remaining)
16490− ?^ (ienv-lookup name.d env) ~
16491− =/ done=(unit dg-step) (dg-stage-one d env state)
16492− ?~ done $(remaining t.remaining, waiting [d waiting])
16493− $(remaining t.remaining, env env.u.done, state state.u.done, pending pending.u.done, progress &)
16495−:: Cheap bounded eligibility check on the already parsed source. This
16496−:: deliberately covers only direct constructor calls beneath transparent
16497−:: groups, gates, casts and definition-free bodies. Other shapes decline
16498−:: this fallback without a second parse or resolution pass.
16499−++ dg-direct-source
16500− |= [e=expr fuel=@ud]
16504− %group $(e inner.e, fuel (dec fuel))
16505− %gate $(e body.e, fuel (dec fuel))
16506− %gate-wide $(e body.e, fuel (dec fuel))
16507− %cast $(e val.e, fuel (dec fuel))
16508− %body ?~(defs.e $(e final.e, fuel (dec fuel)) |)
16510− ?. ?=([* ~] args.e) |
16511− ?=(%ctor -.i.args.e)
16513−++ dg-source-candidate
16514− |= [ds=(list def) fuel=@ud]
16518− ?. ?=(%value -.i.ds) $(ds t.ds, fuel (dec fuel))
16519− ?: (dg-direct-source val.i.ds 64) &
16520− $(ds t.ds, fuel (dec fuel))
16522−++ dg-prepared-source
16523− |= [e=expr fuel=@ud]
16525− ?: (dg-direct-source e fuel) &
16528− %group $(e inner.e, fuel (dec fuel))
16529− %gate $(e body.e, fuel (dec fuel))
16530− %gate-wide $(e body.e, fuel (dec fuel))
16531− %cast $(e val.e, fuel (dec fuel))
16532− %body ?~(defs.e $(e final.e, fuel (dec fuel)) |)
16535−++ dg-prepared-candidate
16536− |= [ds=(list def) fuel=@ud]
16540− ?. ?=(%value -.i.ds) $(ds t.ds, fuel (dec fuel))
16541− ?: (dg-prepared-source val.i.ds 64) &
16542− $(ds t.ds, fuel (dec fuel))
16544−++ dg-interface-safe
16548− =/ sc=ischeme scheme.i.env
16549− ?: |((itype-has-hidden-recursive typ.sc) (itype-has-hidden-generic typ.sc)) |
16551−:: Parse status and the transaction result come from the same source parse.
16552−+$ dgparse [parsed=? result=(unit dgcommit)]
16554− |= [at=path src=@t]
16555− ^- (unit dgcommit)
16556− result:(dg-root-detail at src)
16558− |= [at=path src=@t]
16560− =/ parsed (parse at src)
16561− ?: ?=(%| -.parsed) [| ~]
16564− ?^ imports.p.parsed ~
16565− ?. (module-scope-valid p.parsed ~ ~) ~
16566− ?^ (duplicate-defs defs.p.parsed) ~
16567− =/ defs=(list def) defs.p.parsed
16568− ?: (gth (lent defs) 64) ~
16569− =/ molds=imolds (collect-simple-molds defs)
16570− =/ globals=(list term) (global-value-names defs)
16571− =/ resolution=iresolved (resolve-groups defs molds globals ~ ~ ~ ~ ~ ~ at ~)
16572− ?^ grouped.resolution ~
16573− ?^ artifacts.resolution ~
16574− =/ base=ienv env.resolution
16575− =/ free=(unit dgscan) (dg-env base ~ 32.768 ~)
16578− =/ all=(unit @ud) (ienv-fresh-id base)
16580− =/ fresh=@ud u.all
16581− =/ st=istate *istate
16582− =. st st(next fresh, defer `~, molds molds, globals globals, at at, top-molds (turn molds |=(m=[name=term body=shape] name.m)), in-mold |, jrec-fuel 256)
16583− =/ checked-molds=(each imold-types @t) (module-mold-types molds st)
16584− ?: ?=(%| -.checked-molds) ~
16585− (dg-stage defs base base st ~ 64)
16588−:: The caller supplies the trusted prepared prelude. This transaction is
16589−:: only report evidence; the ordinary module resolver does not publish it.
16590−++ dg-root-prepared
16591− |= [at=path src=@t prepared=iprelude]
16592− ^- (unit dgcommit)
16593− ?: ?=([%ui %api *] at) ~
16594− ?: ?=([%ui %stores *] at) ~
16595− ?: (gth (met 3 src) 65.536) ~
16596− =/ parsed (parse at src)
16597− ?: ?=(%| -.parsed) ~
16598− ?^ imports.p.parsed ~
16599− ?. (module-scope-valid p.parsed values.prepared molds.prepared) ~
16600− ?^ (duplicate-defs defs.p.parsed) ~
16601− =/ defs=(list def) defs.p.parsed
16602− ?: (gth (lent defs) 64) ~
16603− ?: (lien (global-value-names defs) |=(n=term =(n %main))) ~
16604− ?. (dg-prepared-candidate defs 64) ~
16605− =/ local-molds=imolds (collect-simple-molds defs)
16606− =/ globals=(list term) (weld values.prepared (global-value-names defs))
16607− =/ iface=ifile iface.prepared
16608− =/ prelude=(unit ifile) `iface
16609− =/ resolution=iresolved
16610− (resolve-groups defs local-molds globals ~ ~ ~ ~ ~ molds.prepared at prelude)
16611− ?^ grouped.resolution ~
16612− ?^ artifacts.resolution ~
16613− =/ base=ienv env.resolution
16615− (turn molds.iface |=(x=[name=term template=ischeme] [name.x template.x]))
16616− =/ all-env=ienv (weld base (weld values.iface templates))
16617− =/ free=(unit dgscan) (dg-env all-env ~ 32.768 ~)
16620− =/ all=(unit @ud) (ienv-fresh-id all-env)
16622− =/ fresh=@ud u.all
16623− =/ st=istate *istate
16624− =. st st(next fresh, defer `~, molds local-molds, globals globals, at at, reserved-molds molds.prepared, prelude prelude, top-molds (turn local-molds |=(m=[name=term body=shape] name.m)), in-mold |, jrec-fuel 256)
16625− =/ checked-molds=(each imold-types @t) (module-mold-types local-molds st)
16626− ?: ?=(%| -.checked-molds) ~
16627− (dg-stage defs base base st ~ 64)
16629−:: +ienv-fresh-id: one above the largest type variable or tag ID in env
16631−:: One pass over every ID in env's schemes, quantified or free, so a
16632−:: variable numbered from it captures none of them. A %recursive or
16633−:: %jrec type names its mold and holds no variable, so it is a leaf,
16634−:: and the pass is linear in the size of the types, with no budget.
16635−:: A scheme that still holds an unresolved tag declines.
16643− =/ sc=ischeme scheme.i.env
16644− ?: (itype-has-tag typ.sc) ~
16645− $(env t.env, top (itype-max-id typ.sc (max top (roll (turn vars.sc var-count) max))))
16647−:: +itype-max-id: the largest variable or tag ID in t, or top, without
16648−:: the variables' names (+named-var)
16651− |= [t=itype top=@ud]
16654− %var (max top (var-count id.t))
16655− %fvar (max top (var-count id.t))
16656− %avar (max top (var-count id.t))
16657− %rvar (max top (var-count id.t))
16658− %nvar (max top (var-count id.t))
16659− %rnvar (max top (var-count id.t))
16660− %tag (max top id.t)
16661− ?(%atom %any-atom %flag %noun %empty %const %recursive %jrec) top
16662− %collection (itype-max-ids args.t top)
16663− %grec (itype-max-ids args.t top)
16664− %union (itype-max-ids args.t (itype-max-ids cases.t top))
16666− %fn $(t sample.t, top $(t product.t))
16667− %cell $(t hed.t, top $(t tal.t))
16671− |= [ts=(list itype) top=@ud]
16674− $(ts t.ts, top (itype-max-id i.ts top))
16676−++ dg-eligible-ctor
16677− |= [e=expr head=itype actual=itype expected=itype state=istate]
16679− ?. ?=(%call -.e) ~
16680− ?. ?=([* ~] args.e) ~
16681− ?. ?=(%ctor -.i.args.e) ~
16682− ?. ?=(%fn -.head) ~
16683− ?. ?=(%fn -.expected) ~
16684− ?. ?=(%tag -.actual) ~
16685− ?. constructor.actual ~
16686− ?. ?=(%var -.product.expected) ~
16687− ?^ (itype-lookup id.product.expected sub.state) ~
16688− =/ bounded=(unit dgscan) (dg-scan ~[sample.expected] sub.state 256 ~)
16690− ?^ ids.u.bounded ~
16691− `[[actual expected (span-of i.args.e) (span-of head.e)]]
16693−:: Experimental per-module, source-derived recursive tree index.
16694−:: The two tags and the exact children/list/self layout are fixed-shape
16695−:: checks, so ordinary definitions incur no type-tree or source scans.
16696−++ grec-tagged-fields
16698− ^- (unit [tag=@ fields=(list field)])
16699− ?. ?=(%cell -.sh) ~
16701− =/ head=field i.fields.sh
16702− ?. ?=(%bare -.head) ~
16703− ?. ?=(%const -.shape.head) ~
16704− ?. &(?=(%term form.lit.shape.head) =(%tas aura.lit.shape.head)) ~
16705− `[val.lit.shape.head t.fields.sh]
16706−++ grec-tree-children
16707− |= [fs=(list field) param=@t]
16712− =/ event=field i.fs
16713− =/ kids=field i.t.fs
16714− ?. &(?=(%face -.event) ?=(%face -.kids)) ~
16715− ?. !=(name.event name.kids) ~
16716− ?. ?=(%fn -.shape.event) ~
16717− ?. ?=(%aura -.sample.shape.event) ~
16718− ?. =(%t aura.sample.shape.event) ~
16719− ?. ?=(%tvar -.product.shape.event) ~
16720− ?. =(param name.product.shape.event) ~
16724− |= [name=term sh=shape]
16726− ?. ?=(%generic -.sh) |
16727− ?. ?=([@ ~] vars.sh) |
16728− =/ param=@t i.vars.sh
16729− ?. ?=(%union -.body.sh) |
16730− ?. ?=([* [* ~]] cases.body.sh) |
16731− =/ a=(unit [tag=@ fields=(list field)]) (grec-tagged-fields i.cases.body.sh)
16732− =/ b=(unit [tag=@ fields=(list field)]) (grec-tagged-fields i.t.cases.body.sh)
16735− ?. !=(tag.u.a tag.u.b) |
16736− ?. ?=([* ~] fields.u.a) |
16737− =/ value=field i.fields.u.a
16738− ?. ?=(%face -.value) |
16739− ?. ?=(%aura -.shape.value) |
16740− ?. =(%t aura.shape.value) |
16741− =/ selected=(unit field) (grec-tree-children fields.u.b param)
16743− =/ kids=field u.selected
16744− ?. ?=(%face -.kids) |
16745− ?. ?=(%apply -.shape.kids) |
16746− ?. =(ref.shape.kids ~[%list]) |
16747− ?. ?=([* ~] args.shape.kids) |
16748− =/ self=shape i.args.shape.kids
16749− ?. ?=(%apply -.self) |
16750− ?. =(ref.self ~[name]) |
16751− ?. ?=([* ~] args.self) |
16752− ?. ?=(%tvar -.i.args.self) |
16753− =(name.i.args.self param)
16754−+$ grec-collected [molds=imolds proofs=(map term shape)]
16755−:: Experimental one-layer analysis view, never an exported mold identity.
16756−++ grec-unfold-view
16757− |= [typ=itype fuel=@ud]
16758− ^- (unit [view=itype left=@ud])
16759− ?. ?=(%grec -.typ) ~
16761− ?. ?=([* ~] args.typ) ~
16762− =/ sh=shape proof.typ
16763− ?. (grec-tree-proof name.typ sh) ~
16764− ?> ?=(%generic -.sh)
16765− ?> ?=([@ ~] vars.sh)
16766− ?> ?=(%union -.body.sh)
16767− ?> ?=([* [* ~]] cases.body.sh)
16768− =/ ca=shape i.cases.body.sh
16769− =/ cb=shape i.t.cases.body.sh
16772− ?> ?=([* [* ~]] fields.ca)
16773− ?> ?=([* *] fields.cb)
16774− =/ tag-a=field i.fields.ca
16775− =/ tag-b=field i.fields.cb
16776− ?> ?=(%bare -.tag-a)
16777− ?> ?=(%bare -.tag-b)
16778− ?> ?=(%const -.shape.tag-a)
16779− ?> ?=(%const -.shape.tag-b)
16780− =/ text-field=field i.t.fields.ca
16781− ?> ?=(%face -.text-field)
16782− =/ branch=(list field) t.fields.cb
16783− =/ kids=(unit field) (grec-tree-children branch i.vars.sh)
16785− ?> ?=(%face -.u.kids)
16786− =/ children=itype [%face name.u.kids [%collection %list ~[typ]]]
16789− ?~ t.branch children
16790− =/ event=field i.branch
16791− ?> ?=(%face -.event)
16792− [%cell [%face name.event [%fn [%atom %t] i.args.typ]] children]
16793− =/ leaf=itype [%cell [%const lit.shape.tag-a] [%face name.text-field [%atom %t]]]
16794− =/ node=itype [%cell [%const lit.shape.tag-b] payload]
16795− `[[%union ~[leaf node] ~ ~ ~] (dec fuel)]
16797−++ grec-collect-molds
16800− ?~ ds [~ *(map term shape)]
16801− =/ rest=grec-collected $(ds t.ds)
16802− ?. ?=(%mold -.i.ds) rest
16803− =/ name=term name.i.ds
16804− =/ body=shape shape.i.ds
16805− =/ proofs=(map term shape) proofs.rest
16806− =? proofs (grec-tree-proof name body) (~(put by proofs) name body)
16807− [[[name body] molds.rest] proofs]