Files
openide/python/testData/highlighting/awaitInGenerator.py
Mikhail Golubev fcf665e761 PY-64304 EA-247016 Report illegal usages of "await" expressions even if there is no operand
In other words, in a statement like "await = 42" there are now both a warning about
the missing operand and a warning that an await expression cannot be used as
an assignment target. This behavior is consistent with other expressions where
additional parsing errors are not special-cased.

GitOrigin-RevId: 37a68eacc7ec042435c185f9ddd8bc2eea42b40f
2024-04-24 09:03:57 +00:00

40 lines
1.0 KiB
Python

async def f11(x):
y = (await<error descr="Expression expected"> </error>for <error descr="Cannot assign to await expression">await</error><error descr="Expression expected"> </error>in []) # fail
await x
def f12(x):
y = (await for await in [])
return x
async def f21(x):
y = (mapper(await<error descr="Expression expected">)</error> for <error descr="Cannot assign to await expression">await</error><error descr="Expression expected"> </error>in []) # fail
await x
def f22(x):
y = (mapper(await) for await in [])
return x
async def f31(x):
<error descr="Cannot assign to await expression">await</error><error descr="Expression expected"> </error>= [] # fail
y = (i for i in await<error descr="Expression expected">)</error> # fail
await x
def f32(x):
await = []
y = (i for i in await)
return x
async def f43(x):
y = (z for <error descr="Cannot assign to await expression">await z</error> in []) # fail
await x
async def f44(x):
y = (z for z in await x)
await x