1

Resolved

Class member type overrules instance member type

description

Given this code:
class A:
    abc = 123

p1 = A.abc
p2 = A().abc
a = A()
a.abc = 'abc'
p3 = a.abc
p1 is correctly typed as int.

p3 is typed as int, but should be {int, str}

Arguably, p2 should also be {int, str} but is currently int.

Without abc being defined on the class, the member assignment is analyzed correctly.

comments