Skip to content

Read operand types from ExpressionResults in expr handlers - #6135

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

Read operand types from ExpressionResults in expr handlers#6135
ondrejmirtes merged 1 commit into
2.2.xfrom
expression-result-type-reads

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Member

Stacked on #6134. First batch of a series: where a handler already holds a child's ExpressionResult, read types via ExpressionResult::getType() instead of $scope->getType()ThrowHandler's throw-point type and the right-side explicit-never checks in BooleanAndHandler/CoalesceHandler.

On 2.2.x, ExpressionResult::getType() resolves from the stored before-scope, so these sites stay behavior-identical (verified by the full suite); on the resolve-type-rewrite-2 branch the same call sites are answered from the result's computed type without any scope walk. Each conversion shrinks the eventual resolveType-to-callback switch by one line, and only scope-insensitive consumers (never-checks, the thrown type) are converted — sites where the asking scope matters are left for later batches with individual validation.

More batches will follow on this branch (Ternary/ArrayDimFetch/PropertyFetch operands, offset virtual handlers, leaf handlers), each suite-validated separately.

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

🤖 Generated with Claude Code

https://claude.ai/code/session_019wqGgaD7iqL44t1KgpJS7b

…e handlers

Where the handler already holds the child's ExpressionResult, read the
type off the result instead of re-asking the scope: the throw point's
thrown type and the two right-side explicit-never checks. First batch
of converting handler Scope::getType() reads to ExpressionResult reads
- the call sites then match the single-pass engine, which answers them
from the result without a scope walk.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019wqGgaD7iqL44t1KgpJS7b
@ondrejmirtes
ondrejmirtes force-pushed the expression-result-type-reads branch from afd6e1b to 161c40d Compare July 28, 2026 17:00
@ondrejmirtes
ondrejmirtes changed the base branch from early-terminating-calls-in-handlers to 2.2.x July 28, 2026 17:00
@ondrejmirtes
ondrejmirtes merged commit 346dfbb into 2.2.x Jul 28, 2026
176 of 178 checks passed
@ondrejmirtes
ondrejmirtes deleted the expression-result-type-reads branch July 28, 2026 17: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.

1 participant