Open
Description
Bug Report
For the following code:
@object.__new__
class A:
...
class B:
...
reveal_type(A)
reveal_type(B)
mypy
returns:
test.py:8: note: Revealed type is "def () -> test.A"
test.py:9: note: Revealed type is "def () -> test.B"
If you print
instead of reveal_type
it shows that:
<__main__.A object at 0x1081cfb50>
<class '__main__.B'>
Following screenshot shows that ``pyright` does recognise this.
Expected Behavior
Recognise that the @object.__new__
decorator turns A
into an instance of A
and set that as its type.
Actual Behavior
A
is now inferred as Type[A]
.
Your Environment
- Mypy version used: 0.931
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini
(and other config files): None - Python version used: 3.10
- Operating system and version: MacOS