Uh oh!
There was an error while loading. Please reload this page.
Treat Any metaclass the same as Any base class - #13605
Conversation
sobolevn
commented
Sep 4, 2022
Also |
| reveal_type(WithMeta.a) # N: Revealed type is "Any" | ||
| reveal_type(WithMeta.m) # N: Revealed type is "Any" | ||
| reveal_type(WithMeta.x) # N: Revealed type is "builtins.int" |
There was a problem hiding this comment.
Maybe add a couple of tests to check/clarify that this only affects class objects, not instances of classes?
| reveal_type(WithMeta.x) # N: Revealed type is "builtins.int" | |
| reveal_type(WithMeta.x) # N: Revealed type is "builtins.int" | |
| reveal_type(WithMeta().a) # E: "WithMeta" has no attribute "a" \ | |
| # N: Revealed type is "Any" | |
| reveal_type(WithMeta().x) # N: Revealed type is "builtins.int" |
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
AlexWaygood
left a comment
There was a problem hiding this comment.
I don't feel qualified to comment on whether this is the best way to implement this, but the tests look great!
sobolevn
commented
Sep 4, 2022
@AlexWaygood you can see that I was copying the approach we have for base classes: Lines 1894 to 1900 in 9d21615 Basically, it uses this mechanism: Lines 2738 to 2743 in 9d21615 |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Closes#13599