Skip to content

Commit 22c8dfd

Browse files
committed
Fix: return Anytype
1 parent 58a1d3d commit 22c8dfd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

mypy/plugins/attrs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,7 @@ def _get_attrs_init_type(typ: Instance) -> CallableType | None | AnyType:
10381038

10391039
# case 2: overloaded method
10401040
if isinstance(init_method, OverloadedFuncDef) and isinstance(init_method.type, Overloaded):
1041-
if len(init_method.type.items) >= 1:
1042-
return AnyType(TypeOfAny.explicit)
1041+
return AnyType(TypeOfAny.special_form)
10431042
return None
10441043

10451044

@@ -1095,8 +1094,7 @@ def _get_expanded_attr_types(
10951094
_fail_not_attrs_class(ctx, display_typ, parent_typ)
10961095
return None
10971096
if isinstance(init_func, AnyType):
1098-
_fail_not_attrs_class(ctx, display_typ, parent_typ)
1099-
return None
1097+
return AnyType(TypeOfAny.special_form)
11001098
init_func = expand_type_by_instance(init_func, typ)
11011099
# [1:] to skip the self argument of AttrClass.__init__
11021100
field_names = cast(list[str], init_func.arg_names[1:])

0 commit comments

Comments
 (0)