mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Make Ellipsis without list in Callable work, fixes #1475
This commit is contained in:
@@ -278,17 +278,17 @@ def infer_type_vars_for_execution(function, arguments, annotation_dict):
|
|||||||
|
|
||||||
|
|
||||||
def infer_return_for_callable(arguments, param_values, result_values):
|
def infer_return_for_callable(arguments, param_values, result_values):
|
||||||
result = NO_VALUES
|
all_type_vars = {}
|
||||||
for pv in param_values:
|
for pv in param_values:
|
||||||
if pv.array_type == 'list':
|
if pv.array_type == 'list':
|
||||||
type_var_dict = infer_type_vars_for_callable(arguments, pv.py__iter__())
|
type_var_dict = infer_type_vars_for_callable(arguments, pv.py__iter__())
|
||||||
|
all_type_vars.update(type_var_dict)
|
||||||
|
|
||||||
result |= ValueSet.from_sets(
|
return ValueSet.from_sets(
|
||||||
v.define_generics(type_var_dict)
|
v.define_generics(type_var_dict)
|
||||||
if isinstance(v, (DefineGenericBase, TypeVar)) else ValueSet({v})
|
if isinstance(v, (DefineGenericBase, TypeVar)) else ValueSet({v})
|
||||||
for v in result_values
|
for v in result_values
|
||||||
).execute_annotation()
|
).execute_annotation()
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def infer_type_vars_for_callable(arguments, lazy_params):
|
def infer_type_vars_for_callable(arguments, lazy_params):
|
||||||
|
|||||||
@@ -436,6 +436,12 @@ def the_callable() -> float: ...
|
|||||||
#? float()
|
#? float()
|
||||||
call3_pls()(the_callable)[0]
|
call3_pls()(the_callable)[0]
|
||||||
|
|
||||||
|
def call4_pls(fn: typing.Callable[..., TYPE_VARX]) -> typing.Callable[..., TYPE_VARX]:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
#? int()
|
||||||
|
call4_pls(lambda x: 1)()
|
||||||
|
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# TYPE_CHECKING
|
# TYPE_CHECKING
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user