Skip to content

Bundle misc/proper_plugin.py as a part of mypy#16036

Merged
sobolevn merged 1 commit intomasterfrom
issue-16035
Sep 4, 2023
Merged

Bundle misc/proper_plugin.py as a part of mypy#16036
sobolevn merged 1 commit intomasterfrom
issue-16035

Conversation

@sobolevn
Copy link
Copy Markdown
Member

@sobolevn sobolevn commented Sep 4, 2023

I modified

diff --git mypy/binder.py mypy/binder.py
index 8a68f24f6..194883f86 100644
--- mypy/binder.py
+++ mypy/binder.py
@@ -345,7 +345,7 @@ class ConditionalTypeBinder:
             self._cleanse_key(dep)
 
     def most_recent_enclosing_type(self, expr: BindableExpression, type: Type) -> Type | None:
-        type = get_proper_type(type)
+        # type = get_proper_type(type)
         if isinstance(type, AnyType):
             return get_declaration(expr)
         key = literal_hash(expr)

to see if it still works. It is:

» python runtests.py self
run self: ['/Users/sobolev/Desktop/mypy/.venv/bin/python', '-m', 'mypy', '--config-file', 'mypy_self_check.ini', '-p', 'mypy', '-p', 'mypyc']
mypy/binder.py:349: error: Never apply isinstance() to unexpanded types; use
mypy.types.get_proper_type() first  [misc]
            if isinstance(type, AnyType):
               ^~~~~~~~~~~~~~~~~~~~~~~~~
mypy/binder.py:349: note: If you pass on the original type after the check, always use its unexpanded version
Found 1 error in 1 file (checked 288 source files)

FAILED: self

I will add this plugin to my CI checks in like ~5 plugins I maintain :)

Closes #16035

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 4, 2023

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@sobolevn sobolevn merged commit 488ad4f into master Sep 4, 2023
@sobolevn sobolevn deleted the issue-16035 branch September 4, 2023 09:53
@sobolevn
Copy link
Copy Markdown
Member Author

sobolevn commented Sep 4, 2023

Thanks! 👍

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.

Consider packaging misc.proper_plugin as a part of mypy

2 participants