class A: pass
class B(A): pass
class X:
attr: A
class Y:
attr: B
class Z(X, Y):
pass
IMO this should be valid; Z.attr should be of type A, since it's the "lowest common denominator" in this case at retains type safety.
Similar thing goes for unions, like this:
class A: pass
class B: pass
class C: pass
class X:
attr: Union[A, B]
class Y:
attr: Union[B, C]
class Z(X, Y):
# attr should be Union[A, B, C]
pass
and this:
class A: pass
class B(A): pass
class C: pass
class X:
attr: Union[A, C]
class Y:
attr: Union[B, C]
class Z(X, Y):
# attr should be Union[A, C]
pass
IMO this should be valid;
Z.attrshould be of typeA, since it's the "lowest common denominator" in this case at retains type safety.Similar thing goes for unions, like this:
and this: