31
31
32
32
33
33
def _change_decorator_function_type (
34
- decorated : CallableType ,
35
34
decorator : CallableType ,
35
+ arg_type : CallableType ,
36
36
) -> CallableType :
37
37
"""Replaces revealed argument types by mypy with types from decorated."""
38
- decorator .arg_types = decorated .arg_types
39
- decorator .arg_kinds = decorated .arg_kinds
40
- decorator .arg_names = decorated .arg_names
41
- return decorator
38
+ return decorator .copy_modified (
39
+ arg_types = arg_type .arg_types ,
40
+ arg_kinds = arg_type .arg_kinds ,
41
+ arg_names = arg_type .arg_names ,
42
+ variables = arg_type .variables ,
43
+ is_ellipsis_args = arg_type .is_ellipsis_args ,
44
+ )
42
45
43
46
44
47
def _analyze_decorator (function_ctx : FunctionContext ):
@@ -48,8 +51,8 @@ def _analyze_decorator(function_ctx: FunctionContext):
48
51
if not isinstance (function_ctx .default_return_type , CallableType ):
49
52
return function_ctx .default_return_type
50
53
return _change_decorator_function_type (
51
- function_ctx .arg_types [0 ][0 ],
52
54
function_ctx .default_return_type ,
55
+ function_ctx .arg_types [0 ][0 ],
53
56
)
54
57
55
58
0 commit comments