-
Notifications
You must be signed in to change notification settings - Fork 538
Skip deep expression when root expression changes while scope generalization #4390
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
Conversation
from my POV the problem in the reported types is -non-empty-array<int<0, 9>, non-empty-array<0|1, string>>
+non-empty-array<int<0, 9>, non-empty-array<int<0, 9>, string>> so thats why my idea was that in the deeper nested key-type no generalization happend and thats what missing. IMO when only one of the involved scopes contains a general or constant array, we don't do deep generalization (recursive) in
(but I am looking at this stuff for the first time... I might be wrong :)) |
Yeah, it's possible the problem is with generalization and not merging scopes, I was just debugging this in my head, not in code 😂 |
Yeah, that's basically what I'm talking about in #4372 (comment), this is what I imagine the problem would look like. After updating I think that actually "updating" after assignment works fine, but merging scopes probably doesn't handle this. |
I finally understood what you are trying to tell me :). |
This pull request has been marked as ready for review. |
84ace80
to
a63e8c6
Compare
I'm also trying to figure out the other regression. |
thank you! |
I don't know yet, will think about it more :) Thank you. |
implement the idea described in #4372 (comment)
it does not fix the problem we see the wrong types we see from https://phpstan.org/r/16197474-84cb-43ad-b983-ad78371fba02 though