Skip to content

Add complete multi-assignment type inference#56

Merged
dak2 merged 1 commit intomainfrom
add-multi-assign-support
Mar 12, 2026
Merged

Add complete multi-assignment type inference#56
dak2 merged 1 commit intomainfrom
add-multi-assign-support

Conversation

@dak2
Copy link
Owner

@dak2 dak2 commented Mar 12, 2026

Summary

  • Support splat targets (*rest) with Array[T] type inference, including mixed-type unions
  • Fill trailing targets with NilClass when LHS count exceeds RHS count
  • Handle right-side targets after splat (first, *rest, last = 1, 2, 3, 4)
  • Add basic single-expression RHS array decomposition (a, b = arr where arr: Array[T])
  • Refactor shared logic into install_target, install_nil_target, splat_var_name, and collect_element_type helpers

Test plan

  • 245 Rust unit tests pass (cargo test --lib) — includes 8 new multi-assignment tests
  • Ruby integration tests added (test/multi_assign_test.rb) covering basic, splat, rights, empty splat, and type error detection
  • bundle exec rake full build + integration test suite

🤖 Generated with Claude Code

Support splat targets (*rest) as Array[T], nil-fill when LHS exceeds RHS,
right-side targets after splat, and basic single-expression array
decomposition. This resolves the v0.1.8 TODOs for multi-assignment
handling except for method return value decomposition which requires
graph lazy resolution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dak2 dak2 force-pushed the add-multi-assign-support branch from b14fad1 to 1559845 Compare March 12, 2026 15:12
@dak2 dak2 merged commit 7ed0019 into main Mar 12, 2026
2 checks passed
@dak2 dak2 deleted the add-multi-assign-support branch March 12, 2026 15:12
@dak2 dak2 mentioned this pull request Mar 15, 2026
4 tasks
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.

1 participant