You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Preserve integer range bounds for sealed array values in loop generalization
When `generalizeType` merges two sealed constant-array shapes on the
fall-through ArrayType path, it kept the literal key union (so loop-bounded
counter keys stayed within range) but still recursed into `generalizeType`
for the values — which applies the loop-widening heuristic and widened e.g.
`int<0, 5>` to `int<0, max>`. Keep the literal value union too (with a
fallback to generalization when it outgrows the shape limit), so values like
loop-built `array{int<0, 5>, int<1, 6>}` keep their bounds.
Scoped to sealed shapes so the general `generalize()` widening contract for
legacy arrays (ScopeTest::testGeneralize) is unaffected.
Refs phpstan/phpstan#13647
Refs phpstan/phpstan#13637
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments