1
0
forked from VimPlug/jedi

Implement Self, fixes #2023, fixes #2068

This commit is contained in:
Dave Halter
2026-04-29 17:51:01 +02:00
parent c30732eb04
commit aa72381ed1
16 changed files with 92 additions and 47 deletions
+6 -6
View File
@@ -249,12 +249,12 @@ def infer_return_types(function, arguments):
return _infer_annotation_string(
context,
match.group(1).strip()
).execute_annotation()
).execute_annotation(context)
unknown_type_vars = find_unknown_type_vars(context, annotation)
annotation_values = infer_annotation(context, annotation)
if not unknown_type_vars:
return annotation_values.execute_annotation()
return annotation_values.execute_annotation(context)
type_var_dict = infer_type_vars_for_execution(function, arguments, all_annotations)
@@ -262,7 +262,7 @@ def infer_return_types(function, arguments):
ann.define_generics(type_var_dict)
if isinstance(ann, (DefineGenericBaseClass, TypeVar)) else ValueSet({ann})
for ann in annotation_values
).execute_annotation()
).execute_annotation(context)
def infer_type_vars_for_execution(function, arguments, annotation_dict):
@@ -315,7 +315,7 @@ def infer_return_for_callable(arguments, param_values, result_values):
if isinstance(v, (DefineGenericBaseClass, TypeVar))
else ValueSet({v})
for v in result_values
).execute_annotation()
).execute_annotation(arguments.context)
def _infer_type_vars_for_callable(arguments, lazy_params):
@@ -391,7 +391,7 @@ def merge_pairwise_generics(annotation_value, annotated_argument_class):
for annotation_generics_set, actual_generic_set in zip(annotation_generics, actual_generics):
merge_type_var_dicts(
type_var_dict,
annotation_generics_set.infer_type_vars(actual_generic_set.execute_annotation()),
annotation_generics_set.infer_type_vars(actual_generic_set.execute_annotation(None)),
)
return type_var_dict
@@ -438,7 +438,7 @@ def _find_type_from_comment_hint(context, node, varlist, name):
return []
return _infer_annotation_string(
context, match.group(1).strip(), index
).execute_annotation()
).execute_annotation(context)
def find_unknown_type_vars(context, node):