Read operand types from ExpressionResults in expr handlers - #6135
Merged
Conversation
…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
force-pushed
the
expression-result-type-reads
branch
from
July 28, 2026 17:00
afd6e1b to
161c40d
Compare
ondrejmirtes
changed the base branch from
early-terminating-calls-in-handlers
to
2.2.x
July 28, 2026 17:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #6134. First batch of a series: where a handler already holds a child's
ExpressionResult, read types viaExpressionResult::getType()instead of$scope->getType()—ThrowHandler's throw-point type and the right-side explicit-never checks inBooleanAndHandler/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 theresolve-type-rewrite-2branch 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