Skip to content

Read operand types from ExpressionResults in Ternary/ArrayDimFetch/PropertyFetch handlers - #6136

Merged
ondrejmirtes merged 1 commit into
2.2.xfrom
expression-result-type-reads-2
Jul 28, 2026
Merged

Read operand types from ExpressionResults in Ternary/ArrayDimFetch/PropertyFetch handlers#6136
ondrejmirtes merged 1 commit into
2.2.xfrom
expression-result-type-reads-2

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Member

Second batch of converting handler $scope->getType() reads to ExpressionResult reads (follows the first batch merged in 346dfbba83; independent PR based on 2.2.x).

Five sites where the handler already holds the child's result:

  • TernaryHandler: the condition type (the entry scope is exactly the condition result's before-scope — an exact equivalence) and the two branch explicit-never checks.
  • PropertyFetchHandler: the property-hook holder type ($scopeBeforeVar is exactly the var result's before-scope — exact equivalence).
  • ArrayDimFetchHandler: the var type feeding the ArrayAccess check and offsetGet throw-point synthesis.

On 2.2.x these resolve from the stored before-scope, keeping behavior identical (full suite green); on the resolve-type-rewrite-2 branch the same call sites are answered from the result's computed type without a scope walk. The branch's offset-virtual-handler batch was inspected and skipped — it is inseparable from the callback world.

Validation: full test suite green (17776 tests), self-analysis clean, code style clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_019wqGgaD7iqL44t1KgpJS7b

…opertyFetch handlers

Where the handler already holds the child's ExpressionResult, read the
type off the result instead of re-asking a scope: the ternary condition
(the entry scope is exactly the condition result's before-scope), the
two ternary branch explicit-never checks, the property-hook holder type
(scopeBeforeVar is exactly the var result's before-scope) and the array
dim fetch var type. Second batch of converting handler Scope::getType()
reads to ExpressionResult reads.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019wqGgaD7iqL44t1KgpJS7b
@ondrejmirtes
ondrejmirtes merged commit 084db3b into 2.2.x Jul 28, 2026
412 of 414 checks passed
@ondrejmirtes
ondrejmirtes deleted the expression-result-type-reads-2 branch July 28, 2026 17:11
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