1
0
forked from VimPlug/jedi

Fix construction of nested generic tuple return types

Unfortunately this appears to show up a separate bug.
This commit is contained in:
Peter Law
2020-04-18 19:43:47 +01:00
parent a793dd7c91
commit 1c4a2edbdb
2 changed files with 22 additions and 1 deletions

View File

@@ -99,7 +99,7 @@ class DefineGenericBase(LazyValueWrapper):
for generic_set in self.get_generics():
values = NO_VALUES
for generic in generic_set:
if isinstance(generic, (GenericClass, TypeVar)):
if isinstance(generic, (DefineGenericBase, TypeVar)):
result = generic.define_generics(type_var_dict)
values |= result
if result != ValueSet({generic}):

View File

@@ -6,6 +6,7 @@ from typing import (
Iterable,
List,
Mapping,
Tuple,
Type,
TypeVar,
Union,
@@ -59,6 +60,26 @@ for b in list_type_t_to_list_t(list_of_int_type):
b
# Test construction of nested generic tuple return parameters
def list_t_to_list_tuple_t(the_list: List[T]) -> List[Tuple[T]]:
return [(x,) for x in the_list]
x1t = list_t_to_list_tuple_t(list_of_ints)[0][0]
#? int()
x1t
for c1 in list_t_to_list_tuple_t(list_of_ints):
#? int()
c1[0]
for c2, in list_t_to_list_tuple_t(list_of_ints):
#? int()
c2
def foo(x: T) -> T:
return x