Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Various arrays improvements#5523

Merged
ondrejmirtes merged 5 commits into
2.1.xfrom
union-offset-preserve-constant-array
Apr 23, 2026
Merged

Various arrays improvements#5523
ondrejmirtes merged 5 commits into
2.1.xfrom
union-offset-preserve-constant-array

Conversation

@ondrejmirtes
Copy link
Copy Markdown
Member

@ondrejmirtes ondrejmirtes commented Apr 23, 2026

ondrejmirtes and others added 2 commits April 23, 2026 15:36
When assigning into a nested array dim fetch like `$ret[$val]['cat2'] = 'blah2'`
with a union offset `$val`, the outer `$ret` gets merged via
`setOffsetValueType()` which widens value types with a union. The directly
tracked expression `$ret[$val]` in the Scope holds more precise information,
but it was being re-derived from the widened outer `$ret` via
`getOffsetValueType()` when computing additional expressions and when
drilling down for subsequent levels. This caused previously-set keys to
become optional again on the next chained assignment.

- When drilling into nested levels in `produceArrayDimFetchAssignValueToWrite`,
  prefer `Scope::getType()` for intermediate dim fetches that are tracked in
  Scope, instead of re-deriving from the parent array.
- When producing `additionalExpressions`, use the intermediate value computed
  during the reverse assignment loop instead of drilling into the widened
  outer container.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@ondrejmirtes ondrejmirtes force-pushed the union-offset-preserve-constant-array branch from 4ba0604 to c7b767a Compare April 23, 2026 16:38
@ondrejmirtes ondrejmirtes force-pushed the union-offset-preserve-constant-array branch from c7b767a to 1cca345 Compare April 23, 2026 17:05
@ondrejmirtes ondrejmirtes merged commit 761c482 into 2.1.x Apr 23, 2026
650 of 655 checks passed
@ondrejmirtes ondrejmirtes deleted the union-offset-preserve-constant-array branch April 23, 2026 17:48
@staabm
Copy link
Copy Markdown
Contributor

staabm commented Apr 23, 2026

Wwooaarr 😍

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