07d35d305e
Fix a problem where deleting last import directive via "optimize imports" could lead to incorrect psi structure resulting in CCE, see EA-64291 New imports are inserted at the head (after package directive if present) of the file (before any comments) if no imports were present Add test for inserting import to file where a first statement is a comment Drop code dealing with non-existing import list in ImportInsertHelperImpl AbstractQuickFixTest: check for unexpected actions before changes to the file are made as it relies on the first line having specific format
276 lines
9.6 KiB
Plaintext
Vendored
276 lines
9.6 KiB
Plaintext
Vendored
JetFile: recovery.kt
|
|
PACKAGE_DIRECTIVE
|
|
<empty list>
|
|
IMPORT_LIST
|
|
<empty list>
|
|
FUN
|
|
PsiElement(fun)('fun')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(IDENTIFIER)('foo')
|
|
VALUE_PARAMETER_LIST
|
|
PsiElement(LPAR)('(')
|
|
PsiElement(RPAR)(')')
|
|
PsiWhiteSpace(' ')
|
|
BLOCK
|
|
PsiElement(LBRACE)('{')
|
|
PsiWhiteSpace('\n\n ')
|
|
BINARY_EXPRESSION
|
|
DOT_QUALIFIED_EXPRESSION
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('x2')
|
|
PsiElement(DOT)('.')
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('filter')
|
|
PsiWhiteSpace(' ')
|
|
OPERATION_REFERENCE
|
|
PsiElement(IDENTIFIER)('c')
|
|
PsiWhiteSpace(' ')
|
|
ANNOTATED_EXPRESSION
|
|
PsiErrorElement:Expected annotation identifier after '@'
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
FUNCTION_LITERAL_EXPRESSION
|
|
FUNCTION_LITERAL
|
|
PsiElement(LBRACE)('{')
|
|
PsiWhiteSpace(' ')
|
|
PsiComment(EOL_COMMENT)('// should be no space after c')
|
|
PsiWhiteSpace('\n ')
|
|
BLOCK
|
|
RETURN
|
|
PsiElement(return)('return')
|
|
PsiWhiteSpace(' ')
|
|
INTEGER_CONSTANT
|
|
PsiElement(INTEGER_LITERAL)('2')
|
|
PsiWhiteSpace('\n ')
|
|
PsiElement(RBRACE)('}')
|
|
PsiWhiteSpace('\n\n ')
|
|
DOT_QUALIFIED_EXPRESSION
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('x3')
|
|
PsiElement(DOT)('.')
|
|
CALL_EXPRESSION
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('filter')
|
|
PsiWhiteSpace(' ')
|
|
FUNCTION_LITERAL_ARGUMENT
|
|
ANNOTATED_EXPRESSION
|
|
PsiErrorElement:Expected annotation identifier after '@'
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
FUNCTION_LITERAL_EXPRESSION
|
|
FUNCTION_LITERAL
|
|
PsiElement(LBRACE)('{')
|
|
PsiWhiteSpace(' ')
|
|
PsiComment(EOL_COMMENT)('// no label identifier')
|
|
PsiWhiteSpace('\n ')
|
|
BLOCK
|
|
RETURN
|
|
PsiElement(return)('return')
|
|
PsiWhiteSpace(' ')
|
|
INTEGER_CONSTANT
|
|
PsiElement(INTEGER_LITERAL)('3')
|
|
PsiWhiteSpace('\n ')
|
|
PsiElement(RBRACE)('}')
|
|
PsiWhiteSpace('\n\n ')
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('loop2')
|
|
PsiWhiteSpace(' ')
|
|
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(for)('for')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(LPAR)('(')
|
|
PsiElement(IDENTIFIER)('i')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(in)('in')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(INTEGER_LITERAL)('1')
|
|
PsiElement(RANGE)('..')
|
|
PsiElement(INTEGER_LITERAL)('100')
|
|
PsiElement(RPAR)(')')
|
|
PsiWhiteSpace(' ')
|
|
FUNCTION_LITERAL_EXPRESSION
|
|
FUNCTION_LITERAL
|
|
PsiElement(LBRACE)('{')
|
|
PsiWhiteSpace(' ')
|
|
PsiComment(EOL_COMMENT)('// should be no space after loop2')
|
|
PsiWhiteSpace('\n ')
|
|
BLOCK
|
|
RETURN
|
|
PsiElement(return)('return')
|
|
PsiErrorElement:Label must be named
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('loop2')
|
|
PsiWhiteSpace(' ')
|
|
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
PsiElement(INTEGER_LITERAL)('5')
|
|
PsiWhiteSpace('\n ')
|
|
RETURN
|
|
PsiElement(return)('return')
|
|
PsiErrorElement:There should be no space or comments before '@' in label reference
|
|
<empty list>
|
|
PsiWhiteSpace(' ')
|
|
PsiErrorElement:Label must be named
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('loop2')
|
|
PsiWhiteSpace(' ')
|
|
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
PsiElement(INTEGER_LITERAL)('7')
|
|
PsiWhiteSpace('\n ')
|
|
RETURN
|
|
PsiElement(return)('return')
|
|
PsiWhiteSpace('\n ')
|
|
ANNOTATED_EXPRESSION
|
|
ANNOTATION_ENTRY
|
|
PsiElement(AT)('@')
|
|
CONSTRUCTOR_CALLEE
|
|
TYPE_REFERENCE
|
|
USER_TYPE
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('loop2')
|
|
PsiWhiteSpace(' ')
|
|
INTEGER_CONSTANT
|
|
PsiElement(INTEGER_LITERAL)('4')
|
|
PsiWhiteSpace('\n ')
|
|
PsiElement(RBRACE)('}')
|
|
PsiWhiteSpace('\n\n ')
|
|
ANNOTATED_EXPRESSION
|
|
PsiErrorElement:Expected annotation identifier after '@'
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
WHILE
|
|
PsiElement(while)('while')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(LPAR)('(')
|
|
CONDITION
|
|
INTEGER_CONSTANT
|
|
PsiElement(INTEGER_LITERAL)('1')
|
|
PsiElement(RPAR)(')')
|
|
PsiWhiteSpace(' ')
|
|
BODY
|
|
BLOCK
|
|
PsiElement(LBRACE)('{')
|
|
PsiWhiteSpace('\n ')
|
|
RETURN
|
|
PsiElement(return)('return')
|
|
PsiWhiteSpace(' ')
|
|
INTEGER_CONSTANT
|
|
PsiElement(INTEGER_LITERAL)('123')
|
|
PsiWhiteSpace('\n ')
|
|
PsiElement(RBRACE)('}')
|
|
PsiWhiteSpace('\n\n ')
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('label2')
|
|
PsiWhiteSpace(' ')
|
|
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(fun)('fun')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(IDENTIFIER)('foo')
|
|
PsiElement(LPAR)('(')
|
|
PsiElement(RPAR)(')')
|
|
PsiWhiteSpace(' ')
|
|
FUNCTION_LITERAL_EXPRESSION
|
|
FUNCTION_LITERAL
|
|
PsiElement(LBRACE)('{')
|
|
BLOCK
|
|
<empty list>
|
|
PsiElement(RBRACE)('}')
|
|
PsiWhiteSpace(' ')
|
|
PsiComment(EOL_COMMENT)('// should be no space after label2')
|
|
PsiWhiteSpace('\n\n ')
|
|
BINARY_EXPRESSION
|
|
BINARY_EXPRESSION
|
|
INTEGER_CONSTANT
|
|
PsiElement(INTEGER_LITERAL)('1')
|
|
PsiWhiteSpace(' ')
|
|
OPERATION_REFERENCE
|
|
PsiElement(PLUS)('+')
|
|
PsiWhiteSpace(' ')
|
|
LABELED_EXPRESSION
|
|
LABEL_QUALIFIER
|
|
LABEL
|
|
PsiElement(IDENTIFIER)('label3')
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
INTEGER_CONSTANT
|
|
PsiElement(INTEGER_LITERAL)('3')
|
|
PsiWhiteSpace(' ')
|
|
OPERATION_REFERENCE
|
|
PsiElement(PLUS)('+')
|
|
PsiWhiteSpace(' ')
|
|
INTEGER_CONSTANT
|
|
PsiElement(INTEGER_LITERAL)('4')
|
|
PsiWhiteSpace('\n\n ')
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('l1')
|
|
PsiWhiteSpace(' ')
|
|
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(IDENTIFIER)('foo')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(IDENTIFIER)('bar')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(IDENTIFIER)('l2')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(IDENTIFIER)('baz')
|
|
PsiWhiteSpace(' ')
|
|
PsiComment(EOL_COMMENT)('// binary expression with extra spaces')
|
|
PsiWhiteSpace('\n ')
|
|
BINARY_EXPRESSION
|
|
BINARY_EXPRESSION
|
|
BINARY_EXPRESSION
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('foo')
|
|
PsiWhiteSpace(' ')
|
|
OPERATION_REFERENCE
|
|
PsiElement(IDENTIFIER)('l3')
|
|
PsiWhiteSpace(' ')
|
|
ANNOTATED_EXPRESSION
|
|
PsiErrorElement:Expected annotation identifier after '@'
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('bar')
|
|
PsiWhiteSpace(' ')
|
|
OPERATION_REFERENCE
|
|
PsiElement(IDENTIFIER)('baz')
|
|
PsiWhiteSpace(' ')
|
|
PsiComment(EOL_COMMENT)('// binary expression with `@ bar` parsed as wrong label')
|
|
PsiWhiteSpace('\n\n ')
|
|
LABELED_EXPRESSION
|
|
LABEL_QUALIFIER
|
|
LABEL
|
|
PsiElement(IDENTIFIER)('foo')
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
REFERENCE_EXPRESSION
|
|
PsiElement(IDENTIFIER)('bar')
|
|
PsiWhiteSpace(' ')
|
|
OPERATION_REFERENCE
|
|
PsiElement(IDENTIFIER)('baz')
|
|
PsiWhiteSpace(' ')
|
|
PsiComment(EOL_COMMENT)('// binary expression labeled `bar` and return as second arg')
|
|
PsiWhiteSpace('\n\n ')
|
|
RETURN
|
|
PsiElement(return)('return')
|
|
PsiErrorElement:There should be no space or comments before '@' in label reference
|
|
<empty list>
|
|
PsiWhiteSpace(' ')
|
|
PsiErrorElement:Label must be named
|
|
PsiElement(AT)('@')
|
|
PsiWhiteSpace(' ')
|
|
INTEGER_CONSTANT
|
|
PsiElement(INTEGER_LITERAL)('1')
|
|
PsiWhiteSpace('\n')
|
|
PsiElement(RBRACE)('}')
|