on master help sign in
Reject a pattern name that spells one of the subject's tags
d4aed71Claude
docs/compiler.md+2
@@ -100,6 +100,8 @@ The checked inference fragment represents the empty mold `!!` explicitly. A cell
100
100
101A known closed union with two or more arms can be matched when each arm provably covers or excludes each remaining case. The checker first tries whole cases; when a pattern splits a case, it can expand known `?` positions into their two noun values, up to 64 alternatives across the union. Binders retain the original case type, and one arm may bind several refinements of that case. It reports missing alternatives and arms already covered, checks tags by noun value, and supports imported and generic union cases. Other partial patterns, expansions above the limit, binders spanning distinct cases, differing arm result types and some complex two-arm subjects remain unsupported. When a cast or known call sample supplies a result type, a known union subject accessed by a wing, a grouped wing or a supported shallow call can propagate that context through whole-case arms and supported finite loobean refinements, including nested cell and list positions. Other partial-pattern contexts and subject forms remain unsupported. The Grammar’s `step` block infers in this fragment, but its module is not yet checked.
101A known closed union with two or more arms can be matched when each arm provably covers or excludes each remaining case. The checker first tries whole cases; when a pattern splits a case, it can expand known `?` positions into their two noun values, up to 64 alternatives across the union. Binders retain the original case type, and one arm may bind several refinements of that case. It reports missing alternatives and arms already covered, checks tags by noun value, and supports imported and generic union cases. Other partial patterns, expansions above the limit, binders spanning distinct cases, differing arm result types and some complex two-arm subjects remain unsupported. When a cast or known call sample supplies a result type, a known union subject accessed by a wing, a grouped wing or a supported shallow call can propagate that context through whole-case arms and supported finite loobean refinements, including nested cell and list positions. Other partial-pattern contexts and subject forms remain unsupported. The Grammar’s `step` block infers in this fragment, but its module is not yet checked.
102
102
103+Before any branch path runs, `+branch-tag-name` rejects a pattern name that spells one of the subject's tags at its position, as `stop` for `%stop` (Grammar, Patterns). It infers the subject on its own and walks each arm's pattern through faces, cells and union cases, skipping the cases a cell pattern can't match. It stops at atoms, `*`, variables, collections, recursive molds and a generic union's argument positions, so every path that checks a `?-` reports the same error. A subject whose inference fails, or whose type isn't known yet, is left to the path.
104+
103A known closed union can also provide context to each arm of a complete loobean or unit-shaped branch in a cast or a call with a known union sample. Nested branches and transparent groups work; a mismatch reports the expected union and the offending arm. General patterns and context through bodies with local definitions remain unsupported, and unrelated unresolved tags stay pending.
105A known closed union can also provide context to each arm of a complete loobean or unit-shaped branch in a cast or a call with a known union sample. Nested branches and transparent groups work; a mismatch reports the expected union and the offending arm. General patterns and context through bodies with local definitions remain unsupported, and unrelated unresolved tags stay pending.
104
106
105The separate `jibb-dev/lib/jibb-import.hoon` is an unfinished reader for selected Hoon type graphs. It handles named recursion, nested map, set, queue, list, unit, jar and jug arguments, direct ordered maps, and direct `$^` unions whose source branches can be proved disjoint. It also recognizes a direct ordered-map call with two simple named mold operands, as in Tlon `notes.log`, after validating provenance and operand source; revisiting the same map hold fails closed. It also reads ordered map fields in records when the map arguments are syntactically fixed atom molds and other fields are fixed atom molds or standard collections of static atom molds. Collection names must not be shadowed. The reader can also import a mark door sample, removing its outer sample face and validating its build subject. For a mark whose sample is exactly a named arm of its single Ford-imported `/sur` core, it can recover a source-proved nonrecursive union, including source-location wrappers around fields; recursive or unverified fallback results remain unsupported. The reader checks explicit Hoon `$%`, `$?` and `$^` unions against the Grammar’s disjointness rule, as @iko confirmed on 2026-10-30. For an explicit `$%` with distinct literal head tags, it can also prove restricted local named payload dependencies, including bare `~` fields, re-evaluate and validate each source branch, and recover the union before Hoon collapses it. The real Tlon `notes.u-note` exercises its `[%deleted ~]` case. A bounded fallback also recovers one level of local named tagged unions inside such a union, including Tlon `notes.u-notebook` and `notes.u-notes`. Source-proved tagged unions can also be wrapped in Hoon `$~` defaults, including a downstream union using Tlon `epic.saga`; the selected source and projected branches still undergo the same provenance and disjointness checks. The tagged-source helper peels up to four consecutive default wrappers, while default wrappers encountered inside dependency proofs consume the existing semantic-node budget. A source-proved nested self-recursive union retains its named owner, including Tlon `notes.import-node`; deeper, mutually recursive or unproven cases stay unsupported. The nested source proof has a 256-visit semantic-node budget, and source-location wrapper peeling is limited to four per node; Hoon evaluation and source scans are not metered. It rejects recursive or computed dependencies, inherited same-name collisions, unsupported nested unions and proofs exceeding a shared 4,096-node budget. It re-evaluates statically recognizable source branches before Hoon can collapse them, checks materialized fork cases, and rejects shapes it cannot prove disjoint. Static records may also have verified standard-collection and `path` siblings. One direct explicit union argument in a standard list, set, map or unit is accepted when its call wrapper and collection provenance are verified and its static cases are pairwise disjoint. A synthetic regression checks that forged wrapper subjects, samples and tails are rejected. Other collection-union forms, nested ordered maps, general source-level disjointness and complete integration with the checker remain unfinished. `+golden-types-imports` can consume fixed-aura atoms, valid term singletons, Hoon's `%n` zero singleton as Jibb `~`, nested faced or unfaced cells, unions of supported, pairwise-disjoint cases, and opaque standard collections with supported arguments from caller-supplied reader results for declared `/-` imports; `+golden-types-with-marks` accepts the same shapes for declared marks. The caller must pass unchanged results from the source-aware reader: the bridge validates the supplied graph but cannot detect source cases Hoon collapsed before that graph was built. The opaque collection types retain their names and arguments for identity, unification and printing. The validated standard prelude `list` mold shares the imported list representation; other Jibb-written collection molds and most prelude collection operations remain unsupported. Other forms remain unsupported. Its disjointness proof is conservative and can reject a valid union it cannot prove disjoint. Collection recognition requires the originating `/sur` core. The reader validates direct zuse subjects and Ford subjects consisting of faced imported cores and a validated tail, checking imported cores transitively; it rejects shadowed names, inconsistent core subjects and other subject shapes. For a recursive reference, the reader matches the exact Hoon hold against named arms in validated cores, including transitive Ford imports; it rejects missing, unlabelled or ambiguous origins. Its fixtures include three real Tlon files; the `tests/lib/jibb-import.hoon` suite, which holds the probes, compares the internal projection with its golden output and checks the structured values behind it, under eval (`tools/test-arms jibb-import`) and on the ship. `tests/lib/jibb-bridge.hoon` and `tests/lib/jibb-mark-bridge.hoon` compare bridge reports under eval and on the ship. `tests/lib/jibb-tlon-bridge.hoon` exercises four real Tlon presence unions and a field read through the source-aware reader and partial checker, under eval and on the ship. `tools/clay-fixtures` also passes Clay-built `/sur` molds and mark samples through the Clay-built importer and partial checker.
107The separate `jibb-dev/lib/jibb-import.hoon` is an unfinished reader for selected Hoon type graphs. It handles named recursion, nested map, set, queue, list, unit, jar and jug arguments, direct ordered maps, and direct `$^` unions whose source branches can be proved disjoint. It also recognizes a direct ordered-map call with two simple named mold operands, as in Tlon `notes.log`, after validating provenance and operand source; revisiting the same map hold fails closed. It also reads ordered map fields in records when the map arguments are syntactically fixed atom molds and other fields are fixed atom molds or standard collections of static atom molds. Collection names must not be shadowed. The reader can also import a mark door sample, removing its outer sample face and validating its build subject. For a mark whose sample is exactly a named arm of its single Ford-imported `/sur` core, it can recover a source-proved nonrecursive union, including source-location wrappers around fields; recursive or unverified fallback results remain unsupported. The reader checks explicit Hoon `$%`, `$?` and `$^` unions against the Grammar’s disjointness rule, as @iko confirmed on 2026-10-30. For an explicit `$%` with distinct literal head tags, it can also prove restricted local named payload dependencies, including bare `~` fields, re-evaluate and validate each source branch, and recover the union before Hoon collapses it. The real Tlon `notes.u-note` exercises its `[%deleted ~]` case. A bounded fallback also recovers one level of local named tagged unions inside such a union, including Tlon `notes.u-notebook` and `notes.u-notes`. Source-proved tagged unions can also be wrapped in Hoon `$~` defaults, including a downstream union using Tlon `epic.saga`; the selected source and projected branches still undergo the same provenance and disjointness checks. The tagged-source helper peels up to four consecutive default wrappers, while default wrappers encountered inside dependency proofs consume the existing semantic-node budget. A source-proved nested self-recursive union retains its named owner, including Tlon `notes.import-node`; deeper, mutually recursive or unproven cases stay unsupported. The nested source proof has a 256-visit semantic-node budget, and source-location wrapper peeling is limited to four per node; Hoon evaluation and source scans are not metered. It rejects recursive or computed dependencies, inherited same-name collisions, unsupported nested unions and proofs exceeding a shared 4,096-node budget. It re-evaluates statically recognizable source branches before Hoon can collapse them, checks materialized fork cases, and rejects shapes it cannot prove disjoint. Static records may also have verified standard-collection and `path` siblings. One direct explicit union argument in a standard list, set, map or unit is accepted when its call wrapper and collection provenance are verified and its static cases are pairwise disjoint. A synthetic regression checks that forged wrapper subjects, samples and tails are rejected. Other collection-union forms, nested ordered maps, general source-level disjointness and complete integration with the checker remain unfinished. `+golden-types-imports` can consume fixed-aura atoms, valid term singletons, Hoon's `%n` zero singleton as Jibb `~`, nested faced or unfaced cells, unions of supported, pairwise-disjoint cases, and opaque standard collections with supported arguments from caller-supplied reader results for declared `/-` imports; `+golden-types-with-marks` accepts the same shapes for declared marks. The caller must pass unchanged results from the source-aware reader: the bridge validates the supplied graph but cannot detect source cases Hoon collapsed before that graph was built. The opaque collection types retain their names and arguments for identity, unification and printing. The validated standard prelude `list` mold shares the imported list representation; other Jibb-written collection molds and most prelude collection operations remain unsupported. Other forms remain unsupported. Its disjointness proof is conservative and can reject a valid union it cannot prove disjoint. Collection recognition requires the originating `/sur` core. The reader validates direct zuse subjects and Ford subjects consisting of faced imported cores and a validated tail, checking imported cores transitively; it rejects shadowed names, inconsistent core subjects and other subject shapes. For a recursive reference, the reader matches the exact Hoon hold against named arms in validated cores, including transitive Ford imports; it rejects missing, unlabelled or ambiguous origins. Its fixtures include three real Tlon files; the `tests/lib/jibb-import.hoon` suite, which holds the probes, compares the internal projection with its golden output and checks the structured values behind it, under eval (`tools/test-arms jibb-import`) and on the ship. `tests/lib/jibb-bridge.hoon` and `tests/lib/jibb-mark-bridge.hoon` compare bridge reports under eval and on the ship. `tests/lib/jibb-tlon-bridge.hoon` exercises four real Tlon presence unions and a field read through the source-aware reader and partial checker, under eval and on the ship. `tools/clay-fixtures` also passes Clay-built `/sur` molds and mark samples through the Clay-built importer and partial checker.
docs/spec/grammar.md+2−2
@@ -181,7 +181,7 @@ Number and cell literals resolve like tags: each waits for its context and takes
181
181
182## Patterns
182## Patterns
183
183
184−Arms are tried in order. Every case needs an arm or a catch-all, `*` or a bare name. An arm that earlier arms cover, such as a second `%add` or anything after `[%move * *]`, is an error, and a case that should fail says `!!`. A name in a pattern always binds anew, so compare values with `?- (eq a b)`. Patterns take terms, numbers, strings without `{…}`, ships, loobeans and `~`, and cells of patterns, which nest; not `~[…]` lists or `a+b` pairs.
184+Arms are tried in order. Every case needs an arm or a catch-all, `*` or a bare name. An arm that earlier arms cover, such as a second `%add` or anything after `[%move * *]`, is an error, and a case that should fail says `!!`. A name in a pattern always binds anew, so compare values with `?- (eq a b)`. A name is an error where the subject's type at its position is a union, or a one-case mold, and a case that the rest of the pattern can match has there the constant the name spells, so `stop` written for `%stop` below is an error, not a catch-all. Positions typed by an aura, `*`, a type variable, a container's element or a recursive mold are unaffected, so `[t %draft] t` still binds `t`, and `x` is still a catch-all on a `@tas` subject. Patterns take terms, numbers, strings without `{…}`, ships, loobeans and `~`, and cells of patterns, which nest; not `~[…]` lists or `a+b` pairs.
185
185
186| Pattern | Matches | Binds |
186| Pattern | Matches | Binds |
187| --- | --- | --- |
187| --- | --- | --- |
@@ -278,7 +278,7 @@ pathmold = "/" [ segment { "/" segment } ] ;
278segment = knot | "[" name "=" ( aura | "_" ) "]" ;
278segment = knot | "[" name "=" ( aura | "_" ) "]" ;
279
279
280pattern = term | number | string | ship | loobean | "~" | "*" | name
280pattern = term | number | string | ship | loobean | "~" | "*" | name
281− | "[" pattern { pattern } "]" ;
281+ | "[" pattern { pattern } "]" ; (* a name can't spell a tag the subject has there; see Patterns *)
282
282
283literal = number | string | ship | date | duration | knotlit
283literal = number | string | ship | date | duration | knotlit
284 | term | loobean | "~" ;
284 | term | loobean | "~" ;
jibb-dev/lib/jibb.hoon+78
@@ -7768,6 +7768,8 @@
7768 ?: &(?=(%collection -.expected) =(%list name.expected) (context-list-expression e))
7768 ?: &(?=(%collection -.expected) =(%list name.expected) (context-list-expression e))
7769 (infer-list-context e expected env state context)
7769 (infer-list-context e expected env state context)
7770 ?: ?=(%branch -.e)
7770 ?: ?=(%branch -.e)
7771+ =/ named=(unit idiag) (branch-tag-name e env state)
7772+ ?^ named [%| u.named]
7771 =/ empty-list=(unit iresult) (empty-list-null-branch e env state `[expected context])
7773 =/ empty-list=(unit iresult) (empty-list-null-branch e env state `[expected context])
7772 ?^ empty-list u.empty-list
7774 ?^ empty-list u.empty-list
7773 ?~ arms.e [%| ["branch is not supported by partial inference" ~]]
7775 ?~ arms.e [%| ["branch is not supported by partial inference" ~]]
@@ -8163,6 +8165,78 @@
8163 ?: ?=(%cell -.p) (union-pattern-bind-items items.p t env globals)
8165 ?: ?=(%cell -.p) (union-pattern-bind-items items.p t env globals)
8164 `env
8166 `env
8165::
8167::
8168+:: +branch-tag-name: a ?- pattern name that spells one of the subject's tags
8169+::
8170+:: A name in a pattern binds, so `stop` written for `%stop` would
8171+:: catch every case left. Where the subject's type at a name's
8172+:: position is a union, or a one-case mold, with a case whose constant
8173+:: there is the term the name spells, the name is an error (Grammar,
8174+:: Patterns). Every path that checks a ?- asks this first, so they
8175+:: agree; it infers the subject apart and drops the state it leaves.
8176+:: A subject that fails, or whose type isn't known yet, is left to the
8177+:: path. Samples aren't patterns: every sample name binds.
8178+++ branch-tag-name
8179+ |= [e=expr env=ienv state=istate]
8180+ ^- (unit idiag)
8181+ ?. ?=(%branch -.e) ~
8182+ ?. (lien arms.e |=(a=arm (union-pattern-has-bind pat.a))) ~
8183+ =/ subject=iresult (infer-fragment subject.e env state)
8184+ ?: ?=(%| -.subject) ~
8185+ =/ typ=itype (itype-normalize typ.p.subject sub.state.p.subject)
8186+ =/ arms=(list arm) arms.e
8187+ |-
8188+ ?~ arms ~
8189+ =/ found=(unit [at=span name=term]) (tag-name-pattern pat.i.arms typ ~)
8190+ ?~ found $(arms t.arms)
8191+ =/ name=tape (trip name.u.found)
8192+ :- ~
8193+ :- "`{name}` binds a name, but the subject's type has `%{name}` here; write %{name}, or * for a catch-all"
8194+ ~[[(span-of subject.e) "subject"] [at.u.found "pattern name"]]
8195+::
8196+:: +tag-name-pattern: the first name in p that t types by a tag
8197+::
8198+:: The walk enters faces, cells and unions, and of a union only the
8199+:: cases a cell pattern can match, so `[t %draft]` reads t at @t. It
8200+:: stops at atoms, `*`, variables, collections and recursive molds,
8201+:: and at a generic union's argument positions, which a type variable
8202+:: types in its mold, as u in `[~ u=A]`.
8203+++ tag-name-pattern
8204+ |= [p=pattern t=itype args=(list itype)]
8205+ ^- (unit [at=span name=term])
8206+ ?. ?=(?(%bind %cell) -.p) ~
8207+ ?: ?=(%face -.t) $(t body.t)
8208+ ?: (lien args |=(a=itype =(a t))) ~
8209+ ?: ?=(%union -.t)
8210+ =/ inner=(list itype) (weld args.t args)
8211+ =/ cases=(list itype) cases.t
8212+ |-
8213+ ?~ cases ~
8214+ ?: &(?=(%cell -.p) =(%none (union-pattern p i.cases))) $(cases t.cases)
8215+ =/ found=(unit [at=span name=term]) (tag-name-pattern p i.cases inner)
8216+ ?^ found found
8217+ $(cases t.cases)
8218+ ?: ?=(%cell -.p) (tag-name-items items.p t args)
8219+ ?. ?=(%const -.t) ~
8220+ ?. &(=(%term form.literal.t) =(%tas aura.literal.t) =(name.p val.literal.t)) ~
8221+ `[at.p name.p]
8222+::
8223+:: +tag-name-items: +tag-name-pattern along a cell pattern's items
8224+::
8225+:: As in +union-pattern-items, the last item takes the rest of the
8226+:: spine. A union mid-spine is read as the rest of the pattern.
8227+++ tag-name-items
8228+ |= [ps=(list pattern) t=itype args=(list itype)]
8229+ ^- (unit [at=span name=term])
8230+ ?~ ps ~
8231+ ?~ t.ps (tag-name-pattern i.ps t args)
8232+ ?: ?=(%face -.t) $(t body.t)
8233+ ?: (lien args |=(a=itype =(a t))) ~
8234+ ?: ?=(%union -.t) (tag-name-pattern [%cell at.i.ps ps] t args)
8235+ ?. ?=(%cell -.t) ~
8236+ =/ head=(unit [at=span name=term]) (tag-name-pattern i.ps hed.t args)
8237+ ?^ head head
8238+ $(ps t.ps, t tal.t)
8239+::
8166:: Split loobean fields into finite refinements for partial patterns.
8240:: Split loobean fields into finite refinements for partial patterns.
8167:: Keep original cases for binder types and preserve whole-case matching
8241:: Keep original cases for binder types and preserve whole-case matching
8168:: before trying refinements. Cap products at 64; unknown, empty or opaque
8242:: before trying refinements. Cap products at 64; unknown, empty or opaque
@@ -8876,6 +8950,8 @@
8876 ?: ?=(%| -.result) result
8950 ?: ?=(%| -.result) result
8877 [%& typ.p.result state.p.result(globals globals.state, molds molds.state)]
8951 [%& typ.p.result state.p.result(globals globals.state, molds molds.state)]
8878 %branch
8952 %branch
8953+ =/ named=(unit idiag) (branch-tag-name e env state)
8954+ ?^ named [%| u.named]
8879 ?^ defer.state (dg-boolean-branch e env state)
8955 ?^ defer.state (dg-boolean-branch e env state)
8880 ?~ arms.e [%| ["branch is not supported by partial inference" ~]]
8956 ?~ arms.e [%| ["branch is not supported by partial inference" ~]]
8881 ?~ t.arms.e
8957 ?~ t.arms.e
@@ -9713,6 +9789,8 @@
9713 ?: ?=(%bad -.fit) [%| ["recursive mold cell does not fit its source shape" ~]]
9789 ?: ?=(%bad -.fit) [%| ["recursive mold cell does not fit its source shape" ~]]
9714 [%& target state.p.value(sub sub.fit, next next.fit)]
9790 [%& target state.p.value(sub sub.fit, next next.fit)]
9715 ?: ?=(%call -.e) (infer-contextual-call e target env state)
9791 ?: ?=(%call -.e) (infer-contextual-call e target env state)
9792+ =/ named=(unit idiag) (branch-tag-name e env state)
9793+ ?^ named [%| u.named]
9716 =/ empty-list=(unit iresult) (empty-list-null-branch e env state `[target context])
9794 =/ empty-list=(unit iresult) (empty-list-null-branch e env state `[target context])
9717 ?^ empty-list u.empty-list
9795 ?^ empty-list u.empty-list
9718 ?: (single-structured-pattern e)
9796 ?: (single-structured-pattern e)
tests/golden/inline-pattern-tag-name-any-arm/about.txtnew file+4
@@ -0,0 +1,4 @@
1+source: Grammar tab, Patterns: "A name is an error where the subject's type at its position is a union, or a one-case mold, with a case whose constant there is the term the name spells"; "An arm that earlier arms cover ... is an error"
2+tests: the rule reads the subject's type, not the cases left: `stop` as the first arm is reported, not the arms it covers; `fail` after `%fail` is still an error; a grouped subject and a call as the subject
3+expect: parses
4+expect-types: a partial inference report: `first` is an error at `stop`, 13:5; `covered` at `fail`, 21:5; `grouped` at `late`, 25:5, with the subject `(r)` at 23:6; `pick` infers; `called` at `late`, 30:5, with the subject `(pick r)` at 28:6
tests/golden/inline-pattern-tag-name-any-arm/modules.txtnew file+1
@@ -0,0 +1 @@
1+# no module fixtures
tests/golden/inline-pattern-tag-name-any-arm/source.jibbnew file+30
@@ -0,0 +1,30 @@
1++$ step
2+ [%move %left n=@ud]
3+ [%move %right n=@ud]
4+ [text=@t %draft]
5+ [text=@t %sent at=@da]
6+ %stop
7++$ reason
8+ %fail
9+ %late
10+
11+++ first |= s=step
12+ ?- s
13+ stop "stop"
14+ [%move %left n] "left {n}"
15+ [%move %right n] "right {n}"
16+ [t %draft] t
17+ [t %sent sent-at] t
18+++ covered |= r=reason
19+ ?- r
20+ %fail "f"
21+ fail "l"
22+++ grouped |= r=reason
23+ ?- (r)
24+ %fail "f"
25+ late "l"
26+++ pick |= r=reason r
27+++ called |= r=reason
28+ ?- (pick r)
29+ %fail "f"
30+ late "l"
tests/golden/inline-pattern-tag-name-any-arm/tokens.txtnew file+160
@@ -0,0 +1,160 @@
1+1:1 glyph +$
2+1:4 name step
3+2:3 INDENT
4+2:3 glyph [
5+2:4 tight lit %move
6+2:10 lit %left
7+2:16 name n
8+2:17 tight glyph =
9+2:18 tight aura @ud
10+2:21 tight glyph ]
11+3:3 NEWLINE
12+3:3 glyph [
13+3:4 tight lit %move
14+3:10 lit %right
15+3:17 name n
16+3:18 tight glyph =
17+3:19 tight aura @ud
18+3:22 tight glyph ]
19+4:3 NEWLINE
20+4:3 glyph [
21+4:4 tight name text
22+4:8 tight glyph =
23+4:9 tight aura @t
24+4:12 lit %draft
25+4:18 tight glyph ]
26+5:3 NEWLINE
27+5:3 glyph [
28+5:4 tight name text
29+5:8 tight glyph =
30+5:9 tight aura @t
31+5:12 lit %sent
32+5:18 name at
33+5:20 tight glyph =
34+5:21 tight aura @da
35+5:24 tight glyph ]
36+6:3 NEWLINE
37+6:3 lit %stop
38+7:1 DEDENT
39+7:1 NEWLINE
40+7:1 glyph +$
41+7:4 name reason
42+8:3 INDENT
43+8:3 lit %fail
44+9:3 NEWLINE
45+9:3 lit %late
46+11:1 DEDENT
47+11:1 NEWLINE
48+11:1 glyph ++
49+11:4 name first
50+11:10 glyph |=
51+11:13 name s
52+11:14 tight glyph =
53+11:15 tight name step
54+12:3 INDENT
55+12:3 glyph ?-
56+12:6 name s
57+13:5 INDENT
58+13:5 name stop
59+13:23 str "stop"
60+14:5 NEWLINE
61+14:5 glyph [
62+14:6 tight lit %move
63+14:12 lit %left
64+14:18 name n
65+14:19 tight glyph ]
66+14:23 str-head "left "
67+14:30 tight name n
68+14:31 tight str-tail ""
69+15:5 NEWLINE
70+15:5 glyph [
71+15:6 tight lit %move
72+15:12 lit %right
73+15:19 name n
74+15:20 tight glyph ]
75+15:23 str-head "right "
76+15:31 tight name n
77+15:32 tight str-tail ""
78+16:5 NEWLINE
79+16:5 glyph [
80+16:6 tight name t
81+16:8 lit %draft
82+16:14 tight glyph ]
83+16:23 name t
84+17:5 NEWLINE
85+17:5 glyph [
86+17:6 tight name t
87+17:8 lit %sent
88+17:14 name sent-at
89+17:21 tight glyph ]
90+17:23 name t
91+18:1 DEDENT
92+18:1 DEDENT
93+18:1 NEWLINE
94+18:1 glyph ++
95+18:4 name covered
96+18:12 glyph |=
97+18:15 name r
98+18:16 tight glyph =
99+18:17 tight name reason
100+19:3 INDENT
101+19:3 glyph ?-
102+19:6 name r
103+20:5 INDENT
104+20:5 lit %fail
105+20:12 str "f"
106+21:5 NEWLINE
107+21:5 name fail
108+21:12 str "l"
109+22:1 DEDENT
110+22:1 DEDENT
111+22:1 NEWLINE
112+22:1 glyph ++
113+22:4 name grouped
114+22:12 glyph |=
115+22:15 name r
116+22:16 tight glyph =
117+22:17 tight name reason
118+23:3 INDENT
119+23:3 glyph ?-
120+23:6 glyph (
121+23:7 tight name r
122+23:8 tight glyph )
123+24:5 INDENT
124+24:5 lit %fail
125+24:12 str "f"
126+25:5 NEWLINE
127+25:5 name late
128+25:12 str "l"
129+26:1 DEDENT
130+26:1 DEDENT
131+26:1 NEWLINE
132+26:1 glyph ++
133+26:4 name pick
134+26:9 glyph |=
135+26:12 name r
136+26:13 tight glyph =
137+26:14 tight name reason
138+26:21 name r
139+27:1 NEWLINE
140+27:1 glyph ++
141+27:4 name called
142+27:11 glyph |=
143+27:14 name r
144+27:15 tight glyph =
145+27:16 tight name reason
146+28:3 INDENT
147+28:3 glyph ?-
148+28:6 glyph (
149+28:7 tight name pick
150+28:12 name r
151+28:13 tight glyph )
152+29:5 INDENT
153+29:5 lit %fail
154+29:12 str "f"
155+30:5 NEWLINE
156+30:5 name late
157+30:12 str "l"
158+30:15 DEDENT
159+30:15 DEDENT
160+30:15 NEWLINE
tests/golden/inline-pattern-tag-name-any-arm/tree.txtnew file+69
@@ -0,0 +1,69 @@
1+(module
2+ (mold 1:1 step
3+ (union 2:3
4+ (cell 2:3
5+ (const 2:4 %move)
6+ (const 2:10 %left)
7+ (face 2:16 n (aura 2:18 @ud)))
8+ (cell 3:3
9+ (const 3:4 %move)
10+ (const 3:10 %right)
11+ (face 3:17 n (aura 3:19 @ud)))
12+ (cell 4:3
13+ (face 4:4 text (aura 4:9 @t))
14+ (const 4:12 %draft))
15+ (cell 5:3
16+ (face 5:4 text (aura 5:9 @t))
17+ (const 5:12 %sent)
18+ (face 5:18 at (aura 5:21 @da)))
19+ (const 6:3 %stop)))
20+ (mold 7:1 reason
21+ (union 8:3 (const 8:3 %fail) (const 9:3 %late)))
22+ (value 11:1 first
23+ (gate 11:10
24+ (face 11:13 s (ref 11:15 step))
25+ (body 12:3
26+ (branch 12:3
27+ (wing 12:6 s)
28+ (arm 13:5 (bind 13:5 stop) (str 13:23 "stop"))
29+ (arm 14:5
30+ (cell 14:5 (lit 14:6 %move) (lit 14:12 %left) (bind 14:18 n))
31+ (str 14:23 "left " (wing 14:30 n)))
32+ (arm 15:5
33+ (cell 15:5 (lit 15:6 %move) (lit 15:12 %right) (bind 15:19 n))
34+ (str 15:23 "right " (wing 15:31 n)))
35+ (arm 16:5
36+ (cell 16:5 (bind 16:6 t) (lit 16:8 %draft))
37+ (wing 16:23 t))
38+ (arm 17:5
39+ (cell 17:5 (bind 17:6 t) (lit 17:8 %sent) (bind 17:14 sent-at))
40+ (wing 17:23 t))))))
41+ (value 18:1 covered
42+ (gate 18:12
43+ (face 18:15 r (ref 18:17 reason))
44+ (body 19:3
45+ (branch 19:3
46+ (wing 19:6 r)
47+ (arm 20:5 (lit 20:5 %fail) (str 20:12 "f"))
48+ (arm 21:5 (bind 21:5 fail) (str 21:12 "l"))))))
49+ (value 22:1 grouped
50+ (gate 22:12
51+ (face 22:15 r (ref 22:17 reason))
52+ (body 23:3
53+ (branch 23:3
54+ (group 23:6 (wing 23:7 r))
55+ (arm 24:5 (lit 24:5 %fail) (str 24:12 "f"))
56+ (arm 25:5 (bind 25:5 late) (str 25:12 "l"))))))
57+ (value 26:1 pick
58+ (gate 26:9
59+ (face 26:12 r (ref 26:14 reason))
60+ (wing 26:21 r)))
61+ (value 27:1 called
62+ (gate 27:11
63+ (face 27:14 r (ref 27:16 reason))
64+ (body 28:3
65+ (branch 28:3
66+ (group 28:6
67+ (call 28:7 (wing 28:7 pick) (wing 28:12 r)))
68+ (arm 29:5 (lit 29:5 %fail) (str 29:12 "f"))
69+ (arm 30:5 (bind 30:5 late) (str 30:12 "l")))))))
tests/golden/inline-pattern-tag-name-any-arm/types.txtnew file+32
@@ -0,0 +1,32 @@
1+partial inference; module not checked
2++$ step: cases proven disjoint; mold not checked
3++$ reason: cases proven disjoint; mold not checked
4+++ first: `stop` binds a name, but the subject's type has `%stop` here; write %stop, or * for a catch-all
5+/tests/golden/inline-pattern-tag-name-any-arm/source.jibb:12:6: subject
6+ ?- s
7+ ^
8+/tests/golden/inline-pattern-tag-name-any-arm/source.jibb:13:5: pattern name
9+ stop "stop"
10+ ^
11+++ covered: `fail` binds a name, but the subject's type has `%fail` here; write %fail, or * for a catch-all
12+/tests/golden/inline-pattern-tag-name-any-arm/source.jibb:19:6: subject
13+ ?- r
14+ ^
15+/tests/golden/inline-pattern-tag-name-any-arm/source.jibb:21:5: pattern name
16+ fail "l"
17+ ^
18+++ grouped: `late` binds a name, but the subject's type has `%late` here; write %late, or * for a catch-all
19+/tests/golden/inline-pattern-tag-name-any-arm/source.jibb:23:6: subject
20+ ?- (r)
21+ ^
22+/tests/golden/inline-pattern-tag-name-any-arm/source.jibb:25:5: pattern name
23+ late "l"
24+ ^
25+++ pick: $-(reason reason)
26+++ called: `late` binds a name, but the subject's type has `%late` here; write %late, or * for a catch-all
27+/tests/golden/inline-pattern-tag-name-any-arm/source.jibb:28:6: subject
28+ ?- (pick r)
29+ ^
30+/tests/golden/inline-pattern-tag-name-any-arm/source.jibb:30:5: pattern name
31+ late "l"
32+ ^
tests/golden/inline-pattern-tag-name-generic/about.txtnew file+4
@@ -0,0 +1,4 @@
1+source: Grammar tab, Patterns: "A name is an error where the subject's type at its position is a union, or a one-case mold, with a case whose constant there is the term the name spells"; "Positions typed by an aura, `*`, a type variable or a container's element are unaffected"
2+tests: a generic union's own cases count, as `%fail` and `%ok` of `(outcome A)`; a position its mold types by a type variable doesn't, even where the argument is a union with that tag: `[%ok fail]` on `(outcome reason)`, `[~ stop]` on `(unit step)`; nor does a list's element, `[stop rest]` on `(list step)`
3+expect: parses
4+expect-types: a partial inference report: `own-case` is an error at `fail`, 14:5, and `own-head` at `ok`, 17:6; `argument`, `maybe` and `items` infer
tests/golden/inline-pattern-tag-name-generic/modules.txtnew file+1
@@ -0,0 +1 @@
1+# Use the source-validated prelude unit and list.
tests/golden/inline-pattern-tag-name-generic/source.jibbnew file+30
@@ -0,0 +1,30 @@
1++$ step
2+ [%go n=@ud]
3+ %stop
4++$ outcome |$ [A]
5+ [%ok value=A]
6+ %fail
7++$ reason
8+ %fail
9+ %late
10+
11+++ own-case |= o=(outcome @t)
12+ ?- o
13+ [%ok v] v
14+ fail "failed"
15+++ own-head |= o=(outcome reason)
16+ ?- o
17+ [ok r] "x"
18+ %fail "failed"
19+++ argument |= o=(outcome reason)
20+ ?- o
21+ [%ok fail] "x"
22+ %fail "failed"
23+++ maybe |= u=(unit step)
24+ ?- u
25+ ~ "none"
26+ [~ stop] "s"
27+++ items |= xs=(list step)
28+ ?- xs
29+ ~ "none"
30+ [stop rest] "s"
tests/golden/inline-pattern-tag-name-generic/tokens.txtnew file+158
@@ -0,0 +1,158 @@
1+1:1 glyph +$
2+1:4 name step
3+2:3 INDENT
4+2:3 glyph [
5+2:4 tight lit %go
6+2:8 name n
7+2:9 tight glyph =
8+2:10 tight aura @ud
9+2:13 tight glyph ]
10+3:3 NEWLINE
11+3:3 lit %stop
12+4:1 DEDENT
13+4:1 NEWLINE
14+4:1 glyph +$
15+4:4 name outcome
16+4:12 glyph |$
17+4:15 glyph [
18+4:16 tight tvar A
19+4:17 tight glyph ]
20+5:3 INDENT
21+5:3 glyph [
22+5:4 tight lit %ok
23+5:8 name value
24+5:13 tight glyph =
25+5:14 tight tvar A
26+5:15 tight glyph ]
27+6:3 NEWLINE
28+6:3 lit %fail
29+7:1 DEDENT
30+7:1 NEWLINE
31+7:1 glyph +$
32+7:4 name reason
33+8:3 INDENT
34+8:3 lit %fail
35+9:3 NEWLINE
36+9:3 lit %late
37+11:1 DEDENT
38+11:1 NEWLINE
39+11:1 glyph ++
40+11:4 name own-case
41+11:13 glyph |=
42+11:16 name o
43+11:17 tight glyph =
44+11:18 tight glyph (
45+11:19 tight name outcome
46+11:27 aura @t
47+11:29 tight glyph )
48+12:3 INDENT
49+12:3 glyph ?-
50+12:6 name o
51+13:5 INDENT
52+13:5 glyph [
53+13:6 tight lit %ok
54+13:10 name v
55+13:11 tight glyph ]
56+13:14 name v
57+14:5 NEWLINE
58+14:5 name fail
59+14:14 str "failed"
60+15:1 DEDENT
61+15:1 DEDENT
62+15:1 NEWLINE
63+15:1 glyph ++
64+15:4 name own-head
65+15:13 glyph |=
66+15:16 name o
67+15:17 tight glyph =
68+15:18 tight glyph (
69+15:19 tight name outcome
70+15:27 name reason
71+15:33 tight glyph )
72+16:3 INDENT
73+16:3 glyph ?-
74+16:6 name o
75+17:5 INDENT
76+17:5 glyph [
77+17:6 tight name ok
78+17:9 name r
79+17:10 tight glyph ]
80+17:13 str "x"
81+18:5 NEWLINE
82+18:5 lit %fail
83+18:13 str "failed"
84+19:1 DEDENT
85+19:1 DEDENT
86+19:1 NEWLINE
87+19:1 glyph ++
88+19:4 name argument
89+19:13 glyph |=
90+19:16 name o
91+19:17 tight glyph =
92+19:18 tight glyph (
93+19:19 tight name outcome
94+19:27 name reason
95+19:33 tight glyph )
96+20:3 INDENT
97+20:3 glyph ?-
98+20:6 name o
99+21:5 INDENT
100+21:5 glyph [
101+21:6 tight lit %ok
102+21:10 name fail
103+21:14 tight glyph ]
104+21:17 str "x"
105+22:5 NEWLINE
106+22:5 lit %fail
107+22:17 str "failed"
108+23:1 DEDENT
109+23:1 DEDENT
110+23:1 NEWLINE
111+23:1 glyph ++
112+23:4 name maybe
113+23:10 glyph |=
114+23:13 name u
115+23:14 tight glyph =
116+23:15 tight glyph (
117+23:16 tight name unit
118+23:21 name step
119+23:25 tight glyph )
120+24:3 INDENT
121+24:3 glyph ?-
122+24:6 name u
123+25:5 INDENT
124+25:5 lit ~
125+25:15 str "none"
126+26:5 NEWLINE
127+26:5 glyph [
128+26:6 tight lit ~
129+26:8 name stop
130+26:12 tight glyph ]
131+26:15 str "s"
132+27:1 DEDENT
133+27:1 DEDENT
134+27:1 NEWLINE
135+27:1 glyph ++
136+27:4 name items
137+27:10 glyph |=
138+27:13 name xs
139+27:15 tight glyph =
140+27:16 tight glyph (
141+27:17 tight name list
142+27:22 name step
143+27:26 tight glyph )
144+28:3 INDENT
145+28:3 glyph ?-
146+28:6 name xs
147+29:5 INDENT
148+29:5 lit ~
149+29:18 str "none"
150+30:5 NEWLINE
151+30:5 glyph [
152+30:6 tight name stop
153+30:11 name rest
154+30:15 tight glyph ]
155+30:18 str "s"
156+30:21 DEDENT
157+30:21 DEDENT
158+30:21 NEWLINE
tests/golden/inline-pattern-tag-name-generic/tree.txtnew file+71
@@ -0,0 +1,71 @@
1+(module
2+ (mold 1:1 step
3+ (union 2:3
4+ (cell 2:3
5+ (const 2:4 %go)
6+ (face 2:8 n (aura 2:10 @ud)))
7+ (const 3:3 %stop)))
8+ (mold 4:1 outcome
9+ (generic 4:12 A
10+ (union 5:3
11+ (cell 5:3
12+ (const 5:4 %ok)
13+ (face 5:8 value (tvar 5:14 A)))
14+ (const 6:3 %fail))))
15+ (mold 7:1 reason
16+ (union 8:3 (const 8:3 %fail) (const 9:3 %late)))
17+ (value 11:1 own-case
18+ (gate 11:13
19+ (face 11:16 o
20+ (apply 11:18 outcome (aura 11:27 @t)))
21+ (body 12:3
22+ (branch 12:3
23+ (wing 12:6 o)
24+ (arm 13:5
25+ (cell 13:5 (lit 13:6 %ok) (bind 13:10 v))
26+ (wing 13:14 v))
27+ (arm 14:5 (bind 14:5 fail) (str 14:14 "failed"))))))
28+ (value 15:1 own-head
29+ (gate 15:13
30+ (face 15:16 o
31+ (apply 15:18 outcome (ref 15:27 reason)))
32+ (body 16:3
33+ (branch 16:3
34+ (wing 16:6 o)
35+ (arm 17:5
36+ (cell 17:5 (bind 17:6 ok) (bind 17:9 r))
37+ (str 17:13 "x"))
38+ (arm 18:5 (lit 18:5 %fail) (str 18:13 "failed"))))))
39+ (value 19:1 argument
40+ (gate 19:13
41+ (face 19:16 o
42+ (apply 19:18 outcome (ref 19:27 reason)))
43+ (body 20:3
44+ (branch 20:3
45+ (wing 20:6 o)
46+ (arm 21:5
47+ (cell 21:5 (lit 21:6 %ok) (bind 21:10 fail))
48+ (str 21:17 "x"))
49+ (arm 22:5 (lit 22:5 %fail) (str 22:17 "failed"))))))
50+ (value 23:1 maybe
51+ (gate 23:10
52+ (face 23:13 u
53+ (apply 23:15 unit (ref 23:21 step)))
54+ (body 24:3
55+ (branch 24:3
56+ (wing 24:6 u)
57+ (arm 25:5 (lit 25:5 ~) (str 25:15 "none"))
58+ (arm 26:5
59+ (cell 26:5 (lit 26:6 ~) (bind 26:8 stop))
60+ (str 26:15 "s"))))))
61+ (value 27:1 items
62+ (gate 27:10
63+ (face 27:13 xs
64+ (apply 27:16 list (ref 27:22 step)))
65+ (body 28:3
66+ (branch 28:3
67+ (wing 28:6 xs)
68+ (arm 29:5 (lit 29:5 ~) (str 29:18 "none"))
69+ (arm 30:5
70+ (cell 30:5 (bind 30:6 stop) (bind 30:11 rest))
71+ (str 30:18 "s")))))))
tests/golden/inline-pattern-tag-name-generic/types.txtnew file+21
@@ -0,0 +1,21 @@
1+partial inference; module not checked
2++$ step: cases proven disjoint; mold not checked
3++$ outcome: cases proven disjoint; mold not checked
4++$ reason: cases proven disjoint; mold not checked
5+++ own-case: `fail` binds a name, but the subject's type has `%fail` here; write %fail, or * for a catch-all
6+/tests/golden/inline-pattern-tag-name-generic/source.jibb:12:6: subject
7+ ?- o
8+ ^
9+/tests/golden/inline-pattern-tag-name-generic/source.jibb:14:5: pattern name
10+ fail "failed"
11+ ^
12+++ own-head: `ok` binds a name, but the subject's type has `%ok` here; write %ok, or * for a catch-all
13+/tests/golden/inline-pattern-tag-name-generic/source.jibb:16:6: subject
14+ ?- o
15+ ^
16+/tests/golden/inline-pattern-tag-name-generic/source.jibb:17:6: pattern name
17+ [ok r] "x"
18+ ^
19+++ argument: $-((outcome reason) @t)
20+++ maybe: $-((unit step) @t)
21+++ items: $-((list step) @t)
tests/golden/inline-pattern-tag-name-last/about.txtnew file+4
@@ -0,0 +1,4 @@
1+source: Grammar tab, Patterns: "A name is an error where the subject's type at its position is a union, or a one-case mold, with a case whose constant there is the term the name spells", so `stop` written for `%stop` below is an error, not a catch-all; the Patterns section's `step` block with its last arm's `%` dropped
2+tests: a bare name in a `?-`'s last arm that spells a case of the subject's union, which would otherwise catch every case left
3+expect: parses
4+expect-types: a partial inference report: `describe` is an error at `stop`, 14:5, since `step` has the case `%stop`, with the subject at 9:6
tests/golden/inline-pattern-tag-name-last/modules.txtnew file+1
@@ -0,0 +1 @@
1+# no module fixtures
tests/golden/inline-pattern-tag-name-last/source.jibbnew file+14
@@ -0,0 +1,14 @@
1++$ step
2+ [%move %left n=@ud]
3+ [%move %right n=@ud]
4+ [text=@t %draft]
5+ [text=@t %sent at=@da]
6+ %stop
7+
8+++ describe |= s=step
9+ ?- s
10+ [%move %left n] "left {n}"
11+ [%move %right n] "right {n}"
12+ [t %draft] t
13+ [t %sent sent-at] t
14+ stop "stop"
tests/golden/inline-pattern-tag-name-last/tokens.txtnew file+85
@@ -0,0 +1,85 @@
1+1:1 glyph +$
2+1:4 name step
3+2:3 INDENT
4+2:3 glyph [
5+2:4 tight lit %move
6+2:10 lit %left
7+2:16 name n
8+2:17 tight glyph =
9+2:18 tight aura @ud
10+2:21 tight glyph ]
11+3:3 NEWLINE
12+3:3 glyph [
13+3:4 tight lit %move
14+3:10 lit %right
15+3:17 name n
16+3:18 tight glyph =
17+3:19 tight aura @ud
18+3:22 tight glyph ]
19+4:3 NEWLINE
20+4:3 glyph [
21+4:4 tight name text
22+4:8 tight glyph =
23+4:9 tight aura @t
24+4:12 lit %draft
25+4:18 tight glyph ]
26+5:3 NEWLINE
27+5:3 glyph [
28+5:4 tight name text
29+5:8 tight glyph =
30+5:9 tight aura @t
31+5:12 lit %sent
32+5:18 name at
33+5:20 tight glyph =
34+5:21 tight aura @da
35+5:24 tight glyph ]
36+6:3 NEWLINE
37+6:3 lit %stop
38+8:1 DEDENT
39+8:1 NEWLINE
40+8:1 glyph ++
41+8:4 name describe
42+8:13 glyph |=
43+8:16 name s
44+8:17 tight glyph =
45+8:18 tight name step
46+9:3 INDENT
47+9:3 glyph ?-
48+9:6 name s
49+10:5 INDENT
50+10:5 glyph [
51+10:6 tight lit %move
52+10:12 lit %left
53+10:18 name n
54+10:19 tight glyph ]
55+10:23 str-head "left "
56+10:30 tight name n
57+10:31 tight str-tail ""
58+11:5 NEWLINE
59+11:5 glyph [
60+11:6 tight lit %move
61+11:12 lit %right
62+11:19 name n
63+11:20 tight glyph ]
64+11:23 str-head "right "
65+11:31 tight name n
66+11:32 tight str-tail ""
67+12:5 NEWLINE
68+12:5 glyph [
69+12:6 tight name t
70+12:8 lit %draft
71+12:14 tight glyph ]
72+12:23 name t
73+13:5 NEWLINE
74+13:5 glyph [
75+13:6 tight name t
76+13:8 lit %sent
77+13:14 name sent-at
78+13:21 tight glyph ]
79+13:23 name t
80+14:5 NEWLINE
81+14:5 name stop
82+14:23 str "stop"
83+14:29 DEDENT
84+14:29 DEDENT
85+14:29 NEWLINE
tests/golden/inline-pattern-tag-name-last/tree.txtnew file+38
@@ -0,0 +1,38 @@
1+(module
2+ (mold 1:1 step
3+ (union 2:3
4+ (cell 2:3
5+ (const 2:4 %move)
6+ (const 2:10 %left)
7+ (face 2:16 n (aura 2:18 @ud)))
8+ (cell 3:3
9+ (const 3:4 %move)
10+ (const 3:10 %right)
11+ (face 3:17 n (aura 3:19 @ud)))
12+ (cell 4:3
13+ (face 4:4 text (aura 4:9 @t))
14+ (const 4:12 %draft))
15+ (cell 5:3
16+ (face 5:4 text (aura 5:9 @t))
17+ (const 5:12 %sent)
18+ (face 5:18 at (aura 5:21 @da)))
19+ (const 6:3 %stop)))
20+ (value 8:1 describe
21+ (gate 8:13
22+ (face 8:16 s (ref 8:18 step))
23+ (body 9:3
24+ (branch 9:3
25+ (wing 9:6 s)
26+ (arm 10:5
27+ (cell 10:5 (lit 10:6 %move) (lit 10:12 %left) (bind 10:18 n))
28+ (str 10:23 "left " (wing 10:30 n)))
29+ (arm 11:5
30+ (cell 11:5 (lit 11:6 %move) (lit 11:12 %right) (bind 11:19 n))
31+ (str 11:23 "right " (wing 11:31 n)))
32+ (arm 12:5
33+ (cell 12:5 (bind 12:6 t) (lit 12:8 %draft))
34+ (wing 12:23 t))
35+ (arm 13:5
36+ (cell 13:5 (bind 13:6 t) (lit 13:8 %sent) (bind 13:14 sent-at))
37+ (wing 13:23 t))
38+ (arm 14:5 (bind 14:5 stop) (str 14:23 "stop")))))))
tests/golden/inline-pattern-tag-name-last/types.txtnew file+9
@@ -0,0 +1,9 @@
1+partial inference; module not checked
2++$ step: cases proven disjoint; mold not checked
3+++ describe: `stop` binds a name, but the subject's type has `%stop` here; write %stop, or * for a catch-all
4+/tests/golden/inline-pattern-tag-name-last/source.jibb:9:6: subject
5+ ?- s
6+ ^
7+/tests/golden/inline-pattern-tag-name-last/source.jibb:14:5: pattern name
8+ stop "stop"
9+ ^
tests/golden/inline-pattern-tag-name-nested/about.txtnew file+4
@@ -0,0 +1,4 @@
1+source: Grammar tab, Patterns: "A name is an error where the subject's type at its position is a union, or a one-case mold, with a case whose constant there is the term the name spells"; the review's `[typed t]` for `[%typed t]`
2+tests: names inside cell patterns: at a case's head, where the union's cases have the tags `%typed` and `%submit`; at a position typed by the union mold `dir`; at a case's tail, where it is `%draft`
3+expect: parses
4+expect-types: a partial inference report: `typed` is an error at `typed`, 15:6; `move` at `left`, 20:12; `draft` at `draft`, 26:8; each with its subject
tests/golden/inline-pattern-tag-name-nested/modules.txtnew file+1
@@ -0,0 +1 @@
1+# no module fixtures
tests/golden/inline-pattern-tag-name-nested/source.jibbnew file+27
@@ -0,0 +1,27 @@
1++$ msg
2+ [%typed text=@t]
3+ [%submit ~]
4+ %clear
5++$ dir
6+ %left
7+ %right
8++$ step
9+ [%move d=dir n=@ud]
10+ [text=@t %draft]
11+ %stop
12+
13+++ typed |= m=msg
14+ ?- m
15+ [typed t] t
16+ [%submit ~] "s"
17+ %clear "c"
18+++ move |= s=step
19+ ?- s
20+ [%move left n] "x"
21+ [t %draft] t
22+ %stop "s"
23+++ draft |= s=step
24+ ?- s
25+ [%move d n] "x"
26+ [t draft] t
27+ %stop "s"
tests/golden/inline-pattern-tag-name-nested/tokens.txtnew file+132
@@ -0,0 +1,132 @@
1+1:1 glyph +$
2+1:4 name msg
3+2:3 INDENT
4+2:3 glyph [
5+2:4 tight lit %typed
6+2:11 name text
7+2:15 tight glyph =
8+2:16 tight aura @t
9+2:18 tight glyph ]
10+3:3 NEWLINE
11+3:3 glyph [
12+3:4 tight lit %submit
13+3:12 lit ~
14+3:13 tight glyph ]
15+4:3 NEWLINE
16+4:3 lit %clear
17+5:1 DEDENT
18+5:1 NEWLINE
19+5:1 glyph +$
20+5:4 name dir
21+6:3 INDENT
22+6:3 lit %left
23+7:3 NEWLINE
24+7:3 lit %right
25+8:1 DEDENT
26+8:1 NEWLINE
27+8:1 glyph +$
28+8:4 name step
29+9:3 INDENT
30+9:3 glyph [
31+9:4 tight lit %move
32+9:10 name d
33+9:11 tight glyph =
34+9:12 tight name dir
35+9:16 name n
36+9:17 tight glyph =
37+9:18 tight aura @ud
38+9:21 tight glyph ]
39+10:3 NEWLINE
40+10:3 glyph [
41+10:4 tight name text
42+10:8 tight glyph =
43+10:9 tight aura @t
44+10:12 lit %draft
45+10:18 tight glyph ]
46+11:3 NEWLINE
47+11:3 lit %stop
48+13:1 DEDENT
49+13:1 NEWLINE
50+13:1 glyph ++
51+13:4 name typed
52+13:10 glyph |=
53+13:13 name m
54+13:14 tight glyph =
55+13:15 tight name msg
56+14:3 INDENT
57+14:3 glyph ?-
58+14:6 name m
59+15:5 INDENT
60+15:5 glyph [
61+15:6 tight name typed
62+15:12 name t
63+15:13 tight glyph ]
64+15:17 name t
65+16:5 NEWLINE
66+16:5 glyph [
67+16:6 tight lit %submit
68+16:14 lit ~
69+16:15 tight glyph ]
70+16:17 str "s"
71+17:5 NEWLINE
72+17:5 lit %clear
73+17:17 str "c"
74+18:1 DEDENT
75+18:1 DEDENT
76+18:1 NEWLINE
77+18:1 glyph ++
78+18:4 name move
79+18:9 glyph |=
80+18:12 name s
81+18:13 tight glyph =
82+18:14 tight name step
83+19:3 INDENT
84+19:3 glyph ?-
85+19:6 name s
86+20:5 INDENT
87+20:5 glyph [
88+20:6 tight lit %move
89+20:12 name left
90+20:17 name n
91+20:18 tight glyph ]
92+20:20 str "x"
93+21:5 NEWLINE
94+21:5 glyph [
95+21:6 tight name t
96+21:8 lit %draft
97+21:14 tight glyph ]
98+21:20 name t
99+22:5 NEWLINE
100+22:5 lit %stop
101+22:20 str "s"
102+23:1 DEDENT
103+23:1 DEDENT
104+23:1 NEWLINE
105+23:1 glyph ++
106+23:4 name draft
107+23:10 glyph |=
108+23:13 name s
109+23:14 tight glyph =
110+23:15 tight name step
111+24:3 INDENT
112+24:3 glyph ?-
113+24:6 name s
114+25:5 INDENT
115+25:5 glyph [
116+25:6 tight lit %move
117+25:12 name d
118+25:14 name n
119+25:15 tight glyph ]
120+25:20 str "x"
121+26:5 NEWLINE
122+26:5 glyph [
123+26:6 tight name t
124+26:8 name draft
125+26:13 tight glyph ]
126+26:20 name t
127+27:5 NEWLINE
128+27:5 lit %stop
129+27:20 str "s"
130+27:23 DEDENT
131+27:23 DEDENT
132+27:23 NEWLINE
tests/golden/inline-pattern-tag-name-nested/tree.txtnew file+59
@@ -0,0 +1,59 @@
1+(module
2+ (mold 1:1 msg
3+ (union 2:3
4+ (cell 2:3
5+ (const 2:4 %typed)
6+ (face 2:11 text (aura 2:16 @t)))
7+ (cell 3:3 (const 3:4 %submit) (const 3:12 ~))
8+ (const 4:3 %clear)))
9+ (mold 5:1 dir
10+ (union 6:3 (const 6:3 %left) (const 7:3 %right)))
11+ (mold 8:1 step
12+ (union 9:3
13+ (cell 9:3
14+ (const 9:4 %move)
15+ (face 9:10 d (ref 9:12 dir))
16+ (face 9:16 n (aura 9:18 @ud)))
17+ (cell 10:3
18+ (face 10:4 text (aura 10:9 @t))
19+ (const 10:12 %draft))
20+ (const 11:3 %stop)))
21+ (value 13:1 typed
22+ (gate 13:10
23+ (face 13:13 m (ref 13:15 msg))
24+ (body 14:3
25+ (branch 14:3
26+ (wing 14:6 m)
27+ (arm 15:5
28+ (cell 15:5 (bind 15:6 typed) (bind 15:12 t))
29+ (wing 15:17 t))
30+ (arm 16:5
31+ (cell 16:5 (lit 16:6 %submit) (lit 16:14 ~))
32+ (str 16:17 "s"))
33+ (arm 17:5 (lit 17:5 %clear) (str 17:17 "c"))))))
34+ (value 18:1 move
35+ (gate 18:9
36+ (face 18:12 s (ref 18:14 step))
37+ (body 19:3
38+ (branch 19:3
39+ (wing 19:6 s)
40+ (arm 20:5
41+ (cell 20:5 (lit 20:6 %move) (bind 20:12 left) (bind 20:17 n))
42+ (str 20:20 "x"))
43+ (arm 21:5
44+ (cell 21:5 (bind 21:6 t) (lit 21:8 %draft))
45+ (wing 21:20 t))
46+ (arm 22:5 (lit 22:5 %stop) (str 22:20 "s"))))))
47+ (value 23:1 draft
48+ (gate 23:10
49+ (face 23:13 s (ref 23:15 step))
50+ (body 24:3
51+ (branch 24:3
52+ (wing 24:6 s)
53+ (arm 25:5
54+ (cell 25:5 (lit 25:6 %move) (bind 25:12 d) (bind 25:14 n))
55+ (str 25:20 "x"))
56+ (arm 26:5
57+ (cell 26:5 (bind 26:6 t) (bind 26:8 draft))
58+ (wing 26:20 t))
59+ (arm 27:5 (lit 27:5 %stop) (str 27:20 "s")))))))
tests/golden/inline-pattern-tag-name-nested/types.txtnew file+25
@@ -0,0 +1,25 @@
1+partial inference; module not checked
2++$ msg: cases proven disjoint; mold not checked
3++$ dir: cases proven disjoint; mold not checked
4++$ step: cases proven disjoint; mold not checked
5+++ typed: `typed` binds a name, but the subject's type has `%typed` here; write %typed, or * for a catch-all
6+/tests/golden/inline-pattern-tag-name-nested/source.jibb:14:6: subject
7+ ?- m
8+ ^
9+/tests/golden/inline-pattern-tag-name-nested/source.jibb:15:6: pattern name
10+ [typed t] t
11+ ^
12+++ move: `left` binds a name, but the subject's type has `%left` here; write %left, or * for a catch-all
13+/tests/golden/inline-pattern-tag-name-nested/source.jibb:19:6: subject
14+ ?- s
15+ ^
16+/tests/golden/inline-pattern-tag-name-nested/source.jibb:20:12: pattern name
17+ [%move left n] "x"
18+ ^
19+++ draft: `draft` binds a name, but the subject's type has `%draft` here; write %draft, or * for a catch-all
20+/tests/golden/inline-pattern-tag-name-nested/source.jibb:24:6: subject
21+ ?- s
22+ ^
23+/tests/golden/inline-pattern-tag-name-nested/source.jibb:26:8: pattern name
24+ [t draft] t
25+ ^
tests/golden/inline-pattern-tag-name-ok/about.txtnew file+4
@@ -0,0 +1,4 @@
1+source: Grammar tab, Patterns: "A name is an error where the subject's type at its position is a union, or a one-case mold, with a case whose constant there is the term the name spells"; "Positions typed by an aura, `*`, a type variable or a container's element are unaffected, so `[t %draft] t` still binds `t`, and `x` is still a catch-all on a `@tas` subject"; Decisions, "Sample names": "Every bare name in a sample binds"
2+tests: names the rule leaves alone: `t` at `@t` in `[t %draft]`; `move` where the matching case has `@t`, though another case has `%move` there; `left` binding a case's tail `[%left n]`, a cell; `red` and `green` at `@ud` and `@t` positions, and `red` as a catch-all, spelling tags of a different union; a sample named `stop`, faced and bare; `stop` on `@tas` and `*` subjects
3+expect: parses
4+expect-types: a partial inference report: `describe`, `elsewhere`, `aura`, `other-union`, `sample` and `sample-bare` infer; `rest`, `atom` and `noun` give the partial checker's unsupported messages, not the tag-name error, since it doesn't yet check a pattern that splits a case, or a `?-` on an atom or a noun
tests/golden/inline-pattern-tag-name-ok/modules.txtnew file+1
@@ -0,0 +1 @@
1+# no module fixtures
tests/golden/inline-pattern-tag-name-ok/source.jibbnew file+53
@@ -0,0 +1,53 @@
1++$ step
2+ [%move %left n=@ud]
3+ [%move %right n=@ud]
4+ [text=@t %draft]
5+ [text=@t %sent at=@da]
6+ %stop
7++$ colour
8+ %red
9+ %green
10++$ shape
11+ [%circle red=@ud]
12+ [%label text=@t]
13+ %blank
14+
15+++ describe |= s=step
16+ ?- s
17+ [%move %left n] "left {n}"
18+ [%move %right n] "right {n}"
19+ [t %draft] t
20+ [t %sent sent-at] t
21+ %stop "stop"
22+++ elsewhere |= s=step
23+ ?- s
24+ [%move %left n] "left {n}"
25+ [%move %right n] "right {n}"
26+ [move %draft] move
27+ [t %sent sent-at] t
28+ %stop "stop"
29+++ rest |= s=step
30+ ?- s
31+ [%move left] "move"
32+ [t %draft] t
33+ [t %sent sent-at] t
34+ %stop "stop"
35+++ aura |= s=shape
36+ ?- s
37+ [%circle red] "{red}"
38+ [%label green] green
39+ %blank "blank"
40+++ other-union |= s=shape
41+ ?- s
42+ [%circle r] "{r}"
43+ [%label t] t
44+ red "other"
45+++ sample |= stop=step "sample"
46+++ sample-bare ^- $-(step @t) |= stop "sample"
47+++ atom |= s=@tas
48+ ?- s
49+ %stop "stop"
50+ stop "other"
51+++ noun |= s=*
52+ ?- s
53+ stop "any"
tests/golden/inline-pattern-tag-name-ok/tokens.txtnew file+303
@@ -0,0 +1,303 @@
1+1:1 glyph +$
2+1:4 name step
3+2:3 INDENT
4+2:3 glyph [
5+2:4 tight lit %move
6+2:10 lit %left
7+2:16 name n
8+2:17 tight glyph =
9+2:18 tight aura @ud
10+2:21 tight glyph ]
11+3:3 NEWLINE
12+3:3 glyph [
13+3:4 tight lit %move
14+3:10 lit %right
15+3:17 name n
16+3:18 tight glyph =
17+3:19 tight aura @ud
18+3:22 tight glyph ]
19+4:3 NEWLINE
20+4:3 glyph [
21+4:4 tight name text
22+4:8 tight glyph =
23+4:9 tight aura @t
24+4:12 lit %draft
25+4:18 tight glyph ]
26+5:3 NEWLINE
27+5:3 glyph [
28+5:4 tight name text
29+5:8 tight glyph =
30+5:9 tight aura @t
31+5:12 lit %sent
32+5:18 name at
33+5:20 tight glyph =
34+5:21 tight aura @da
35+5:24 tight glyph ]
36+6:3 NEWLINE
37+6:3 lit %stop
38+7:1 DEDENT
39+7:1 NEWLINE
40+7:1 glyph +$
41+7:4 name colour
42+8:3 INDENT
43+8:3 lit %red
44+9:3 NEWLINE
45+9:3 lit %green
46+10:1 DEDENT
47+10:1 NEWLINE
48+10:1 glyph +$
49+10:4 name shape
50+11:3 INDENT
51+11:3 glyph [
52+11:4 tight lit %circle
53+11:12 name red
54+11:15 tight glyph =
55+11:16 tight aura @ud
56+11:19 tight glyph ]
57+12:3 NEWLINE
58+12:3 glyph [
59+12:4 tight lit %label
60+12:11 name text
61+12:15 tight glyph =
62+12:16 tight aura @t
63+12:18 tight glyph ]
64+13:3 NEWLINE
65+13:3 lit %blank
66+15:1 DEDENT
67+15:1 NEWLINE
68+15:1 glyph ++
69+15:4 name describe
70+15:13 glyph |=
71+15:16 name s
72+15:17 tight glyph =
73+15:18 tight name step
74+16:3 INDENT
75+16:3 glyph ?-
76+16:6 name s
77+17:5 INDENT
78+17:5 glyph [
79+17:6 tight lit %move
80+17:12 lit %left
81+17:18 name n
82+17:19 tight glyph ]
83+17:23 str-head "left "
84+17:30 tight name n
85+17:31 tight str-tail ""
86+18:5 NEWLINE
87+18:5 glyph [
88+18:6 tight lit %move
89+18:12 lit %right
90+18:19 name n
91+18:20 tight glyph ]
92+18:23 str-head "right "
93+18:31 tight name n
94+18:32 tight str-tail ""
95+19:5 NEWLINE
96+19:5 glyph [
97+19:6 tight name t
98+19:8 lit %draft
99+19:14 tight glyph ]
100+19:23 name t
101+20:5 NEWLINE
102+20:5 glyph [
103+20:6 tight name t
104+20:8 lit %sent
105+20:14 name sent-at
106+20:21 tight glyph ]
107+20:23 name t
108+21:5 NEWLINE
109+21:5 lit %stop
110+21:23 str "stop"
111+22:1 DEDENT
112+22:1 DEDENT
113+22:1 NEWLINE
114+22:1 glyph ++
115+22:4 name elsewhere
116+22:14 glyph |=
117+22:17 name s
118+22:18 tight glyph =
119+22:19 tight name step
120+23:3 INDENT
121+23:3 glyph ?-
122+23:6 name s
123+24:5 INDENT
124+24:5 glyph [
125+24:6 tight lit %move
126+24:12 lit %left
127+24:18 name n
128+24:19 tight glyph ]
129+24:23 str-head "left "
130+24:30 tight name n
131+24:31 tight str-tail ""
132+25:5 NEWLINE
133+25:5 glyph [
134+25:6 tight lit %move
135+25:12 lit %right
136+25:19 name n
137+25:20 tight glyph ]
138+25:23 str-head "right "
139+25:31 tight name n
140+25:32 tight str-tail ""
141+26:5 NEWLINE
142+26:5 glyph [
143+26:6 tight name move
144+26:11 lit %draft
145+26:17 tight glyph ]
146+26:23 name move
147+27:5 NEWLINE
148+27:5 glyph [
149+27:6 tight name t
150+27:8 lit %sent
151+27:14 name sent-at
152+27:21 tight glyph ]
153+27:23 name t
154+28:5 NEWLINE
155+28:5 lit %stop
156+28:23 str "stop"
157+29:1 DEDENT
158+29:1 DEDENT
159+29:1 NEWLINE
160+29:1 glyph ++
161+29:4 name rest
162+29:9 glyph |=
163+29:12 name s
164+29:13 tight glyph =
165+29:14 tight name step
166+30:3 INDENT
167+30:3 glyph ?-
168+30:6 name s
169+31:5 INDENT
170+31:5 glyph [
171+31:6 tight lit %move
172+31:12 name left
173+31:16 tight glyph ]
174+31:23 str "move"
175+32:5 NEWLINE
176+32:5 glyph [
177+32:6 tight name t
178+32:8 lit %draft
179+32:14 tight glyph ]
180+32:23 name t
181+33:5 NEWLINE
182+33:5 glyph [
183+33:6 tight name t
184+33:8 lit %sent
185+33:14 name sent-at
186+33:21 tight glyph ]
187+33:23 name t
188+34:5 NEWLINE
189+34:5 lit %stop
190+34:23 str "stop"
191+35:1 DEDENT
192+35:1 DEDENT
193+35:1 NEWLINE
194+35:1 glyph ++
195+35:4 name aura
196+35:9 glyph |=
197+35:12 name s
198+35:13 tight glyph =
199+35:14 tight name shape
200+36:3 INDENT
201+36:3 glyph ?-
202+36:6 name s
203+37:5 INDENT
204+37:5 glyph [
205+37:6 tight lit %circle
206+37:14 name red
207+37:17 tight glyph ]
208+37:20 str-head ""
209+37:22 tight name red
210+37:25 tight str-tail ""
211+38:5 NEWLINE
212+38:5 glyph [
213+38:6 tight lit %label
214+38:13 name green
215+38:18 tight glyph ]
216+38:20 name green
217+39:5 NEWLINE
218+39:5 lit %blank
219+39:20 str "blank"
220+40:1 DEDENT
221+40:1 DEDENT
222+40:1 NEWLINE
223+40:1 glyph ++
224+40:4 name other-union
225+40:16 glyph |=
226+40:19 name s
227+40:20 tight glyph =
228+40:21 tight name shape
229+41:3 INDENT
230+41:3 glyph ?-
231+41:6 name s
232+42:5 INDENT
233+42:5 glyph [
234+42:6 tight lit %circle
235+42:14 name r
236+42:15 tight glyph ]
237+42:18 str-head ""
238+42:20 tight name r
239+42:21 tight str-tail ""
240+43:5 NEWLINE
241+43:5 glyph [
242+43:6 tight lit %label
243+43:13 name t
244+43:14 tight glyph ]
245+43:18 name t
246+44:5 NEWLINE
247+44:5 name red
248+44:18 str "other"
249+45:1 DEDENT
250+45:1 DEDENT
251+45:1 NEWLINE
252+45:1 glyph ++
253+45:4 name sample
254+45:11 glyph |=
255+45:14 name stop
256+45:18 tight glyph =
257+45:19 tight name step
258+45:24 str "sample"
259+46:1 NEWLINE
260+46:1 glyph ++
261+46:4 name sample-bare
262+46:16 glyph ^-
263+46:19 glyph $-(
264+46:22 tight name step
265+46:27 aura @t
266+46:29 tight glyph )
267+46:31 glyph |=
268+46:34 name stop
269+46:39 str "sample"
270+47:1 NEWLINE
271+47:1 glyph ++
272+47:4 name atom
273+47:9 glyph |=
274+47:12 name s
275+47:13 tight glyph =
276+47:14 tight aura @tas
277+48:3 INDENT
278+48:3 glyph ?-
279+48:6 name s
280+49:5 INDENT
281+49:5 lit %stop
282+49:12 str "stop"
283+50:5 NEWLINE
284+50:5 name stop
285+50:12 str "other"
286+51:1 DEDENT
287+51:1 DEDENT
288+51:1 NEWLINE
289+51:1 glyph ++
290+51:4 name noun
291+51:9 glyph |=
292+51:12 name s
293+51:13 tight glyph =
294+51:14 tight glyph *
295+52:3 INDENT
296+52:3 glyph ?-
297+52:6 name s
298+53:5 INDENT
299+53:5 name stop
300+53:11 str "any"
301+53:16 DEDENT
302+53:16 DEDENT
303+53:16 NEWLINE
tests/golden/inline-pattern-tag-name-ok/tree.txtnew file+133
@@ -0,0 +1,133 @@
1+(module
2+ (mold 1:1 step
3+ (union 2:3
4+ (cell 2:3
5+ (const 2:4 %move)
6+ (const 2:10 %left)
7+ (face 2:16 n (aura 2:18 @ud)))
8+ (cell 3:3
9+ (const 3:4 %move)
10+ (const 3:10 %right)
11+ (face 3:17 n (aura 3:19 @ud)))
12+ (cell 4:3
13+ (face 4:4 text (aura 4:9 @t))
14+ (const 4:12 %draft))
15+ (cell 5:3
16+ (face 5:4 text (aura 5:9 @t))
17+ (const 5:12 %sent)
18+ (face 5:18 at (aura 5:21 @da)))
19+ (const 6:3 %stop)))
20+ (mold 7:1 colour
21+ (union 8:3 (const 8:3 %red) (const 9:3 %green)))
22+ (mold 10:1 shape
23+ (union 11:3
24+ (cell 11:3
25+ (const 11:4 %circle)
26+ (face 11:12 red (aura 11:16 @ud)))
27+ (cell 12:3
28+ (const 12:4 %label)
29+ (face 12:11 text (aura 12:16 @t)))
30+ (const 13:3 %blank)))
31+ (value 15:1 describe
32+ (gate 15:13
33+ (face 15:16 s (ref 15:18 step))
34+ (body 16:3
35+ (branch 16:3
36+ (wing 16:6 s)
37+ (arm 17:5
38+ (cell 17:5 (lit 17:6 %move) (lit 17:12 %left) (bind 17:18 n))
39+ (str 17:23 "left " (wing 17:30 n)))
40+ (arm 18:5
41+ (cell 18:5 (lit 18:6 %move) (lit 18:12 %right) (bind 18:19 n))
42+ (str 18:23 "right " (wing 18:31 n)))
43+ (arm 19:5
44+ (cell 19:5 (bind 19:6 t) (lit 19:8 %draft))
45+ (wing 19:23 t))
46+ (arm 20:5
47+ (cell 20:5 (bind 20:6 t) (lit 20:8 %sent) (bind 20:14 sent-at))
48+ (wing 20:23 t))
49+ (arm 21:5 (lit 21:5 %stop) (str 21:23 "stop"))))))
50+ (value 22:1 elsewhere
51+ (gate 22:14
52+ (face 22:17 s (ref 22:19 step))
53+ (body 23:3
54+ (branch 23:3
55+ (wing 23:6 s)
56+ (arm 24:5
57+ (cell 24:5 (lit 24:6 %move) (lit 24:12 %left) (bind 24:18 n))
58+ (str 24:23 "left " (wing 24:30 n)))
59+ (arm 25:5
60+ (cell 25:5 (lit 25:6 %move) (lit 25:12 %right) (bind 25:19 n))
61+ (str 25:23 "right " (wing 25:31 n)))
62+ (arm 26:5
63+ (cell 26:5 (bind 26:6 move) (lit 26:11 %draft))
64+ (wing 26:23 move))
65+ (arm 27:5
66+ (cell 27:5 (bind 27:6 t) (lit 27:8 %sent) (bind 27:14 sent-at))
67+ (wing 27:23 t))
68+ (arm 28:5 (lit 28:5 %stop) (str 28:23 "stop"))))))
69+ (value 29:1 rest
70+ (gate 29:9
71+ (face 29:12 s (ref 29:14 step))
72+ (body 30:3
73+ (branch 30:3
74+ (wing 30:6 s)
75+ (arm 31:5
76+ (cell 31:5 (lit 31:6 %move) (bind 31:12 left))
77+ (str 31:23 "move"))
78+ (arm 32:5
79+ (cell 32:5 (bind 32:6 t) (lit 32:8 %draft))
80+ (wing 32:23 t))
81+ (arm 33:5
82+ (cell 33:5 (bind 33:6 t) (lit 33:8 %sent) (bind 33:14 sent-at))
83+ (wing 33:23 t))
84+ (arm 34:5 (lit 34:5 %stop) (str 34:23 "stop"))))))
85+ (value 35:1 aura
86+ (gate 35:9
87+ (face 35:12 s (ref 35:14 shape))
88+ (body 36:3
89+ (branch 36:3
90+ (wing 36:6 s)
91+ (arm 37:5
92+ (cell 37:5 (lit 37:6 %circle) (bind 37:14 red))
93+ (str 37:20 (wing 37:22 red)))
94+ (arm 38:5
95+ (cell 38:5 (lit 38:6 %label) (bind 38:13 green))
96+ (wing 38:20 green))
97+ (arm 39:5 (lit 39:5 %blank) (str 39:20 "blank"))))))
98+ (value 40:1 other-union
99+ (gate 40:16
100+ (face 40:19 s (ref 40:21 shape))
101+ (body 41:3
102+ (branch 41:3
103+ (wing 41:6 s)
104+ (arm 42:5
105+ (cell 42:5 (lit 42:6 %circle) (bind 42:14 r))
106+ (str 42:18 (wing 42:20 r)))
107+ (arm 43:5
108+ (cell 43:5 (lit 43:6 %label) (bind 43:13 t))
109+ (wing 43:18 t))
110+ (arm 44:5 (bind 44:5 red) (str 44:18 "other"))))))
111+ (value 45:1 sample
112+ (gate 45:11
113+ (face 45:14 stop (ref 45:19 step))
114+ (str 45:24 "sample")))
115+ (value 46:1 sample-bare
116+ (cast 46:16
117+ (fn 46:19 (ref 46:22 step) (aura 46:27 @t))
118+ (gate 46:31 (bind 46:34 stop) (str 46:39 "sample"))))
119+ (value 47:1 atom
120+ (gate 47:9
121+ (face 47:12 s (aura 47:14 @tas))
122+ (body 48:3
123+ (branch 48:3
124+ (wing 48:6 s)
125+ (arm 49:5 (lit 49:5 %stop) (str 49:12 "stop"))
126+ (arm 50:5 (bind 50:5 stop) (str 50:12 "other"))))))
127+ (value 51:1 noun
128+ (gate 51:9
129+ (face 51:12 s (noun 51:14))
130+ (body 52:3
131+ (branch 52:3
132+ (wing 52:6 s)
133+ (arm 53:5 (bind 53:5 stop) (str 53:11 "any")))))))
tests/golden/inline-pattern-tag-name-ok/types.txtnew file+13
@@ -0,0 +1,13 @@
1+partial inference; module not checked
2++$ step: cases proven disjoint; mold not checked
3++$ colour: cases proven disjoint; mold not checked
4++$ shape: cases proven disjoint; mold not checked
5+++ describe: $-(step @t)
6+++ elsewhere: $-(step @t)
7+++ rest: partial union pattern is not supported by partial inference
8+++ aura: $-(shape @t)
9+++ other-union: $-(shape @t)
10+++ sample: $-(step @t)
11+++ sample-bare: $-(step @t)
12+++ atom: branch is not supported by partial inference
13+++ noun: branch pattern is not supported by partial inference
tests/golden/inline-pattern-tag-name-one-case/about.txtnew file+4
@@ -0,0 +1,4 @@
1+source: Grammar tab, Patterns: "A name is an error where the subject's type at its position is a union, or a one-case mold, with a case whose constant there is the term the name spells"; Tag resolution: "A mold that isn't a union counts as a union of one case"
2+tests: a name at a one-case mold's tag, in a cell pattern and as the whole pattern; the same pattern with the tag written checks
3+expect: parses
4+expect-types: a partial inference report: `extract` is an error at `go`, 5:6, and `stopped` at `halt`, 8:5; `extract-ok` infers
tests/golden/inline-pattern-tag-name-one-case/modules.txtnew file+1
@@ -0,0 +1 @@
1+# no module fixtures
tests/golden/inline-pattern-tag-name-one-case/source.jibbnew file+11
@@ -0,0 +1,11 @@
1++$ packet [%go url=@t]
2++$ halt %halt
3+++ extract |= p=packet
4+ ?- p
5+ [go u] u
6+++ stopped |= h=halt
7+ ?- h
8+ halt "halted"
9+++ extract-ok |= p=packet
10+ ?- p
11+ [%go u] u
tests/golden/inline-pattern-tag-name-one-case/tokens.txtnew file+64
@@ -0,0 +1,64 @@
1+1:1 glyph +$
2+1:4 name packet
3+1:11 glyph [
4+1:12 tight lit %go
5+1:16 name url
6+1:19 tight glyph =
7+1:20 tight aura @t
8+1:22 tight glyph ]
9+2:1 NEWLINE
10+2:1 glyph +$
11+2:4 name halt
12+2:9 lit %halt
13+3:1 NEWLINE
14+3:1 glyph ++
15+3:4 name extract
16+3:12 glyph |=
17+3:15 name p
18+3:16 tight glyph =
19+3:17 tight name packet
20+4:3 INDENT
21+4:3 glyph ?-
22+4:6 name p
23+5:5 INDENT
24+5:5 glyph [
25+5:6 tight name go
26+5:9 name u
27+5:10 tight glyph ]
28+5:12 name u
29+6:1 DEDENT
30+6:1 DEDENT
31+6:1 NEWLINE
32+6:1 glyph ++
33+6:4 name stopped
34+6:12 glyph |=
35+6:15 name h
36+6:16 tight glyph =
37+6:17 tight name halt
38+7:3 INDENT
39+7:3 glyph ?-
40+7:6 name h
41+8:5 INDENT
42+8:5 name halt
43+8:10 str "halted"
44+9:1 DEDENT
45+9:1 DEDENT
46+9:1 NEWLINE
47+9:1 glyph ++
48+9:4 name extract-ok
49+9:15 glyph |=
50+9:18 name p
51+9:19 tight glyph =
52+9:20 tight name packet
53+10:3 INDENT
54+10:3 glyph ?-
55+10:6 name p
56+11:5 INDENT
57+11:5 glyph [
58+11:6 tight lit %go
59+11:10 name u
60+11:11 tight glyph ]
61+11:13 name u
62+11:14 DEDENT
63+11:14 DEDENT
64+11:14 NEWLINE
tests/golden/inline-pattern-tag-name-one-case/tree.txtnew file+31
@@ -0,0 +1,31 @@
1+(module
2+ (mold 1:1 packet
3+ (cell 1:11
4+ (const 1:12 %go)
5+ (face 1:16 url (aura 1:20 @t))))
6+ (mold 2:1 halt (const 2:9 %halt))
7+ (value 3:1 extract
8+ (gate 3:12
9+ (face 3:15 p (ref 3:17 packet))
10+ (body 4:3
11+ (branch 4:3
12+ (wing 4:6 p)
13+ (arm 5:5
14+ (cell 5:5 (bind 5:6 go) (bind 5:9 u))
15+ (wing 5:12 u))))))
16+ (value 6:1 stopped
17+ (gate 6:12
18+ (face 6:15 h (ref 6:17 halt))
19+ (body 7:3
20+ (branch 7:3
21+ (wing 7:6 h)
22+ (arm 8:5 (bind 8:5 halt) (str 8:10 "halted"))))))
23+ (value 9:1 extract-ok
24+ (gate 9:15
25+ (face 9:18 p (ref 9:20 packet))
26+ (body 10:3
27+ (branch 10:3
28+ (wing 10:6 p)
29+ (arm 11:5
30+ (cell 11:5 (lit 11:6 %go) (bind 11:10 u))
31+ (wing 11:13 u)))))))
tests/golden/inline-pattern-tag-name-one-case/types.txtnew file+18
@@ -0,0 +1,18 @@
1+partial inference; module not checked
2++$ packet: not checked
3++$ halt: not checked
4+++ extract: `go` binds a name, but the subject's type has `%go` here; write %go, or * for a catch-all
5+/tests/golden/inline-pattern-tag-name-one-case/source.jibb:4:6: subject
6+ ?- p
7+ ^
8+/tests/golden/inline-pattern-tag-name-one-case/source.jibb:5:6: pattern name
9+ [go u] u
10+ ^
11+++ stopped: `halt` binds a name, but the subject's type has `%halt` here; write %halt, or * for a catch-all
12+/tests/golden/inline-pattern-tag-name-one-case/source.jibb:7:6: subject
13+ ?- h
14+ ^
15+/tests/golden/inline-pattern-tag-name-one-case/source.jibb:8:5: pattern name
16+ halt "halted"
17+ ^
18+++ extract-ok: $-([%go url=@t] @t)