Files
openide/python/testData/psi/InvalidNonParenthesizedAssignmentExpressions.txt
Irina Fediaeva a86c492a92 PY-48940: Allow unparenthesized assignment expressions within set literals, set comprehensions.
(cherry picked from commit 1ed44bb7a0bde2c7000923c2ed2a671f913eae8f)

IJ-CR-11891

GitOrigin-RevId: bb0ae8626e085e6c9223626137dbdd07e5c084b3
2021-08-10 13:00:58 +00:00

516 lines
16 KiB
Plaintext

PyFile:InvalidNonParenthesizedAssignmentExpressions.py
PyAssignmentExpression
PyCallExpression: foo
PyReferenceExpression: foo
PsiElement(Py:IDENTIFIER)('foo')
PyArgumentList
PsiElement(Py:LPAR)('(')
PyKeywordArgumentImpl: x
PsiElement(Py:IDENTIFIER)('x')
PsiWhiteSpace(' ')
PsiElement(Py:EQ)('=')
PsiWhiteSpace(' ')
PyReferenceExpression: y
PsiElement(Py:IDENTIFIER)('y')
PsiErrorElement:',' or ')' expected
<empty list>
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyCallExpression: f
PyReferenceExpression: f
PsiElement(Py:IDENTIFIER)('f')
PyArgumentList
PsiElement(Py:LPAR)('(')
PyReferenceExpression: x
PsiElement(Py:IDENTIFIER)('x')
PsiElement(Py:RPAR)(')')
PsiElement(Py:RPAR)(')')
PsiErrorElement:Statement expected, found Py:IDENTIFIER
<empty list>
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# INVALID')
PsiWhiteSpace('\n')
PyExpressionStatement
PyCallExpression: foo
PyReferenceExpression: foo
PsiElement(Py:IDENTIFIER)('foo')
PyArgumentList
PsiElement(Py:LPAR)('(')
PyKeywordArgumentImpl: x
PsiElement(Py:IDENTIFIER)('x')
PsiElement(Py:EQ)('=')
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: y
PsiElement(Py:IDENTIFIER)('y')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyCallExpression: f
PyReferenceExpression: f
PsiElement(Py:IDENTIFIER)('f')
PyArgumentList
PsiElement(Py:LPAR)('(')
PyReferenceExpression: x
PsiElement(Py:IDENTIFIER)('x')
PsiElement(Py:RPAR)(')')
PsiElement(Py:RPAR)(')')
PsiElement(Py:RPAR)(')')
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# Valid, though probably confusing')
PsiWhiteSpace('\n\n')
PyFunction('foo')
PsiElement(Py:DEF_KEYWORD)('def')
PsiWhiteSpace(' ')
PsiElement(Py:IDENTIFIER)('foo')
PyParameterList
PsiElement(Py:LPAR)('(')
PyNamedParameter('answer')
PsiElement(Py:IDENTIFIER)('answer')
PsiWhiteSpace(' ')
PsiElement(Py:EQ)('=')
PsiWhiteSpace(' ')
PyReferenceExpression: p
PsiElement(Py:IDENTIFIER)('p')
PsiErrorElement:',' or '(' or ')' expected
<empty list>
PsiWhiteSpace(' ')
PyStatementList
PsiElement(Py:COLONEQ)(':=')
PsiErrorElement:Statement expected, found Py:COLONEQ
<empty list>
PsiWhiteSpace(' ')
PyExpressionStatement
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('42')
PsiErrorElement:End of statement expected
<empty list>
PsiElement(Py:RPAR)(')')
PsiErrorElement:Statement expected, found Py:RPAR
<empty list>
PsiElement(Py:COLON)(':')
PsiErrorElement:Statement expected, found Py:COLON
<empty list>
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# INVALID')
PsiWhiteSpace('\n ')
PsiErrorElement:Unexpected indent
<empty list>
PyPassStatement
PsiElement(Py:PASS_KEYWORD)('pass')
PsiErrorElement:Statement expected, found Py:DEDENT
<empty list>
PsiWhiteSpace('\n')
PyFunction('foo')
PsiElement(Py:DEF_KEYWORD)('def')
PsiWhiteSpace(' ')
PsiElement(Py:IDENTIFIER)('foo')
PyParameterList
PsiElement(Py:LPAR)('(')
PyNamedParameter('answer')
PsiElement(Py:IDENTIFIER)('answer')
PsiElement(Py:EQ)('=')
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: p
PsiElement(Py:IDENTIFIER)('p')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('42')
PsiElement(Py:RPAR)(')')
PsiElement(Py:RPAR)(')')
PsiElement(Py:COLON)(':')
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# Valid, though not great style')
PsiWhiteSpace('\n ')
PyStatementList
PyPassStatement
PsiElement(Py:PASS_KEYWORD)('pass')
PsiWhiteSpace('\n\n')
PyFunction('foo')
PsiElement(Py:DEF_KEYWORD)('def')
PsiWhiteSpace(' ')
PsiElement(Py:IDENTIFIER)('foo')
PyParameterList
PsiElement(Py:LPAR)('(')
PyNamedParameter('answer')
PsiElement(Py:IDENTIFIER)('answer')
PyAnnotation
PsiElement(Py:COLON)(':')
PsiWhiteSpace(' ')
PyReferenceExpression: p
PsiElement(Py:IDENTIFIER)('p')
PsiErrorElement:',' or '(' or ')' expected
<empty list>
PsiWhiteSpace(' ')
PyStatementList
PsiElement(Py:COLONEQ)(':=')
PsiErrorElement:Statement expected, found Py:COLONEQ
<empty list>
PsiWhiteSpace(' ')
PyAssignmentStatement
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('42')
PsiWhiteSpace(' ')
PsiElement(Py:EQ)('=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('5')
PsiErrorElement:End of statement expected
<empty list>
PsiElement(Py:RPAR)(')')
PsiErrorElement:Statement expected, found Py:RPAR
<empty list>
PsiElement(Py:COLON)(':')
PsiErrorElement:Statement expected, found Py:COLON
<empty list>
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# INVALID')
PsiWhiteSpace('\n ')
PsiErrorElement:Unexpected indent
<empty list>
PyPassStatement
PsiElement(Py:PASS_KEYWORD)('pass')
PsiErrorElement:Statement expected, found Py:DEDENT
<empty list>
PsiWhiteSpace('\n')
PyFunction('foo')
PsiElement(Py:DEF_KEYWORD)('def')
PsiWhiteSpace(' ')
PsiElement(Py:IDENTIFIER)('foo')
PyParameterList
PsiElement(Py:LPAR)('(')
PyNamedParameter('answer')
PsiElement(Py:IDENTIFIER)('answer')
PyAnnotation
PsiElement(Py:COLON)(':')
PsiWhiteSpace(' ')
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: p
PsiElement(Py:IDENTIFIER)('p')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('42')
PsiElement(Py:RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(Py:EQ)('=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('5')
PsiElement(Py:RPAR)(')')
PsiElement(Py:COLON)(':')
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# Valid, but probably never useful')
PsiWhiteSpace('\n ')
PyStatementList
PyPassStatement
PsiElement(Py:PASS_KEYWORD)('pass')
PsiWhiteSpace('\n\n')
PyExpressionStatement
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyLambdaExpression
PsiElement(Py:LAMBDA_KEYWORD)('lambda')
PyParameterList
<empty list>
PsiElement(Py:COLON)(':')
PsiWhiteSpace(' ')
PyReferenceExpression: x
PsiElement(Py:IDENTIFIER)('x')
PsiErrorElement:Identifier expected
<empty list>
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('1')
PsiElement(Py:RPAR)(')')
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# INVALID')
PsiWhiteSpace('\n')
PyExpressionStatement
PyLambdaExpression
PsiElement(Py:LAMBDA_KEYWORD)('lambda')
PyParameterList
<empty list>
PsiElement(Py:COLON)(':')
PsiWhiteSpace(' ')
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: x
PsiElement(Py:IDENTIFIER)('x')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('1')
PsiElement(Py:RPAR)(')')
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# Valid, but unlikely to be useful')
PsiWhiteSpace('\n\n')
PyAssignmentStatement
PyTargetExpression: result_dict
PsiElement(Py:IDENTIFIER)('result_dict')
PsiWhiteSpace(' ')
PsiElement(Py:EQ)('=')
PsiWhiteSpace(' ')
PyAssignmentExpression
PyDictLiteralExpression
PsiElement(Py:LBRACE)('{')
PyReferenceExpression: a
PsiElement(Py:IDENTIFIER)('a')
PsiErrorElement:Expression expected
<empty list>
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('1')
PsiErrorElement:Expression expected
<empty list>
PsiWhiteSpace(' ')
PsiElement(Py:COLON)(':')
PsiErrorElement:Statement expected, found Py:COLON
<empty list>
PsiWhiteSpace(' ')
PyExpressionStatement
PyAssignmentExpression
PyTargetExpression: b
PsiElement(Py:IDENTIFIER)('b')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('2')
PsiErrorElement:End of statement expected
<empty list>
PsiElement(Py:RBRACE)('}')
PsiErrorElement:Statement expected, found Py:RBRACE
<empty list>
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# INVALID')
PsiWhiteSpace('\n')
PyAssignmentStatement
PyTargetExpression: result_dict
PsiElement(Py:IDENTIFIER)('result_dict')
PsiWhiteSpace(' ')
PsiElement(Py:EQ)('=')
PsiWhiteSpace(' ')
PyAssignmentExpression
PyDictLiteralExpression
PsiElement(Py:LBRACE)('{')
PyReferenceExpression: a
PsiElement(Py:IDENTIFIER)('a')
PsiErrorElement:Expression expected
<empty list>
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('1')
PsiErrorElement:Expression expected
<empty list>
PsiWhiteSpace(' ')
PsiElement(Py:COLON)(':')
PsiErrorElement:Statement expected, found Py:COLON
<empty list>
PsiWhiteSpace(' ')
PyExpressionStatement
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: b
PsiElement(Py:IDENTIFIER)('b')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('2')
PsiElement(Py:RPAR)(')')
PsiErrorElement:End of statement expected
<empty list>
PsiElement(Py:RBRACE)('}')
PsiErrorElement:Statement expected, found Py:RBRACE
<empty list>
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# INVALID')
PsiWhiteSpace('\n')
PyAssignmentStatement
PyTargetExpression: result_dict
PsiElement(Py:IDENTIFIER)('result_dict')
PsiWhiteSpace(' ')
PsiElement(Py:EQ)('=')
PsiWhiteSpace(' ')
PyDictLiteralExpression
PsiElement(Py:LBRACE)('{')
PyKeyValueExpression
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: a
PsiElement(Py:IDENTIFIER)('a')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('1')
PsiElement(Py:RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(Py:COLON)(':')
PsiWhiteSpace(' ')
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: b
PsiElement(Py:IDENTIFIER)('b')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('2')
PsiElement(Py:RPAR)(')')
PsiElement(Py:RBRACE)('}')
PsiWhiteSpace('\n\n')
PyAssertStatement
PsiElement(Py:ASSERT_KEYWORD)('assert')
PsiWhiteSpace(' ')
PyReferenceExpression: a
PsiElement(Py:IDENTIFIER)('a')
PsiErrorElement:End of statement expected
<empty list>
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiErrorElement:Statement expected, found Py:COLONEQ
<empty list>
PsiWhiteSpace(' ')
PyExpressionStatement
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('1')
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# INVALID')
PsiWhiteSpace('\n')
PyAssertStatement
PsiElement(Py:ASSERT_KEYWORD)('assert')
PsiWhiteSpace(' ')
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: a
PsiElement(Py:IDENTIFIER)('a')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('1')
PsiElement(Py:RPAR)(')')
PsiWhiteSpace('\n\n')
PyAssignmentStatement
PyTargetExpression: l
PsiElement(Py:IDENTIFIER)('l')
PsiWhiteSpace(' ')
PsiElement(Py:EQ)('=')
PsiWhiteSpace(' ')
PyListLiteralExpression
PsiElement(Py:LBRACKET)('[')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('1')
PsiElement(Py:COMMA)(',')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('2')
PsiElement(Py:RBRACKET)(']')
PsiWhiteSpace('\n')
PyExpressionStatement
PySubscriptionExpression
PyReferenceExpression: l
PsiElement(Py:IDENTIFIER)('l')
PsiElement(Py:LBRACKET)('[')
PyAssignmentExpression
PyTargetExpression: a
PsiElement(Py:IDENTIFIER)('a')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('0')
PsiElement(Py:RBRACKET)(']')
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# INVALID')
PsiWhiteSpace('\n')
PyExpressionStatement
PySubscriptionExpression
PyReferenceExpression: l
PsiElement(Py:IDENTIFIER)('l')
PsiElement(Py:LBRACKET)('[')
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: a
PsiElement(Py:IDENTIFIER)('a')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('0')
PsiElement(Py:RPAR)(')')
PsiElement(Py:RBRACKET)(']')
PsiWhiteSpace('\n\n')
PyWithStatement
PsiElement(Py:WITH_KEYWORD)('with')
PsiWhiteSpace(' ')
PyWithItem
PyReferenceExpression: f
PsiElement(Py:IDENTIFIER)('f')
PsiWhiteSpace(' ')
PsiErrorElement:':' expected
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PsiElement(Py:IDENTIFIER)('open')
PsiElement(Py:LPAR)('(')
PsiElement(Py:SINGLE_QUOTED_STRING)(''file.txt'')
PsiElement(Py:RPAR)(')')
PsiElement(Py:COLON)(':')
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# INVALID')
PsiWhiteSpace('\n ')
PyStatementList
PyPassStatement
PsiElement(Py:PASS_KEYWORD)('pass')
PsiWhiteSpace('\n\n')
PyWithStatement
PsiElement(Py:WITH_KEYWORD)('with')
PsiWhiteSpace(' ')
PyWithItem
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: f
PsiElement(Py:IDENTIFIER)('f')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyCallExpression: open
PyReferenceExpression: open
PsiElement(Py:IDENTIFIER)('open')
PyArgumentList
PsiElement(Py:LPAR)('(')
PyStringLiteralExpression: file.txt
PsiElement(Py:SINGLE_QUOTED_STRING)(''file.txt'')
PsiElement(Py:RPAR)(')')
PsiElement(Py:RPAR)(')')
PsiElement(Py:COLON)(':')
PsiWhiteSpace('\n ')
PyStatementList
PyPassStatement
PsiElement(Py:PASS_KEYWORD)('pass')