-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Join computed suboptimally with multiple inheritance #4373
Comments
Note that this can't be fixed by adding an annotation for |
I think this is another symptom of #3257 |
Also this is yet another reason to have intersections. |
(modified the example to force the join given #17427 ) |
Another example, distilled from mypy-primer output on python/typeshed#12740: class A: pass
class B: pass
class C: pass
class Cls1(A, B, C): pass
class Cls2(A, B, C): pass
def func(cond: bool, c1: Cls1, c2: Cls2) -> None:
a: A = c1 if cond else c2
b: B = c1 if cond else c2 # error
c: C = c1 if cond else c2 # error
print(a, b, c) |
I think mypy latest no longer joins for ternary, so the specific primer hit should go away when 1.12 is released |
Could we do something better here? Ideally the inferred type of
a
should be an anonymous subclass ofMix
andBase
.The text was updated successfully, but these errors were encountered: