Skip to content

Conversation

@zharinov
Copy link
Member

Summary

Fixes incorrect bytecode member indices by deferring resolution to emit time.

Problems fixed:

  • Captures were assigned to wrong struct fields in multi-entrypoint queries
  • Inner captures in nested scopes didn't emit Set effects
  • Tagged alternations used branch index instead of absolute member index

Solution:

  • Added MemberRef enum for deferred resolution (stores TypeId + relative index)
  • Added EffectIR wrapper for effects with symbolic member references
  • Added scope stack to compiler for tracking nested struct contexts
  • Resolution happens during bytecode emission when absolute indices are known

Test plan

  • All existing tests pass
  • Verified bytecode output for multiple entrypoints
  • Verified bytecode output for nested struct arrays
  • Verified bytecode output for tagged alternations
  • Stress tested 14 different query patterns via CLI

@zharinov zharinov enabled auto-merge (squash) December 31, 2025 15:05
@zharinov zharinov merged commit 71e4779 into master Dec 31, 2025
4 checks passed
@zharinov zharinov deleted the fix/bytecode-member-indices branch December 31, 2025 15:06
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