OpShin/opshin

Automatically derive non-classes from type checks

Closed this issue · 1 comments

Lets consider

def f(x: Union[A, B]):
  if isinstance(x, A):
     # x is of type A here
  else:
    # x is of type Union[A, B] here

ideally, the type inferencer should figure out that x has type B in the else branch. the problem: in practice, someone could pass type C into the program. this could lead to confusion as a subsequent check of isinstance(x, B) would fail in the else branch, even though the type is B

fixed with #220