Skip to content

Commit bd33c7a

Browse files
committed
Fix self check
1 parent f3f69e6 commit bd33c7a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: mypy/plugins/attrs.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,9 @@ def evolve_function_sig_callback(ctx: mypy.plugin.FunctionSigContext) -> Callabl
991991

992992

993993
def _get_cls_from_init(t: Type) -> Optional[TypeInfo]:
994-
if isinstance(t, CallableType):
995-
return t.type_object()
994+
proper_type = get_proper_type(t)
995+
if isinstance(proper_type, CallableType):
996+
return proper_type.type_object()
996997
return None
997998

998999

@@ -1005,7 +1006,8 @@ def fields_function_callback(ctx: FunctionContext) -> Type:
10051006
if MAGIC_ATTR_NAME in cls.names:
10061007
# This is a proper attrs class.
10071008
ret_type = cls.names[MAGIC_ATTR_NAME].type
1008-
return ret_type
1009+
if ret_type is not None:
1010+
return ret_type
10091011
else:
10101012
ctx.api.fail(
10111013
f'Argument 1 to "fields" has incompatible type "{format_type_bare(first_arg_type)}"; expected an attrs class',

0 commit comments

Comments
 (0)