-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix incorrect type inference for inherited from Any class #8019
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
Fix incorrect type inference for inherited from Any class #8019
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I'll merge it tomorrow unless @ilevkivskyi or @Michael0x2a have more feedback
# if so, we also return Any | ||
if ((isinstance(left_type, Instance) and left_type.type.fallback_to_any) or | ||
(isinstance(right_type, Instance) and right_type.type.fallback_to_any)): | ||
any_type = AnyType(TypeOfAny.special_form) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if special_form
is the right thing here but I'm not totally sure what else to do. from_another_any
is correct but digging out the other any is almost certainly not worth bothering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also not sure about whether special_form
is the right thing to go, but clearly directly using from_another_any
with either left_type
or right_type
here is incorrect. To proper use from_another_any
, we need a better way to transform the Instance to an Any
Oh, I guess please fix the merge conflict |
fixed |
resolves #8001