forked from VimPlug/jedi
Handle generics appearing within any quoted annotations
This hoists the solution added for return-type annotations to also apply for input annotations so they work too.
This commit is contained in:
@@ -61,9 +61,13 @@ def typed_bound_generic_passthrough(x: TList) -> TList:
|
||||
# Forward references are more likely with custom types, however this aims to
|
||||
# test just the handling of the quoted type rather than any other part of the
|
||||
# machinery.
|
||||
def typed_quoted_generic_passthrough(x: T) -> 'List[T]':
|
||||
def typed_quoted_return_generic_passthrough(x: T) -> 'List[T]':
|
||||
return [x]
|
||||
|
||||
def typed_quoted_input_generic_passthrough(x: 'Tuple[T]') -> T:
|
||||
x
|
||||
return x[0]
|
||||
|
||||
|
||||
for a in untyped_passthrough(untyped_list_str):
|
||||
#? str()
|
||||
@@ -152,15 +156,22 @@ for q in typed_bound_generic_passthrough(typed_list_str):
|
||||
q
|
||||
|
||||
|
||||
for r in typed_quoted_generic_passthrough("something"):
|
||||
for r in typed_quoted_return_generic_passthrough("something"):
|
||||
#? str()
|
||||
r
|
||||
|
||||
for s in typed_quoted_generic_passthrough(42):
|
||||
for s in typed_quoted_return_generic_passthrough(42):
|
||||
#? int()
|
||||
s
|
||||
|
||||
|
||||
#? str()
|
||||
typed_quoted_input_generic_passthrough(("something",))
|
||||
|
||||
#? int()
|
||||
typed_quoted_input_generic_passthrough((42,))
|
||||
|
||||
|
||||
|
||||
class CustomList(List):
|
||||
def get_first(self):
|
||||
|
||||
Reference in New Issue
Block a user