Files
openide/python/testData/highlighting/assignmentTargets3K.py
Mikhail Golubev b9d7fee816 PY-64304 EA-247016 Don't report illegal "await" expressions used as assignment targets during parsing
Instead, parse them as usual and later report in the dedicated AssignTargetAnnotator
and TypeAnnotationTargetAnnotator. This way, a PsiError element appearing in the PSI
tree of a type declaration statement doesn't cause PyAstTypeDeclarationStatement.getTarget
nullability contract violation.

GitOrigin-RevId: a3e90088cfac7938c398d4d293a72dbd127a2cd0
2024-04-24 09:03:53 +00:00

19 lines
708 B
Python

<error descr="Starred assignment target must be in a list or tuple">*hi</error> = [1, 2]
*a, = range(5)
for a, *b in [(1, 2, 3), (4, 5, 6, 7)]:
print(b)
a, b, c = seq[0], seq[1:-1], seq[-1]
a, *b, c = seq
[a, *b, c] = seq
<error descr="Assignment to keyword">True</error> = 2
<error descr="Assignment to keyword">False</error> = 1
<error descr="Assignment to keyword">None</error> = 0
<error descr="Assignment to keyword">__debug__</error> = -1
() = []
[] = []
async def f():
<error descr="Cannot assign to await expression">await foo()</error> = 1
<error descr="An illegal target for a variable annotation"><error descr="Cannot assign to await expression">await foo()</error></error>: int = 1