mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 14:01:56 +08:00
additional defer() to offset the effect of using the type before decl… (#424)
* additional defer() to offset the effect of using the type before declaring * linter fix * linter fix * linter fix * test case Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>
This commit is contained in:
@@ -343,6 +343,7 @@ def copy_method_to_another_class(ctx: ClassDefContext, self_type: Instance,
|
||||
arguments = []
|
||||
bound_return_type = semanal_api.anal_type(method_type.ret_type,
|
||||
allow_placeholder=True)
|
||||
|
||||
assert bound_return_type is not None
|
||||
|
||||
if isinstance(bound_return_type, PlaceholderNode):
|
||||
@@ -352,6 +353,10 @@ def copy_method_to_another_class(ctx: ClassDefContext, self_type: Instance,
|
||||
method_type.arg_types[1:],
|
||||
method_node.arguments[1:]):
|
||||
bound_arg_type = semanal_api.anal_type(arg_type, allow_placeholder=True)
|
||||
if bound_arg_type is None and not semanal_api.final_iteration:
|
||||
semanal_api.defer()
|
||||
return
|
||||
|
||||
assert bound_arg_type is not None
|
||||
|
||||
if isinstance(bound_arg_type, PlaceholderNode):
|
||||
|
||||
Reference in New Issue
Block a user