mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
add a new static_analysis file to test star arguments separately
This commit is contained in:
@@ -49,6 +49,8 @@ def _get_calling_var_args(evaluator, var_args):
|
|||||||
param = names[0].parent
|
param = names[0].parent
|
||||||
if not isinstance(param, ExecutedParam):
|
if not isinstance(param, ExecutedParam):
|
||||||
break
|
break
|
||||||
|
# We never want var_args to be a tuple. This should be enough for
|
||||||
|
# now, we can change it later, if we need to.
|
||||||
if isinstance(param.var_args, pr.Array):
|
if isinstance(param.var_args, pr.Array):
|
||||||
var_args = param.var_args
|
var_args = param.var_args
|
||||||
return var_args
|
return var_args
|
||||||
|
|||||||
@@ -13,12 +13,6 @@ simple()
|
|||||||
simple(1, 2)
|
simple(1, 2)
|
||||||
|
|
||||||
|
|
||||||
def nested(*args):
|
|
||||||
return simple(*args)
|
|
||||||
|
|
||||||
nested(1)
|
|
||||||
#! 6 type-error-too-few-arguments
|
|
||||||
nested()
|
|
||||||
#! 10 type-error-too-many-arguments
|
#! 10 type-error-too-many-arguments
|
||||||
simple(1, 2, 3)
|
simple(1, 2, 3)
|
||||||
|
|
||||||
|
|||||||
10
test/static_analysis/star_arguments.py
Normal file
10
test/static_analysis/star_arguments.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
def simple(a):
|
||||||
|
return a
|
||||||
|
|
||||||
|
def nested(*args):
|
||||||
|
return simple(*args)
|
||||||
|
|
||||||
|
nested(1)
|
||||||
|
#! 6 type-error-too-few-arguments
|
||||||
|
nested()
|
||||||
Reference in New Issue
Block a user