-
Notifications
You must be signed in to change notification settings - Fork 651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConcatAnalyzer improvements and non-falsy-string fixes. #5544
ConcatAnalyzer improvements and non-falsy-string fixes. #5544
Conversation
Deduplicate code. Improve type inference. Allow literal type inference when only one side has multiple types (fixes vimeo#5483). Fix invalid type inference with negative int as right operand.
I'm tempted to offload most of the analysis here to CastAnalyzer, and since PHP (probably?) handles concatenation by casting everything to string first |
Heads up @orklah, since you added the int concatenation to numeric string inference you may want to be aware that this now requires the right operand to be a non-negative int. |
oh nice, didn't thought of that one at the time |
'0' is a non-empty-lowercase-string that is falsy.
I stumbled on some issues with non-falsy-string while fixing newly detected issues in the codebase, so I fixed those as well. |
Thanks! This is a great addition/refactor! I wonder whether it might be better in the long run to make, "empty", "falsy" and "lowercase" attributes of a string type, with rules about which attributes can intersect. That might make the logic more complex though, not less. |
Deduplicate code.
Improve type inference.
Allow literal type inference when only one side has multiple types (fixes #5483).
Fix invalid type inference with negative int as right operand.