Skip to content

fix: infer array type for += when operands are arrays#214

Merged
calebdw merged 1 commit into
mainfrom
calebdw/push-yvszlwntrsww
Jul 9, 2026
Merged

fix: infer array type for += when operands are arrays#214
calebdw merged 1 commit into
mainfrom
calebdw/push-yvszlwntrsww

Conversation

@calebdw

@calebdw calebdw commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

The compound assignment operator += was unconditionally routed to arithmetic type inference, producing int|float even when both operands were arrays. PHP overloads + / += for array union, and the binary + operator already handled this correctly.

Split AssignmentOperator::Addition out of the arithmetic match arm in both process_compound_assignment and the compound-assignment-as-RHS path, checking is_array_like() on either operand before falling through to numeric inference.

Closes #150

The compound assignment operator += was unconditionally routed to
arithmetic type inference, producing int|float even when both operands
were arrays. PHP overloads + / += for array union, and the binary +
operator already handled this correctly.

Split AssignmentOperator::Addition out of the arithmetic match arm in
both process_compound_assignment and the compound-assignment-as-RHS
path, checking is_array_like() on either operand before falling through
to numeric inference.

Closes #150
@calebdw calebdw force-pushed the calebdw/push-yvszlwntrsww branch from 68ec960 to d11ff05 Compare July 9, 2026 18:47
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 45.00000% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/completion/variable/forward_walk.rs 45.00% 11 Missing ⚠️

📢 Thoughts on this report? Let us know!

@calebdw calebdw merged commit a8fa3a5 into main Jul 9, 2026
6 of 7 checks passed
@calebdw calebdw deleted the calebdw/push-yvszlwntrsww branch July 9, 2026 19:00
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.

Union for array not recognized

2 participants