File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -5433,7 +5433,7 @@ def visit_with_stmt(self, s: WithStmt) -> None:
54335433 self .accept (s .body )
54345434
54355435 def check_untyped_after_decorator (self , typ : Type , func : FuncDef ) -> None :
5436- if not self .options .disallow_any_decorated or self .is_stub :
5436+ if not self .options .disallow_any_decorated or self .is_stub or self . current_node_deferred :
54375437 return
54385438
54395439 if mypy .checkexpr .has_any_type (typ ):
Original file line number Diff line number Diff line change @@ -1116,6 +1116,39 @@ def f(x: Any) -> Any: # E: Function is untyped after decorator transformation
11161116def h(x): # E: Function is untyped after decorator transformation
11171117 pass
11181118[builtins fixtures/list.pyi]
1119+
1120+ [case testDisallowAnyDecoratedUnannotatedDecoratorDeferred1]
1121+ # flags: --disallow-any-decorated
1122+ from typing import Any
1123+
1124+ def d(f):
1125+ return f
1126+
1127+ def wrapper() -> None:
1128+ if c:
1129+ @d
1130+ def h(x): # E: Function is untyped after decorator transformation
1131+ pass
1132+
1133+ c = [1]
1134+ [builtins fixtures/list.pyi]
1135+
1136+ [case testDisallowAnyDecoratedUnannotatedDecoratorDeferred2]
1137+ # flags: --disallow-any-decorated
1138+ from typing import Any
1139+
1140+ def d(f):
1141+ return f
1142+
1143+ def wrapper() -> None:
1144+ if c:
1145+ @d
1146+ def h(x): # E: Function is untyped after decorator transformation
1147+ pass
1148+
1149+ c = [1]
1150+ [builtins fixtures/list.pyi]
1151+
11191152[case testDisallowAnyDecoratedErrorIsReportedOnlyOnce]
11201153# flags: --disallow-any-decorated
11211154
You can’t perform that action at this time.
0 commit comments