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:
@@ -99,7 +99,7 @@ class DefineGenericBase(LazyValueWrapper):
|
|||||||
for generic_set in self.get_generics():
|
for generic_set in self.get_generics():
|
||||||
values = NO_VALUES
|
values = NO_VALUES
|
||||||
for generic in generic_set:
|
for generic in generic_set:
|
||||||
if isinstance(generic, (GenericClass, TypeVar)):
|
if isinstance(generic, (DefineGenericBase, TypeVar)):
|
||||||
result = generic.define_generics(type_var_dict)
|
result = generic.define_generics(type_var_dict)
|
||||||
values |= result
|
values |= result
|
||||||
if result != ValueSet({generic}):
|
if result != ValueSet({generic}):
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from typing import (
|
|||||||
Iterable,
|
Iterable,
|
||||||
List,
|
List,
|
||||||
Mapping,
|
Mapping,
|
||||||
|
Tuple,
|
||||||
Type,
|
Type,
|
||||||
TypeVar,
|
TypeVar,
|
||||||
Union,
|
Union,
|
||||||
@@ -59,6 +60,26 @@ for b in list_type_t_to_list_t(list_of_int_type):
|
|||||||
b
|
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:
|
def foo(x: T) -> T:
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user