mypy
b031f1c0 - Fix type inference in pattern matching by positional argument (#13618)

Commit
3 years ago
Fix type inference in pattern matching by positional argument (#13618) Oh, this was very interesting. During the debug sessions I learned a lot about how pattern matching and its analysis do work. But, the problem was that `expand_type` did not preserve `.last_known_value` for some reason. I used `.copy_modified` to preserve everything we know about `Instance`. However, I expect that some tests might fail now. This code even has something similar in `TODO` some lines above: https://github.com/python/mypy/blob/88aed94ae3de2542491f6cd65d1236c4f0cdedb1/mypy/expandtype.py#L144-L148 Let's see what will happen. Closes https://github.com/python/mypy/issues/13612
Author
Parents
Loading