You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Match pattern payload slot: five readers, three disagreeing heuristics, one live misparse (Resolve.w kind-range) #663
The NK_PAT_VARIANT / NK_PAT_ENUM_SHORTHAND payload extras are the surviving sibling of #660's untagged union (binder SYMBOL id vs nested pattern NODE id). A census found FIVE readers with THREE different discriminators:
Resolve.w:899-911 bind_pattern — a DIVERGENT numeric kind-range probe (100..113) that wrongly INCLUDES NK_MATCH_ARM (=110, not a pattern) and EXCLUDES NK_PAT_TYPED_BIND (114), NK_PAT_REGEX (121), NK_PAT_REST (125). Live today with no id collision needed: 'Variant(x, ..)' or 'Variant(x: T)' routes the payload to the else branch and add_def registers a DK_LOCAL whose name symbol is actually a pattern NODE id — a garbage binding in the resolver's tables.
render.w:939/957 — bare is_pattern_node, no span check (wrong rendered/diagnostic text on collision).
SemaCheck.w:11769 and ComptimeEval.w:6107 — no probe at all; unconditionally treat the entry as a node.
Every CURRENT producer (Parser.w pattern paths, ComptimeTransform.w:2472) stores NODES, so the sym-guessing branches are dead-but-load-bearing. Fix direction: declare the slot node-only and delete the sym branches in all three probing readers (or tag-map it like #660's fix in Ast.w pattern_binding_keys). Found during the post-#660 pattern census.
Fixed in a441999. Two parts: (1) the resolver's variant-payload slot used a numeric kind-range probe (100..113) that excluded NK_PAT_TYPED_BIND/REGEX/REST and included the non-pattern NK_MATCH_ARM — so V(x: T) registered a garbage node-id-as-symbol binding; replaced with is_pattern_node, deleted the dead sym branch, added the missing NK_PAT_TYPED_BIND binder. (2) fixing the resolver exposed that a typed-bind pattern is a dyn-trait downcast whose MIR handler segfaults on a concrete (non-trait-object) subject; Sema now rejects it loudly. The dyn-downcast use (sealed_trait_match) is unaffected. Full gate green. Note: this was the live-misparse reader; the render.w/SemaCheck/Comptime readers listed in the issue are dead-but-harmless (all producers store nodes) and can be swept under #651 if desired.
Activity
ehartford commentedon Jul 14, 2026
Fixed in a441999. Two parts: (1) the resolver's variant-payload slot used a numeric kind-range probe (100..113) that excluded NK_PAT_TYPED_BIND/REGEX/REST and included the non-pattern NK_MATCH_ARM — so
V(x: T)registered a garbage node-id-as-symbol binding; replaced with is_pattern_node, deleted the dead sym branch, added the missing NK_PAT_TYPED_BIND binder. (2) fixing the resolver exposed that a typed-bind pattern is a dyn-trait downcast whose MIR handler segfaults on a concrete (non-trait-object) subject; Sema now rejects it loudly. The dyn-downcast use (sealed_trait_match) is unaffected. Full gate green. Note: this was the live-misparse reader; the render.w/SemaCheck/Comptime readers listed in the issue are dead-but-harmless (all producers store nodes) and can be swept under #651 if desired.Resolve/Sema: node-only variant payload slot; reject typed-bind on co…
Sema/MirLower/Codegen: a typed binding pattern over a `&dyn T` subjec…
Globals: a call, dyn dispatch, stored callable or drop that writes a …