Open
Description
I couldn't find an issue for this, so here is an idea. Currently this passes mypy:
class C:
x: int
c = C()
c.x
y: str
y
but obviously fails at runtime. Binder successfully tracks execution frames and type narrowing by assignments, it looks like it can also track each Var
whether it is still just "declared" or already defined. So that we can show errors like Variable 'var' may be uninitialized here
.
EDIT: updated first example