-
Notifications
You must be signed in to change notification settings - Fork 529
Fix intersection in generics #585
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
efd31ce
to
0471f87
Compare
I rebased on master @ondrejmirtes :) |
Friendly ping @ondrejmirtes |
Hi, I don't feel like this fix is right, the |
dea534b
to
a659878
Compare
There is an intersection type
on which the call
is made with
This call is doing
on each type of the intersection. Then
is Bug5336\ProxyQueryInterface, but
Is empty This is the empty check I do. In order to add again the type |
a659878
to
e289683
Compare
e289683
to
5046b43
Compare
@VincentLanglet this is what I'm seeing as well: The intersection members that are not a sub type of the template bound are rejected by T->inferTemplateTypes(), so we end up with just ProxyQueryInterface. I agree that it would be useful to not reject the extra types. I can see the following issues with the current fix:
|
To me it also looked like the current logic in this PR isn't sufficient, thanks. |
No problem.
Any idea what would be the right fix @arnaud-lb ? |
Without the fix I get
on the file.
With the fix I get
The fix I made in
IntersectionType::inferTemplateTypesOn
might be improved...More important, I don't know if the fix should be added to
IntersectionType::inferTemplateTypes
too (and what's the diff between both methods).Close phpstan/phpstan#5336