enable some test folders, bunch of fixes

This commit is contained in:
Maxim Kurnikov
2019-02-07 00:08:05 +03:00
parent d43cb1fcd7
commit 191496ed72
25 changed files with 208 additions and 173 deletions

View File

@@ -1,5 +1,5 @@
from mypy.plugin import FunctionContext
from mypy.types import Type
from mypy.types import Type, Instance
def determine_type_of_array_field(ctx: FunctionContext) -> Type:
@@ -7,5 +7,13 @@ def determine_type_of_array_field(ctx: FunctionContext) -> Type:
return ctx.default_return_type
base_field_arg_type = ctx.arg_types[ctx.callee_arg_names.index('base_field')][0]
if not isinstance(base_field_arg_type, Instance):
return ctx.default_return_type
get_method = base_field_arg_type.type.get_method('__get__')
if not get_method:
# not a method
return ctx.default_return_type
return ctx.api.named_generic_type(ctx.context.callee.fullname,
args=[base_field_arg_type.type.names['__get__'].type.ret_type])
args=[get_method.type.ret_type])