diff --git a/jedi/inference/gradual/annotation.py b/jedi/inference/gradual/annotation.py index 44f041c5..0e8582ee 100644 --- a/jedi/inference/gradual/annotation.py +++ b/jedi/inference/gradual/annotation.py @@ -389,7 +389,7 @@ def _infer_type_vars(annotation_value, value_set, is_class_value=False): # we combine them? for element in value_set: - py_class = element.py__class__() + py_class = element.get_annotated_class_object() if not isinstance(py_class, GenericClass): py_class = element @@ -444,7 +444,7 @@ def _infer_type_vars(annotation_value, value_set, is_class_value=False): continue if element.is_instance(): - py_class = element.py__class__() + py_class = element.get_annotated_class_object() else: py_class = element diff --git a/test/completion/pep0484_generic_parameters.py b/test/completion/pep0484_generic_parameters.py index a5ad8f45..dca64299 100644 --- a/test/completion/pep0484_generic_parameters.py +++ b/test/completion/pep0484_generic_parameters.py @@ -180,6 +180,16 @@ for x7 in unwrap_custom(list_custom_instances): x7 +for xc in unwrap_custom([CustomGeneric(s) for s in 'abc']): + #? str() + xc + + +for xg in unwrap_custom(CustomGeneric(s) for s in 'abc'): + #? str() + xg + + # Test extraction of type from type parameer nested within a custom generic type custom_instance_list_int = CustomGeneric([42]) # type: CustomGeneric[List[int]]