Skip to content

Conversation

@zharinov
Copy link
Member

@zharinov zharinov commented Jan 5, 2026

Summary

  • Fix type inference to recognize truly empty sequences ({ }) as producing empty struct type, not Node
  • Fix compiler to emit Obj/EndObj wrapper for empty captured sequences
  • Fix materializer to distinguish nested empty objects (captured sequences → {}) from root-level (preamble → null)

Why

Queries like { } @x and { }? @maybe were either panicking with type mismatch or producing incorrect null values. Empty sequences should produce empty struct {} when captured.

Notes

Added is_truly_empty_scope() helper in parser/ast.rs to distinguish truly empty sequences ({ }) from sequences with void flow due to suppression ({(expr) @_}). The latter should still capture the matched node, not produce an empty struct.

@zharinov zharinov force-pushed the fix/empty-captured-sequences branch from 5464082 to 75718bc Compare January 5, 2026 23:15
@zharinov zharinov enabled auto-merge (squash) January 6, 2026 00:18
@zharinov zharinov merged commit 9e1f23d into master Jan 6, 2026
4 checks passed
@zharinov zharinov deleted the fix/empty-captured-sequences branch January 6, 2026 00:21
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