Skip to content

Conversation

@zharinov
Copy link
Member

@zharinov zharinov commented Jan 5, 2026

Summary

  • Fixed bug where field: [Tag: ...] @cap produced raw Node instead of tagged union {$tag, $data}
  • Added unwrap_field_value() helper to look through FieldExpr when detecting enum-producing alternations
  • Emit capture effects after EndEnum for correct tagged union capture semantics

Why

Parser intentionally treats field: expr @cap as (field: expr) @cap so quantifiers work on fields (e.g., decorator: (x)*). This meant captures on field values wrapped FieldExpr, and build_capture_effects didn't look through it to detect the enum-producing alternation inside.

Notes

Two complementary changes:

  1. capture.rs: unwrap_field_value() + updated creates_structured_scope check
  2. expressions.rs: New code path inner_is_scope_creating_scalar for enum capture placement

@zharinov zharinov merged commit 2b2c2a3 into master Jan 5, 2026
4 checks passed
@zharinov zharinov deleted the fix/field-tagged-alt-capture branch January 5, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants