From c1af26c027b0ebd574b258d1883c3f71e0994428 Mon Sep 17 00:00:00 2001 From: Maksim Kurnikov Date: Tue, 17 Dec 2019 23:36:44 +0300 Subject: [PATCH] handle return value of anal_type properly (#280) --- mypy_django_plugin/lib/helpers.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mypy_django_plugin/lib/helpers.py b/mypy_django_plugin/lib/helpers.py index 9ff77f0..c417d82 100644 --- a/mypy_django_plugin/lib/helpers.py +++ b/mypy_django_plugin/lib/helpers.py @@ -331,9 +331,14 @@ def copy_method_to_another_class(ctx: ClassDefContext, self_type: Instance, semanal_api = get_semanal_api(ctx) for argument in arguments: if argument.type_annotation is not None: - argument.type_annotation = semanal_api.anal_type(argument.type_annotation) + argument.type_annotation = semanal_api.anal_type(argument.type_annotation, + allow_placeholder=True) + if return_type is not None: - return_type = semanal_api.anal_type(return_type) or AnyType(TypeOfAny.unannotated) + ret = semanal_api.anal_type(return_type, + allow_placeholder=True) + assert ret is not None + return_type = ret add_method(ctx, new_method_name,