Skip to content

Support receive into indexed target variables (#85)#88

Merged
associate-1 merged 1 commit intomainfrom
fix/receive-indexed-target-85
Feb 23, 2026
Merged

Support receive into indexed target variables (#85)#88
associate-1 merged 1 commit intomainfrom
fix/receive-indexed-target-85

Conversation

@associate-1
Copy link
Member

Summary

  • Add VariableIndices []Expression to Receive and AltCase AST nodes, mirroring the existing ChannelIndices pattern
  • Parse index expressions after the target variable in channel receive (ch ? flags[0], cs[i] ? grid[j][k]) across all 5 parser sites: parseReceive(), parseIndexedOperation(), and 3 branches of parseAltCase()
  • Generate indexed variable references in codegen across all 6 sites: generateReceive() (simple + sequential), generateAltBlock() (guarded, indexed-channel, simple-channel), and generateReplicatedAlt()

Closes #85

Test plan

  • 3 parser unit tests: single index, multi-index, both channel and variable indexed
  • 2 e2e tests: c ? arr[1] and cs[0] ? arr[2] patterns
  • All existing tests pass (go test ./...)
  • Course module still transpiles and passes go vet

🤖 Generated with Claude Code

Channel receive (`ch ? var`) now accepts indexed targets like `flags[0]`
or `grid[i][j]`, matching the existing pattern for indexed assignments.
Also supports indexed targets in ALT cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@associate-1 associate-1 merged commit 3540129 into main Feb 23, 2026
1 check passed
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.

Support receive into indexed target variables

2 participants