Open
Description
After #5699 in certain cases (see testWideOuterContextEmptyError
) if type inference fails, mypy gives an obscure error like
Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "List[str]")
This error message could be improved. Here are some ideas:
- Record that we didn't use the outer context because of unsatisfied bound and add a note about this
- (Probably better) If type variable with a bound is used in an invariant context and we can't infer a value, we currently infer
C[<nothing>]
. What if we'd instead inferredC[<bound>]
?