Thread the foreach iteratee type; resolve intertwined by-ref slots from the root type - #6162
Merged
Merged
Conversation
The foreach handling already holds the iteratee type where these are called - computed once per position instead of re-priced inside every scope-enter helper. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DaBZjgksga4c5s6Q9FniY7
Walk the offsets from the root variable type instead of re-evaluating the stored assigned expression via Scope::getType() - the stored ArrayDimFetch captured the array variable before it existed, so re-reading it resolves through the asking scope instead of the authoritative just-assigned value. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DaBZjgksga4c5s6Q9FniY7
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.
Two more branch-agnostic extractions from the resolve-type-rewrite branch:
MutatingScope::enterForeach()/enterForeachKey()take the iteratee type and its native flavour from the caller. The foreach handling computes the pair once per position (entry scope, then the non-empty-narrowed scope) and threads it throughNodeScopeResolver::enterForeach()andtryProcessUnrolledConstantArrayForeach(), instead of every scope-enter helper re-pricing$stmt->expr.resolveIntertwinedAssignedType()), instead of re-evaluating the stored assigned expression throughScope::getType()— the storedArrayDimFetchcaptured the array variable before it existed, so re-reading resolves through the asking scope rather than the authoritative just-assigned value.All suites pass unchanged: NodeScopeResolverTest 1694, full suite 17811,
make phpstan,make cs.🤖 Generated with Claude Code
https://claude.ai/code/session_01DaBZjgksga4c5s6Q9FniY7