Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5864,6 +5864,10 @@ def visit_decorator_inner(
object_type = self.lookup_type(d.expr)
fullname = self.expr_checker.method_fullname(object_type, d.name)
self.check_for_untyped_decorator(e.func, dec, d)
if fullname:
dec = self.expr_checker.transform_callee_type(
fullname, dec, [temp], [nodes.ARG_POS], e, object_type=object_type
)
sig, t2 = self.expr_checker.check_call(
dec, [temp], [nodes.ARG_POS], e, callable_name=fullname, object_type=object_type
)
Expand Down
13 changes: 13 additions & 0 deletions test-data/unit/check-custom-plugin.test
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,19 @@ reveal_type(dynamic_signature(b)) # N: Revealed type is "builtins.bytes"
\[mypy]
plugins=<ROOT>/test-data/unit/plugins/function_sig_hook.py

[case testFunctionSigHookCalledOnDecorator]
# flags: --config-file tmp/mypy.ini

def dynamic_signature(arg1: str) -> str: ...

@dynamic_signature
def f() -> None: ...

reveal_type(f) # N: Revealed type is "def ()"
[file mypy.ini]
\[mypy]
plugins=<ROOT>/test-data/unit/plugins/function_sig_hook.py

[case testPluginCalledCorrectlyWhenMethodInDecorator]
# flags: --config-file tmp/mypy.ini
from typing import TypeVar, Callable
Expand Down
Loading