Closed
Description
mypy v0.720
using --check-untyped-defs
class Foo: pass
class A:
def __init__(self)
self.f1 = Foo()
# Any
reveal_type(self.f1)
self.f2: Foo = Foo()
# Foo
reveal_type(self.f2)
class B:
def __init__(self) -> None:
self.f1 = Foo()
# Foo
reveal_type(self.f1)
I would expect --check-untyped-defs
would make A
behave like B
. However, some type inference seems missing if __init__
is not annotated.