Skip to content

feat: Gleam-style multi-subject ? match#719

Merged
danieljohnmorris merged 2 commits into
mainfrom
feature/match-multi-subject
May 22, 2026
Merged

feat: Gleam-style multi-subject ? match#719
danieljohnmorris merged 2 commits into
mainfrom
feature/match-multi-subject

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

  • Adds multi-subject ? match: ?a b{"ok" "ok":"both"; _ _:"miss"} — each arm has N space-separated patterns, one per subject
  • Stmt::Match/Expr::Match field subject: Option<Expr> renamed to subjects: Vec<Expr>; single-subject and subject-less forms are unchanged
  • New Pattern::Tuple(Vec<Pattern>) variant for multi-subject arms; interpreter, register VM, verifier, and codegen (fmt + python) all updated
  • Parser lookahead (looks_like_multi_subject + first_arm_has_n_patterns) prevents false-positive disambiguation against existing ternary hint shapes (ILO-P009 regression suite still green)

Test plan

  • cargo test — all 5000+ tests pass (including regression_ternary_brace_hint 6/6)
  • ?a b{"ok" "ok":"both";_ _:"miss"} returns "both" via --vm
  • ?a b{"ok" "ok":"both";_ _:"miss"} with non-matching subjects returns "miss"
  • Engine-matrix file 50-match-multi-subject.ilo added

Closes

ILO-412

🤖 Generated with Claude Code

@danieljohnmorris danieljohnmorris added the mini Created by mini PC autonomous workflow label May 22, 2026
@danieljohnmorris
Copy link
Copy Markdown
Collaborator Author

needs manual rebase (conflicts in: src/ast/mod.rs src/codegen/fmt.rs src/codegen/python.rs src/interpreter/mod.rs src/verify.rs src/vm/mod.rs)

@danieljohnmorris danieljohnmorris force-pushed the feature/match-multi-subject branch from 38f920c to e2982be Compare May 22, 2026 09:13
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

Missing match arms in js.rs after rebasing onto commits that added
Or-patterns (ILO-411) and Todo/Panic expressions (ILO-410). Treat
Or-patterns as wildcard and forward Todo/Panic inner expression in JS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@danieljohnmorris danieljohnmorris merged commit 096fcfa into main May 22, 2026
7 of 10 checks passed
@danieljohnmorris danieljohnmorris deleted the feature/match-multi-subject branch May 22, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mini Created by mini PC autonomous workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant