Conversation
Track numeric operand types before range inference with a lightweight worklist. Coercions and symbolic constraints must not reuse bounds that apply only to integer inputs. Guard casts, arithmetic, increment/decrement, and assignments through typed references, then run full type inference using the valid ranges. Fixes phpGH-24088
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.
Integer ranges from comparisons only constrain integer inputs. Track numeric operand types with a lightweight worklist before range inference so casts, arithmetic, symbolic comparisons, and typed-reference assignments cannot reuse incompatible bounds. This prevents values such as 5.5 and true from being folded to 6 while retaining a single full type-inference pass. Some symbolic loop bounds derived from arithmetic remain less precise because the preliminary type information cannot use range-dependent integer certainty. Fixes #24088.