Files
openide/python/testData/psi/AssignmentExpressionsInIndexes.txt
Petr ff19de5654 PY-81646 False positive: Unresolved references after any slice in Python for the rest of the line
Fixed AST for PySubscriptionExpression containing a slice.
Before PySubscriptionExpression.getIndexExpression() returned only the first slice expression (if any).

Also fixed PySliceItem's subtree, so now its children are correctly mapped to lowerBound, upperBound and stride properties.

GitOrigin-RevId: 840af92957d0431679cf7a477866dea76320ca80
2025-06-13 18:59:31 +00:00

162 lines
5.2 KiB
Plaintext

PyFile:AssignmentExpressionsInIndexes.py
PyAssignmentStatement
PyTargetExpression: s
PsiElement(Py:IDENTIFIER)('s')
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\n')
PyExpressionStatement
PySubscriptionExpression
PyReferenceExpression: s
PsiElement(Py:IDENTIFIER)('s')
PsiElement(Py:LBRACKET)('[')
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: c
PsiElement(Py:IDENTIFIER)('c')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('0')
PsiElement(Py:RPAR)(')')
PsiElement(Py:RBRACKET)(']')
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# valid')
PsiWhiteSpace('\n')
PyExpressionStatement
PySubscriptionExpression
PyReferenceExpression: s
PsiElement(Py:IDENTIFIER)('s')
PsiElement(Py:LBRACKET)('[')
PyAssignmentExpression
PyTargetExpression: d
PsiElement(Py:IDENTIFIER)('d')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('0')
PsiElement(Py:RBRACKET)(']')
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# valid')
PsiWhiteSpace('\n\n')
PyExpressionStatement
PySubscriptionExpression
PyReferenceExpression: s
PsiElement(Py:IDENTIFIER)('s')
PsiElement(Py:LBRACKET)('[')
PySliceItem
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: d
PsiElement(Py:IDENTIFIER)('d')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('0')
PsiElement(Py:RPAR)(')')
PsiElement(Py:COLON)(':')
PsiWhiteSpace(' ')
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: e
PsiElement(Py:IDENTIFIER)('e')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('1')
PsiElement(Py:RPAR)(')')
PsiElement(Py:RBRACKET)(']')
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# valid')
PsiWhiteSpace('\n')
PyTypeDeclarationStatement
PySubscriptionExpression
PyReferenceExpression: s
PsiElement(Py:IDENTIFIER)('s')
PsiElement(Py:LBRACKET)('[')
PyAssignmentExpression
PyTargetExpression: d
PsiElement(Py:IDENTIFIER)('d')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('0')
PsiErrorElement:']' expected
<empty list>
PyAnnotation
PsiElement(Py:COLON)(':')
PsiWhiteSpace(' ')
PyParenthesizedExpression
PsiElement(Py:LPAR)('(')
PyAssignmentExpression
PyTargetExpression: e
PsiElement(Py:IDENTIFIER)('e')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('1')
PsiElement(Py:RPAR)(')')
PsiErrorElement:End of statement expected
<empty list>
PsiElement(Py:RBRACKET)(']')
PsiErrorElement:Statement expected, found Py:RBRACKET
<empty list>
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# invalid')
PsiWhiteSpace('\n')
PyTypeDeclarationStatement
PySubscriptionExpression
PyReferenceExpression: s
PsiElement(Py:IDENTIFIER)('s')
PsiElement(Py:LBRACKET)('[')
PyAssignmentExpression
PyTargetExpression: d
PsiElement(Py:IDENTIFIER)('d')
PsiWhiteSpace(' ')
PsiElement(Py:COLONEQ)(':=')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('0')
PsiErrorElement:']' expected
<empty list>
PyAnnotation
PsiElement(Py:COLON)(':')
PsiWhiteSpace(' ')
PyReferenceExpression: e
PsiElement(Py:IDENTIFIER)('e')
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')
PsiErrorElement:End of statement expected
<empty list>
PsiElement(Py:RBRACKET)(']')
PsiErrorElement:Statement expected, found Py:RBRACKET
<empty list>
PsiWhiteSpace(' ')
PsiComment(Py:END_OF_LINE_COMMENT)('# invalid')