Fix: Function calls with generators should always work, even if syntastically invalid

This commit is contained in:
Dave Halter
2019-05-31 13:35:23 +02:00
parent 4d647238b3
commit 3fb5b4992b
3 changed files with 55 additions and 17 deletions

View File

@@ -223,3 +223,33 @@ next(iter({a for a in range(10)}))
[int(str(x.value) for x in list
def reset_missing_bracket(): pass
# -----------------
# function calls
# -----------------
def foo(arg):
return arg
x = foo(x for x in [1])
#? int()
next(x)
#?
x[0]
# While it's illegal to have more than one argument, when a generator
# expression is involved, it's still a valid parse tree and Jedi should still
# work (and especially not raise Exceptions). It's debatable wheter inferring
# values for invalid statements is a good idea, but not failing is a must.
#? int()
next(foo(x for x in [1], 1))
def bar(x, y):
return y
#? str()
next(bar(x for x in [1], x for x in ['']))