Skip to content

support Callable / callable Protocols in suggest decorator unwarpping #19072

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asottile
Copy link
Contributor

Resolves #18940

while I feel like just accepting any identity function would be good enough I expanded the check to explicitly allow Callables and Protocol callables

Copy link
Contributor

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

@@ -659,7 +671,7 @@ def extract_from_decorator(self, node: Decorator) -> FuncDef | None:
for ct in typ.items:
if not (
len(ct.arg_types) == 1
and isinstance(ct.arg_types[0], TypeVarType)
and _arg_accepts_function(get_proper_type(ct.arg_types[0]))
and ct.arg_types[0] == ct.ret_type
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this become is_same_type to allow aliases?

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.

dmypy gives up on trivial decorator
2 participants