Files
openide/python/testData/psi/InvalidAssignmentExpressions.py
Semyon Proshev 48a952a327 Make parser stricter for for statements and expressions (PY-36478)
Now it more follows original python grammar.

GitOrigin-RevId: 199f30b819c85a4eba5cab9b3f67fbf1bb7f18b6
2020-11-24 17:35:00 +00:00

18 lines
340 B
Python

# Parenthesis everywhere because
# unparenthesized assignment expressions are prohibited
# at the top level of an expression statement
(x := y := z := 0)
(a[i] := x)
(self.rest := [])
(p: Optional[int] := None)
(b := -)
(x := )
x = (b[j] := z) = 'spam' # z is a reference
[x1 for x1 := 2 in (1, 2, 3)]
[x1 for (x1 := 2) in (1, 2, 3)]