Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect join in the presence of Any fallback #14404

Merged
merged 1 commit into from
Jan 20, 2023

Conversation

hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Jan 6, 2023

Fixes #11925

This avoids mypy from guessing subtype relationships because of the any fallback over here:

if left.type.fallback_to_any and not self.proper_subtype:

@hauntsaninja hauntsaninja marked this pull request as draft January 6, 2023 05:27
@hauntsaninja hauntsaninja force-pushed the any-join branch 3 times, most recently from c6b34ae to e10804b Compare January 6, 2023 07:37
@python python deleted a comment from github-actions bot Jan 6, 2023
@github-actions

This comment has been minimized.

@hauntsaninja
Copy link
Collaborator Author

cc @ilevkivskyi could you review? The check_context assertion comes from #13303 , as far as I can see no changes are required for ignore_type_params=True, but I might be missing something

@hauntsaninja hauntsaninja marked this pull request as ready for review January 9, 2023 06:22
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2023

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

kornia (https://github.com/kornia/kornia)
- kornia/nerf/nerf_model.py:121: error: "object" not callable  [operator]

@hauntsaninja hauntsaninja merged commit 8f4da0e into python:master Jan 20, 2023
@hauntsaninja hauntsaninja deleted the any-join branch January 20, 2023 22:12
@ilevkivskyi
Copy link
Member

I finally got some time to think about this. In general, those asserts were added when two visitors were merged to prevent accidentally going through previously completely untested code paths. Also I don't really like ignore_type_params for proper subtypes, but after all I think it is not a big deal, so if this doesn't cause problems, let's just keep this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect join result in the presence of Any
2 participants