Fix type inference for tuples in iterable context#13406
Conversation
|
cc @JukkaL |
This comment has been minimized.
This comment has been minimized.
|
Well, this shows how fragile is type inference that has neither backtracking nor full-expression scope. Here I tried a fix (which btw makes things more consistent to be fair). If this will still cause problems as well, we can also try simplifying unions before providing it as a context for tuple. |
|
Actually, I am almost sure simplifying the union is the right thing to do. What if context is a union of two identical tuple types? in this case we currently give up and don't provide a context at all. |
|
OTOH if original union was like |
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
|
Hm, OK, there is no effect in |
It is a minor change to fix the example in python/typeshed#7904