Skip to content

Commit c1af26c

Browse files
authored
handle return value of anal_type properly (#280)
1 parent 3c3dfcb commit c1af26c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

mypy_django_plugin/lib/helpers.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,14 @@ def copy_method_to_another_class(ctx: ClassDefContext, self_type: Instance,
331331
semanal_api = get_semanal_api(ctx)
332332
for argument in arguments:
333333
if argument.type_annotation is not None:
334-
argument.type_annotation = semanal_api.anal_type(argument.type_annotation)
334+
argument.type_annotation = semanal_api.anal_type(argument.type_annotation,
335+
allow_placeholder=True)
336+
335337
if return_type is not None:
336-
return_type = semanal_api.anal_type(return_type) or AnyType(TypeOfAny.unannotated)
338+
ret = semanal_api.anal_type(return_type,
339+
allow_placeholder=True)
340+
assert ret is not None
341+
return_type = ret
337342

338343
add_method(ctx,
339344
new_method_name,

0 commit comments

Comments
 (0)