mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Make sure that infering params is possible from the API
This commit is contained in:
@@ -169,6 +169,8 @@ class InferenceState(object):
|
||||
return imports.infer_import(context, name)
|
||||
if type_ == 'with_stmt':
|
||||
return tree_name_to_values(self, context, name)
|
||||
elif type_ == 'param':
|
||||
return context.py__getattribute__(name.value, position=name.end_pos)
|
||||
else:
|
||||
result = follow_error_node_imports_if_possible(context, name)
|
||||
if result is not None:
|
||||
|
||||
@@ -299,6 +299,25 @@ except MyException as e:
|
||||
for x in e.my_attr:
|
||||
pass
|
||||
|
||||
# -----------------
|
||||
# params
|
||||
# -----------------
|
||||
|
||||
my_param = 1
|
||||
#? 9 str()
|
||||
def foo1(my_param):
|
||||
my_param = 3.0
|
||||
foo1("")
|
||||
|
||||
my_type = float()
|
||||
#? 20 float()
|
||||
def foo2(my_param: my_type):
|
||||
pass
|
||||
foo2("")
|
||||
#? 20 int()
|
||||
def foo3(my_param=my_param):
|
||||
pass
|
||||
foo3("")
|
||||
|
||||
# -----------------
|
||||
# continuations
|
||||
|
||||
Reference in New Issue
Block a user