Skip to content

Conversation

@ilevkivskyi
Copy link
Member

The issue was exposed by merge of subtype visitors. Fix is actually trivial, but the diff is big because I need to add and pass the new flag everywhere (is_subtype(), is_proper_subtype(), is_equivalent(), is_same_type() can call each other).

cc @Michael0x2a

This was referenced Aug 20, 2022
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@ilevkivskyi
Copy link
Member Author

mypy_primer output is technically correct. We (intentionally?) use is_subtype_no_promote() everywhere for overload checks. And this PR passes subtype flags to nested subtype checks. So people need to write e.g. Union[Iterable[int], Iterable[float]] in the implementation signature.

I am not sure why do we require this? If it looks to strict, I think it is easy to go back to using just is_subtype(). @Michael0x2a what was the motivation to ignore promotions during overload implementation signature check?

@ilevkivskyi
Copy link
Member Author

Well, FWIW I switched to is_subtype() and all tests passed. So I guess it was not really an intentional decision. Let's see what it will do here.

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pandas (https://github.com/pandas-dev/pandas)
- pandas/core/apply.py:510: error: Key expression in dictionary comprehension has incompatible type "Hashable"; expected type "NDFrame"  [misc]

@ilevkivskyi
Copy link
Member Author

Yeah, mypy_primer looks better now.

@hauntsaninja
Copy link
Collaborator

Looks great!

@ilevkivskyi ilevkivskyi merged commit 2ba6451 into python:master Aug 21, 2022
@ilevkivskyi ilevkivskyi deleted the fix-overload-overlap branch August 21, 2022 09:26
ilevkivskyi added a commit that referenced this pull request Sep 29, 2022
The issue was exposed by merge of subtype visitors. Fix is actually trivial, but the diff is big because I need to add and pass the new flag everywhere (`is_subtype()`, `is_proper_subtype()`, `is_equivalent()`, `is_same_type()` can call each other).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants