Skip to content

Commit 93db908

Browse files
committed
add plugin_generated check
1 parent ad415cb commit 93db908

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mypy/plugins/attrs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,10 @@ def _get_attrs_init_type(typ: Instance) -> CallableType | None | AnyType:
10341034
return None
10351035
# case 1: normal FuncDef
10361036
if isinstance(init_method, FuncDef) and isinstance(init_method.type, CallableType):
1037-
return init_method.type
1037+
if getattr(init_method, "plugin_generated", False):
1038+
return init_method.type
1039+
else:
1040+
return AnyType(TypeOfAny.special_form)
10381041

10391042
# case 2: overloaded method
10401043
if isinstance(init_method, OverloadedFuncDef) and isinstance(init_method.type, Overloaded):

0 commit comments

Comments
 (0)