Remember the pair in is_overlapping_types if at least one of them is an alias#20127
Conversation
This comment has been minimized.
This comment has been minimized.
ilevkivskyi
left a comment
There was a problem hiding this comment.
I guess it was a performance thing. I don't remember doing any measurements, but it is some hot code. Probably the most correct way would be to use mypy.typeops.is_recursive_pair() (but to be clear that function itself is a hack as well, but it is good to have it centralized). Could you please do some performance measurements for this PR? (and also for is_recursive_pair if you have time), otherwise LG.
|
I wanted to run some perf checks on this, but don't remember any typealias-heavy codebase to use. Selfcheck almost definitely won't show anything - there are barely any type aliases in mypy code - and isolated benchmarks won't be representative in this case. Any suggestions? |
|
@sterliakov IIRC |
|
Timed
There are 210 matches of So I'm switching to |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Fixes #20107.
One recursive alias is enough to trigger infinite recursion - why does this require that both sides are aliases?
Cc @ilevkivskyi as original author of #16483.