Corrected parser: incomplete code should never cause brace disbalance
Fixed KT-7539 fq name inserted when completing nested traits name #KT-7539
This commit is contained in:
@@ -101,7 +101,7 @@ import static org.jetbrains.kotlin.lexer.JetTokens.*;
|
||||
|
||||
protected void errorWithRecovery(String message, TokenSet recoverySet) {
|
||||
IElementType tt = tt();
|
||||
if (recoverySet == null || recoverySet.contains(tt)
|
||||
if (recoverySet == null || recoverySet.contains(tt) || tt == LBRACE || tt == RBRACE
|
||||
|| (recoverySet.contains(EOL_OR_SEMICOLON)
|
||||
&& (eof() || tt == SEMICOLON || myBuilder.newlineBeforeCurrentToken()))) {
|
||||
error(message);
|
||||
@@ -258,6 +258,8 @@ import static org.jetbrains.kotlin.lexer.JetTokens.*;
|
||||
}
|
||||
|
||||
protected void errorUntil(String message, TokenSet tokenSet) {
|
||||
assert tokenSet.contains(LBRACE) : "Cannot include LBRACE into error element!";
|
||||
assert tokenSet.contains(RBRACE) : "Cannot include RBRACE into error element!";
|
||||
PsiBuilder.Marker error = mark();
|
||||
skipUntil(tokenSet);
|
||||
error.error(message);
|
||||
|
||||
@@ -137,7 +137,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
TokenSet.create(EOL_OR_SEMICOLON));
|
||||
|
||||
/*package*/ static final TokenSet EXPRESSION_FOLLOW = TokenSet.create(
|
||||
SEMICOLON, ARROW, COMMA, RBRACE, RPAR, RBRACKET
|
||||
SEMICOLON, ARROW, COMMA, LBRACE, RBRACE, RPAR, RBRACKET
|
||||
);
|
||||
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
@@ -887,7 +887,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
advance(); // ELSE_KEYWORD
|
||||
|
||||
if (!at(ARROW)) {
|
||||
errorUntil("Expecting '->'", TokenSet.create(ARROW,
|
||||
errorUntil("Expecting '->'", TokenSet.create(ARROW, LBRACE,
|
||||
RBRACE, EOL_OR_SEMICOLON));
|
||||
}
|
||||
|
||||
@@ -901,7 +901,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
parseExpressionPreferringBlocks();
|
||||
}
|
||||
}
|
||||
else if (!atSet(WHEN_CONDITION_RECOVERY_SET)) {
|
||||
else if (!atSet(WHEN_CONDITION_RECOVERY_SET) && !at(LBRACE)) {
|
||||
errorAndAdvance("Expecting '->'");
|
||||
}
|
||||
}
|
||||
@@ -1554,7 +1554,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
PsiBuilder.Marker catchBlock = mark();
|
||||
advance(); // CATCH_KEYWORD
|
||||
|
||||
TokenSet recoverySet = TokenSet.create(LBRACE, FINALLY_KEYWORD, CATCH_KEYWORD);
|
||||
TokenSet recoverySet = TokenSet.create(LBRACE, RBRACE, FINALLY_KEYWORD, CATCH_KEYWORD);
|
||||
if (atSet(recoverySet)) {
|
||||
error("Expecting exception variable declaration");
|
||||
}
|
||||
|
||||
@@ -396,6 +396,11 @@ public class JetParsing extends AbstractJetParsing {
|
||||
parseObject(NameParsingMode.REQUIRED, true);
|
||||
declType = OBJECT_DECLARATION;
|
||||
}
|
||||
else if (at(LBRACE)) {
|
||||
error("Expecting a top level declaration");
|
||||
parseBlock();
|
||||
declType = FUN;
|
||||
}
|
||||
|
||||
if (declType == null) {
|
||||
errorAndAdvance("Expecting a top level declaration");
|
||||
@@ -688,7 +693,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
beforeConstructorModifiers.drop();
|
||||
|
||||
if (at(LPAR)) {
|
||||
parseValueParameterList(false, /* typeRequired = */ true, TokenSet.create(LBRACE));
|
||||
parseValueParameterList(false, /* typeRequired = */ true, TokenSet.create(LBRACE, RBRACE));
|
||||
primaryConstructorMarker.done(PRIMARY_CONSTRUCTOR);
|
||||
}
|
||||
else if (hasConstructorModifiers) {
|
||||
@@ -929,7 +934,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
IElementType declType = parseMemberDeclarationRest(detector.isEnumDetected(), detector.isDefaultDetected());
|
||||
|
||||
if (declType == null) {
|
||||
errorWithRecovery("Expecting member declaration", TokenSet.create(RBRACE));
|
||||
errorWithRecovery("Expecting member declaration", TokenSet.EMPTY);
|
||||
decl.drop();
|
||||
}
|
||||
else {
|
||||
@@ -970,6 +975,11 @@ public class JetParsing extends AbstractJetParsing {
|
||||
parseSecondaryConstructor();
|
||||
declType = SECONDARY_CONSTRUCTOR;
|
||||
}
|
||||
else if (at(LBRACE)) {
|
||||
error("Expecting member declaration");
|
||||
parseBlock();
|
||||
declType = FUN;
|
||||
}
|
||||
return declType;
|
||||
}
|
||||
|
||||
@@ -1194,7 +1204,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
}
|
||||
if (!atSet(EOL_OR_SEMICOLON, RBRACE)) {
|
||||
if (getLastToken() != SEMICOLON) {
|
||||
errorUntil("Property getter or setter expected", TokenSet.create(EOL_OR_SEMICOLON));
|
||||
errorUntil("Property getter or setter expected", TokenSet.create(EOL_OR_SEMICOLON, LBRACE, RBRACE));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1308,7 +1318,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
setterParameter.done(VALUE_PARAMETER);
|
||||
parameterList.done(VALUE_PARAMETER_LIST);
|
||||
}
|
||||
if (!at(RPAR)) errorUntil("Expecting ')'", TokenSet.create(RPAR, COLON, LBRACE, EQ, EOL_OR_SEMICOLON));
|
||||
if (!at(RPAR)) errorUntil("Expecting ')'", TokenSet.create(RPAR, COLON, LBRACE, RBRACE, EQ, EOL_OR_SEMICOLON));
|
||||
expect(RPAR, "Expecting ')'", TokenSet.create(RPAR, COLON, LBRACE, EQ));
|
||||
myBuilder.restoreNewlinesState();
|
||||
|
||||
@@ -1348,7 +1358,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
|
||||
boolean typeParameterListOccurred = false;
|
||||
if (at(LT)) {
|
||||
parseTypeParameterList(TokenSet.create(LBRACKET, LBRACE, LPAR));
|
||||
parseTypeParameterList(TokenSet.create(LBRACKET, LBRACE, RBRACE, LPAR));
|
||||
typeParameterListOccurred = true;
|
||||
}
|
||||
|
||||
@@ -1362,7 +1372,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
|
||||
myBuilder.restoreJoiningComplexTokensState();
|
||||
|
||||
TokenSet valueParametersFollow = TokenSet.create(EQ, LBRACE, SEMICOLON, RPAR);
|
||||
TokenSet valueParametersFollow = TokenSet.create(EQ, LBRACE, RBRACE, SEMICOLON, RPAR);
|
||||
|
||||
if (at(LT)) {
|
||||
PsiBuilder.Marker error = mark();
|
||||
@@ -1473,11 +1483,12 @@ public class JetParsing extends AbstractJetParsing {
|
||||
private void parseFunctionOrPropertyName(boolean receiverFound, String title, TokenSet nameFollow, boolean nameRequired) {
|
||||
if (nameRequired && atSet(nameFollow)) return; // no name
|
||||
|
||||
TokenSet recoverySet = TokenSet.orSet(nameFollow, TokenSet.create(LBRACE, RBRACE));
|
||||
if (!receiverFound) {
|
||||
expect(IDENTIFIER, "Expecting " + title + " name or receiver type", nameFollow);
|
||||
expect(IDENTIFIER, "Expecting " + title + " name or receiver type", recoverySet);
|
||||
}
|
||||
else {
|
||||
expect(IDENTIFIER, "Expecting " + title + " name", nameFollow);
|
||||
expect(IDENTIFIER, "Expecting " + title + " name", recoverySet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1497,7 +1508,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
consumeIf(SEMICOLON);
|
||||
}
|
||||
else {
|
||||
errorAndAdvance("Expecting function body");
|
||||
error("Expecting function body");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1652,14 +1663,14 @@ public class JetParsing extends AbstractJetParsing {
|
||||
parseAnnotations(ONLY_ESCAPED_REGULAR_ANNOTATIONS);
|
||||
|
||||
PsiBuilder.Marker reference = mark();
|
||||
if (expect(IDENTIFIER, "Expecting type parameter name", TokenSet.orSet(TokenSet.create(COLON, COMMA), TYPE_REF_FIRST))) {
|
||||
if (expect(IDENTIFIER, "Expecting type parameter name", TokenSet.orSet(TokenSet.create(COLON, COMMA, LBRACE, RBRACE), TYPE_REF_FIRST))) {
|
||||
reference.done(REFERENCE_EXPRESSION);
|
||||
}
|
||||
else {
|
||||
reference.drop();
|
||||
}
|
||||
|
||||
expect(COLON, "Expecting ':' before the upper bound", TYPE_REF_FIRST);
|
||||
expect(COLON, "Expecting ':' before the upper bound", TokenSet.orSet(TokenSet.create(LBRACE, RBRACE), TYPE_REF_FIRST));
|
||||
|
||||
parseTypeRef();
|
||||
|
||||
@@ -1834,7 +1845,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
|
||||
if (at(PACKAGE_KEYWORD)) {
|
||||
advance(); // PACKAGE_KEYWORD
|
||||
expect(DOT, "Expecting '.'", TokenSet.create(IDENTIFIER));
|
||||
expect(DOT, "Expecting '.'", TokenSet.create(IDENTIFIER, LBRACE, RBRACE));
|
||||
}
|
||||
|
||||
PsiBuilder.Marker reference = mark();
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinFunctionStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersPackage;
|
||||
@@ -78,11 +77,10 @@ public class JetNamedFunction extends JetTypeParameterListOwnerStub<KotlinFuncti
|
||||
return getEqualsToken() == null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
@IfNotParsed // "function" with no "fun" keyword is created by parser for "{...}" on top-level or in class body
|
||||
public PsiElement getFunKeyword() {
|
||||
PsiElement element = findChildByType(JetTokens.FUN_KEYWORD);
|
||||
assert element != null : "'fun' must be present: " + PsiUtilPackage.getElementTextWithContext(this);
|
||||
return element;
|
||||
return findChildByType(JetTokens.FUN_KEYWORD);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
class A : (categoryName: <!SYNTAX!><!>) <!SYNTAX!>{<!SYNTAX!><!><!>
|
||||
class A : (categoryName: <!SYNTAX!><!>)<!SYNTAX!><!> <!SYNTAX!><!>{<!SYNTAX!><!>
|
||||
@@ -250,58 +250,63 @@ JetFile: DefaultKeyword.kt
|
||||
PsiWhiteSpace('\n')
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiErrorElement:Name expected
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
OBJECT_DECLARATION
|
||||
MODIFIER_LIST
|
||||
PsiElement(companion)('companion')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(public)('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(final)('final')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(object)('object')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiComment(EOL_COMMENT)('//should be error')
|
||||
PsiWhiteSpace('\n')
|
||||
<empty list>
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
OBJECT_DECLARATION
|
||||
MODIFIER_LIST
|
||||
PsiElement(companion)('companion')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiErrorElement:Name expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PROPERTY
|
||||
PsiComment(EOL_COMMENT)('//should be error')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('t')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('companion')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
PsiElement(object)('object')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(public)('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(final)('final')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(object)('object')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiComment(EOL_COMMENT)('//should be error')
|
||||
PsiWhiteSpace('\n')
|
||||
MODIFIER_LIST
|
||||
PsiElement(companion)('companion')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiErrorElement:Name expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PROPERTY
|
||||
PsiComment(EOL_COMMENT)('//should be error')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('t')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('companion')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
PsiElement(object)('object')
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
|
||||
@@ -504,12 +504,9 @@ JetFile: FunctionLiterals_ERR.kt
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER
|
||||
PsiErrorElement:Expecting parameter name
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiErrorElement:Expecting '->' or ','
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
<empty list>
|
||||
BLOCK
|
||||
<empty list>
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiErrorElement:Expecting '}'
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -43,11 +43,13 @@ JetFile: ParameterType_ERR.kt
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
@@ -74,10 +76,12 @@ JetFile: ParameterType_ERR.kt
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
@@ -259,7 +259,11 @@ JetFile: PropertiesFollowedByInitializers.kt
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(abstract)('abstract')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiErrorElement:Expecting member declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
|
||||
@@ -6,8 +6,13 @@ JetFile: Properties_ERR.kt
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting property name or receiver type
|
||||
PsiElement(MINUS)('-')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
@@ -15,8 +20,13 @@ JetFile: Properties_ERR.kt
|
||||
PsiElement(var)('var')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
@@ -159,10 +169,12 @@ JetFile: Properties_ERR.kt
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LPAR)('(')
|
||||
@@ -209,6 +221,8 @@ JetFile: Properties_ERR.kt
|
||||
PsiElement(get)('get')
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting function body
|
||||
PsiElement(MINUS)('-')
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
PsiElement(MINUS)('-')
|
||||
@@ -18,114 +18,116 @@ JetFile: RootPackage.kt
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
ROOT_PACKAGE
|
||||
PsiElement(package)('package')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
PsiWhiteSpace('\n ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
ROOT_PACKAGE
|
||||
PsiElement(package)('package')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN
|
||||
PsiElement(when)('when')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LPAR)('(')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('e')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_IS_PATTERN
|
||||
PsiElement(is)('is')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
PsiElement(package)('package')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
ROOT_PACKAGE
|
||||
PsiElement(package)('package')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
PsiWhiteSpace('\n ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
ROOT_PACKAGE
|
||||
PsiElement(package)('package')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN
|
||||
PsiElement(when)('when')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LPAR)('(')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('e')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_IS_PATTERN
|
||||
PsiElement(is)('is')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
PsiElement(package)('package')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Y')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
PsiElement(package)('package')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Y')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
+49
-47
@@ -534,67 +534,69 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('t')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiComment(EOL_COMMENT)('//-----------')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiErrorElement:Expecting type name
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('t')
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiComment(EOL_COMMENT)('//-----------')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiErrorElement:Expecting type name
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('Y')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('Y')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
@@ -443,21 +443,23 @@ JetFile: PropertiesWithFunctionReceivers.kt
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('dfget')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('dfget')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
@@ -518,18 +520,20 @@ JetFile: PropertiesWithFunctionReceivers.kt
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('set')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('set')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
+11
-2
@@ -29,7 +29,11 @@ JetFile: PropertiesWithFunctionReceiversRecovery.kt
|
||||
PsiElement(LT)('<')
|
||||
PsiElement(IDENTIFIER)('P')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -258,8 +262,13 @@ JetFile: PropertiesWithFunctionReceiversRecovery.kt
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(DOT)('.')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
|
||||
@@ -14,24 +14,26 @@ JetFile: functionTypes.kt
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('n')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('n')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('B')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('B')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
|
||||
@@ -32,6 +32,5 @@ JetFile: namelessObjectAsEnumMember.kt
|
||||
PsiWhiteSpace('\n')
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiErrorElement:Name expected
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiErrorElement:Expecting '}' to close enum class body
|
||||
<empty list>
|
||||
<empty list>
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -5,32 +5,34 @@ JetFile: PackageBlockFirst.kt
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foobar')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foobar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foobar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -69,7 +69,9 @@ JetFile: WrongWordInParentheses.kt
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,8 @@
|
||||
fun foo() {
|
||||
try{
|
||||
|
||||
}
|
||||
catch
|
||||
}
|
||||
|
||||
fun bar(){}
|
||||
@@ -0,0 +1,38 @@
|
||||
JetFile: CatchKeywordRBrace.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
TRY
|
||||
PsiElement(try)('try')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
CATCH
|
||||
PsiElement(catch)('catch')
|
||||
PsiErrorElement:Expecting exception variable declaration
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,5 @@
|
||||
}
|
||||
|
||||
class C
|
||||
|
||||
fun bar(){}
|
||||
@@ -0,0 +1,21 @@
|
||||
JetFile: CloseBraceAtTopLevel.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('C')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo() {
|
||||
if
|
||||
}
|
||||
|
||||
fun bar(){}
|
||||
@@ -0,0 +1,34 @@
|
||||
JetFile: IfKeywordRBrace.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
IF
|
||||
PsiElement(if)('if')
|
||||
PsiErrorElement:Expecting a condition in parentheses '(...)'
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
THEN
|
||||
PsiErrorElement:Expecting an expression
|
||||
<empty list>
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
val v: Int get(
|
||||
}
|
||||
|
||||
class D
|
||||
@@ -0,0 +1,36 @@
|
||||
JetFile: IncompleteAccessor1.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('C')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('v')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiWhiteSpace(' ')
|
||||
PROPERTY_ACCESSOR
|
||||
PsiElement(get)('get')
|
||||
PsiElement(LPAR)('(')
|
||||
PsiErrorElement:Expecting ')'
|
||||
<empty list>
|
||||
PsiErrorElement:Expecting ')'
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('D')
|
||||
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
val v: Int get()
|
||||
}
|
||||
|
||||
class D
|
||||
@@ -0,0 +1,35 @@
|
||||
JetFile: IncompleteAccessor2.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('C')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('v')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiWhiteSpace(' ')
|
||||
PROPERTY_ACCESSOR
|
||||
PsiElement(get)('get')
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiErrorElement:Expecting function body
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('D')
|
||||
@@ -0,0 +1,5 @@
|
||||
class Outer {
|
||||
class Inner(
|
||||
}
|
||||
|
||||
class Next
|
||||
@@ -0,0 +1,27 @@
|
||||
JetFile: IncompleteClassDeclaration.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Outer')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Inner')
|
||||
PRIMARY_CONSTRUCTOR
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiErrorElement:Expecting ')'
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Next')
|
||||
@@ -0,0 +1,5 @@
|
||||
class Outer {
|
||||
class Inner<T
|
||||
}
|
||||
|
||||
class Next
|
||||
@@ -0,0 +1,28 @@
|
||||
JetFile: IncompleteClassTypeParameters.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Outer')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Inner')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiErrorElement:Missing '>'
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Next')
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo() {
|
||||
for(
|
||||
}
|
||||
|
||||
fun bar(){}
|
||||
@@ -0,0 +1,35 @@
|
||||
JetFile: IncompleteForRBrace.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FOR
|
||||
PsiElement(for)('for')
|
||||
PsiElement(LPAR)('(')
|
||||
PsiWhiteSpace('\n')
|
||||
VALUE_PARAMETER
|
||||
PsiErrorElement:Expecting a variable name
|
||||
<empty list>
|
||||
BODY
|
||||
<empty list>
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,5 @@
|
||||
fun {
|
||||
x()
|
||||
}
|
||||
|
||||
fun bar(){}
|
||||
@@ -0,0 +1,30 @@
|
||||
JetFile: IncompleteFun.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiErrorElement:Expecting function name or receiver type
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,5 @@
|
||||
class Outer {
|
||||
fun foo(
|
||||
}
|
||||
|
||||
class Next
|
||||
@@ -0,0 +1,26 @@
|
||||
JetFile: IncompleteFunDeclaration.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Outer')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiErrorElement:Expecting ')'
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Next')
|
||||
@@ -0,0 +1,5 @@
|
||||
class Outer {
|
||||
fun <T
|
||||
}
|
||||
|
||||
class Next
|
||||
@@ -0,0 +1,27 @@
|
||||
JetFile: IncompleteFunTypeParameters.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Outer')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiErrorElement:Missing '>'
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Next')
|
||||
@@ -0,0 +1,5 @@
|
||||
class Outer {
|
||||
fun <in
|
||||
}
|
||||
|
||||
class Next
|
||||
@@ -0,0 +1,28 @@
|
||||
JetFile: IncompleteTypeParameters.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Outer')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
PsiElement(in)('in')
|
||||
PsiErrorElement:Type parameter name expected
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Next')
|
||||
@@ -0,0 +1,8 @@
|
||||
fun foo() {
|
||||
val v: package
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
JetFile: IncompleteTypeRefWithPackageKeyword.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('v')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
PsiElement(package)('package')
|
||||
PsiErrorElement:Expecting '.'
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
val <T
|
||||
}
|
||||
|
||||
class D
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
JetFile: IncompleteValTypeParameters.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('C')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiErrorElement:Missing '>'
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('D')
|
||||
@@ -0,0 +1,9 @@
|
||||
class C {
|
||||
fun foo() {
|
||||
when {
|
||||
1 -> foo()
|
||||
else { doIt() }
|
||||
}
|
||||
|
||||
fun bar(){}
|
||||
}}
|
||||
@@ -0,0 +1,79 @@
|
||||
JetFile: IncompleteWhenElse.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('C')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN
|
||||
PsiElement(when)('when')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_WITH_EXPRESSION
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
PsiElement(else)('else')
|
||||
PsiErrorElement:Expecting '->'
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_WITH_EXPRESSION
|
||||
FUNCTION_LITERAL_EXPRESSION
|
||||
FUNCTION_LITERAL
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('doIt')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiErrorElement:Expecting '->'
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,5 @@
|
||||
class Outer {
|
||||
class Inner<T> where
|
||||
}
|
||||
|
||||
class Next
|
||||
@@ -0,0 +1,35 @@
|
||||
JetFile: IncompleteWhere.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Outer')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Inner')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(where)('where')
|
||||
PsiWhiteSpace('\n')
|
||||
TYPE_CONSTRAINT_LIST
|
||||
TYPE_CONSTRAINT
|
||||
PsiErrorElement:Expecting type parameter name
|
||||
<empty list>
|
||||
TYPE_REFERENCE
|
||||
<empty list>
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Next')
|
||||
@@ -0,0 +1,5 @@
|
||||
class Outer {
|
||||
class Inner<T> where T
|
||||
}
|
||||
|
||||
class Next
|
||||
@@ -0,0 +1,39 @@
|
||||
JetFile: IncompleteWhere2.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Outer')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Inner')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(where)('where')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_CONSTRAINT_LIST
|
||||
TYPE_CONSTRAINT
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiErrorElement:Expecting ':' before the upper bound
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
TYPE_REFERENCE
|
||||
PsiErrorElement:Type expected
|
||||
<empty list>
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Next')
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
val prop: XX$<caret> = run {
|
||||
|
||||
}
|
||||
|
||||
interface I
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
JetFile: InvalidCharAfterPropertyName.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('C')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('prop')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('XX')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
PsiElement(BAD_CHARACTER)('$')
|
||||
PsiElement(LT)('<')
|
||||
PsiElement(IDENTIFIER)('caret')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('run')
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiErrorElement:Expecting member declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
CLASS
|
||||
PsiElement(interface)('interface')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('I')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -1620,6 +1620,18 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest {
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("CatchKeywordRBrace.kt")
|
||||
public void testCatchKeywordRBrace() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/CatchKeywordRBrace.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("CloseBraceAtTopLevel.kt")
|
||||
public void testCloseBraceAtTopLevel() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/CloseBraceAtTopLevel.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("DoWhileWithEmptyCondition.kt")
|
||||
public void testDoWhileWithEmptyCondition() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/DoWhileWithEmptyCondition.kt");
|
||||
@@ -1698,6 +1710,12 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest {
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IfKeywordRBrace.kt")
|
||||
public void testIfKeywordRBrace() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IfKeywordRBrace.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IfWithEmptyCondition.kt")
|
||||
public void testIfWithEmptyCondition() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IfWithEmptyCondition.kt");
|
||||
@@ -1716,12 +1734,102 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest {
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteAccessor1.kt")
|
||||
public void testIncompleteAccessor1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteAccessor1.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteAccessor2.kt")
|
||||
public void testIncompleteAccessor2() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteAccessor2.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteClassDeclaration.kt")
|
||||
public void testIncompleteClassDeclaration() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteClassDeclaration.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteClassTypeParameters.kt")
|
||||
public void testIncompleteClassTypeParameters() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteClassTypeParameters.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteForRBrace.kt")
|
||||
public void testIncompleteForRBrace() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteForRBrace.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteFun.kt")
|
||||
public void testIncompleteFun() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteFun.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteFunDeclaration.kt")
|
||||
public void testIncompleteFunDeclaration() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteFunDeclaration.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteFunTypeParameters.kt")
|
||||
public void testIncompleteFunTypeParameters() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteFunTypeParameters.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteTypeParameters.kt")
|
||||
public void testIncompleteTypeParameters() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteTypeParameters.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteTypeRefWithPackageKeyword.kt")
|
||||
public void testIncompleteTypeRefWithPackageKeyword() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteTypeRefWithPackageKeyword.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteValTypeParameters.kt")
|
||||
public void testIncompleteValTypeParameters() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteValTypeParameters.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteWhenElse.kt")
|
||||
public void testIncompleteWhenElse() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteWhenElse.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteWhere.kt")
|
||||
public void testIncompleteWhere() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteWhere.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("IncompleteWhere2.kt")
|
||||
public void testIncompleteWhere2() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/IncompleteWhere2.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("initRecovery.kt")
|
||||
public void testInitRecovery() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/initRecovery.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InvalidCharAfterPropertyName.kt")
|
||||
public void testInvalidCharAfterPropertyName() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/InvalidCharAfterPropertyName.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InvalidCharInSingleLineLambda.kt")
|
||||
public void testInvalidCharInSingleLineLambda() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/InvalidCharInSingleLineLambda.kt");
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package a.b.c.d
|
||||
|
||||
class B {
|
||||
public val mark: M<caret> = run {
|
||||
|
||||
}
|
||||
|
||||
interface Mark {
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: { itemText: "Mark", tailText: " (a.b.c.d.B)" }
|
||||
@@ -0,0 +1,12 @@
|
||||
package a.b.c.d
|
||||
|
||||
class B {
|
||||
public val mark: M<caret> = run {
|
||||
|
||||
}
|
||||
|
||||
interface Mark {
|
||||
}
|
||||
}
|
||||
|
||||
// ELEMENT: Mark
|
||||
@@ -0,0 +1,12 @@
|
||||
package a.b.c.d
|
||||
|
||||
class B {
|
||||
public val mark: Mark<caret> = run {
|
||||
|
||||
}
|
||||
|
||||
interface Mark {
|
||||
}
|
||||
}
|
||||
|
||||
// ELEMENT: Mark
|
||||
+6
@@ -643,6 +643,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InterfaceNameBeforeRunBug.kt")
|
||||
public void testInterfaceNameBeforeRunBug() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/InterfaceNameBeforeRunBug.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("JavaPackage.kt")
|
||||
public void testJavaPackage() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/JavaPackage.kt");
|
||||
|
||||
+6
@@ -643,6 +643,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InterfaceNameBeforeRunBug.kt")
|
||||
public void testInterfaceNameBeforeRunBug() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/InterfaceNameBeforeRunBug.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("JavaPackage.kt")
|
||||
public void testJavaPackage() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/JavaPackage.kt");
|
||||
|
||||
+6
@@ -95,6 +95,12 @@ public class BasicCompletionHandlerTestGenerated extends AbstractBasicCompletion
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InterfaceNameBeforeRunBug.kt")
|
||||
public void testInterfaceNameBeforeRunBug() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/handlers/basic/InterfaceNameBeforeRunBug.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NestedTypeArg.kt")
|
||||
public void testNestedTypeArg() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/handlers/basic/NestedTypeArg.kt");
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.codeInsight.intention.HighPriorityAction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiModifier
|
||||
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken
|
||||
import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
@@ -79,7 +78,7 @@ public open class ChangeVisibilityModifierIntention protected(
|
||||
private fun canAddVisibilityModifier(declaration: JetDeclaration): TextRange? {
|
||||
if (JetPsiUtil.isLocal(declaration)) return null
|
||||
return when (declaration) {
|
||||
is JetNamedFunction -> declaration.getFunKeyword().getTextRange()
|
||||
is JetNamedFunction -> declaration.getFunKeyword()?.getTextRange()
|
||||
is JetProperty -> declaration.getValOrVarNode().getTextRange()
|
||||
is JetClass -> declaration.getClassOrTraitKeyword()?.getTextRange()
|
||||
is JetObjectDeclaration -> declaration.getObjectKeyword().getTextRange()
|
||||
|
||||
+29
-39
@@ -16,50 +16,40 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.intentions
|
||||
|
||||
import org.jetbrains.kotlin.psi.JetNamedFunction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.idea.refactoring.CallableRefactoring
|
||||
import org.jetbrains.kotlin.idea.refactoring.getAffectedCallables
|
||||
import com.intellij.util.containers.MultiMap
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.DefaultSearchHelper
|
||||
import com.intellij.psi.PsiNamedElement
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.UsagesSearchTarget
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.search
|
||||
import org.jetbrains.kotlin.idea.references.JetSimpleNameReference
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getParentOfTypeAndBranch
|
||||
import org.jetbrains.kotlin.psi.JetCallElement
|
||||
import java.util.ArrayList
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import org.jetbrains.kotlin.psi.JetPsiFactory
|
||||
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
||||
import com.intellij.psi.PsiMethod
|
||||
import org.jetbrains.kotlin.codegen.PropertyCodegen
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiWhiteSpace
|
||||
import org.jetbrains.kotlin.psi.psiUtil.siblings
|
||||
import com.intellij.psi.PsiReference
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isAncestor
|
||||
import org.jetbrains.kotlin.psi.JetElement
|
||||
import org.jetbrains.kotlin.psi.UserDataProperty
|
||||
import com.intellij.openapi.util.Key
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor
|
||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.idea.util.supertypes
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
||||
import org.jetbrains.kotlin.psi.JetProperty
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.util.containers.MultiMap
|
||||
import org.jetbrains.kotlin.asJava.namedUnwrappedElement
|
||||
import org.jetbrains.kotlin.idea.refactoring.getContainingScope
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.codegen.PropertyCodegen
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
||||
import org.jetbrains.kotlin.idea.core.refactoring.checkConflictsInteractively
|
||||
import org.jetbrains.kotlin.idea.core.refactoring.reportDeclarationConflict
|
||||
import org.jetbrains.kotlin.idea.refactoring.CallableRefactoring
|
||||
import org.jetbrains.kotlin.idea.refactoring.getAffectedCallables
|
||||
import org.jetbrains.kotlin.idea.refactoring.getContainingScope
|
||||
import org.jetbrains.kotlin.idea.references.JetSimpleNameReference
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.DefaultSearchHelper
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.UsagesSearchTarget
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.search
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
||||
import org.jetbrains.kotlin.idea.util.ShortenReferences
|
||||
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
||||
import org.jetbrains.kotlin.idea.util.supertypes
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getParentOfTypeAndBranch
|
||||
import org.jetbrains.kotlin.psi.psiUtil.siblings
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||
import java.util.ArrayList
|
||||
|
||||
public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention<JetNamedFunction>(javaClass(), "Convert function to property") {
|
||||
private var JetNamedFunction.typeFqNameToAdd: String? by UserDataProperty(Key.create("TYPE_FQ_NAME_TO_ADD"))
|
||||
@@ -71,7 +61,7 @@ public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention<JetN
|
||||
): CallableRefactoring<FunctionDescriptor>(project, descriptor, context, getText()) {
|
||||
private val elementsToShorten = ArrayList<JetElement>()
|
||||
|
||||
private fun convertJetFunction(originalFunction: JetNamedFunction, psiFactory: JetPsiFactory) {
|
||||
private fun convertFunction(originalFunction: JetNamedFunction, psiFactory: JetPsiFactory) {
|
||||
val function = originalFunction.copy() as JetNamedFunction
|
||||
|
||||
val propertySample = psiFactory.createProperty("val foo: Int get() = 1")
|
||||
@@ -81,7 +71,7 @@ public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention<JetN
|
||||
originalFunction.typeFqNameToAdd?.let { function.setTypeReference(psiFactory.createType(it)) }
|
||||
}
|
||||
|
||||
function.getFunKeyword().replace(propertySample.getValOrVarNode().getPsi())
|
||||
function.getFunKeyword()!!.replace(propertySample.getValOrVarNode().getPsi())
|
||||
function.getValueParameterList()?.delete()
|
||||
val insertAfter = (function.getEqualsToken() ?: function.getBodyExpression())
|
||||
?.siblings(forward = false, withItself = false)
|
||||
@@ -172,7 +162,7 @@ public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention<JetN
|
||||
|
||||
callables.forEach {
|
||||
when (it) {
|
||||
is JetNamedFunction -> convertJetFunction(it, psiFactory)
|
||||
is JetNamedFunction -> convertFunction(it, psiFactory)
|
||||
is PsiMethod -> it.setName(getterName)
|
||||
}
|
||||
}
|
||||
|
||||
+23
-32
@@ -17,42 +17,33 @@
|
||||
package org.jetbrains.kotlin.idea.intentions
|
||||
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.idea.refactoring.CallableRefactoring
|
||||
import com.intellij.psi.PsiWhiteSpace
|
||||
import org.jetbrains.kotlin.psi.psiUtil.siblings
|
||||
import com.intellij.util.containers.MultiMap
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.idea.refactoring.getAffectedCallables
|
||||
import java.util.ArrayList
|
||||
import com.intellij.psi.PsiReference
|
||||
import com.intellij.psi.PsiNamedElement
|
||||
import com.intellij.refactoring.util.RefactoringUIUtil
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.DefaultSearchHelper
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.UsagesSearchTarget
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.search
|
||||
import org.jetbrains.kotlin.idea.references.JetSimpleNameReference
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getCall
|
||||
import org.jetbrains.kotlin.idea.references.JetReference
|
||||
import com.intellij.psi.PsiMethod
|
||||
import com.intellij.psi.PsiField
|
||||
import com.intellij.psi.PsiReferenceExpression
|
||||
import com.intellij.psi.PsiElementFactory
|
||||
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import com.intellij.psi.PsiJavaReference
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isAncestor
|
||||
import org.jetbrains.kotlin.codegen.PropertyCodegen
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.refactoring.util.RefactoringUIUtil
|
||||
import com.intellij.util.containers.MultiMap
|
||||
import org.jetbrains.kotlin.asJava.namedUnwrappedElement
|
||||
import org.jetbrains.kotlin.idea.refactoring.getContainingScope
|
||||
import org.jetbrains.kotlin.codegen.PropertyCodegen
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
||||
import org.jetbrains.kotlin.idea.core.refactoring.checkConflictsInteractively
|
||||
import org.jetbrains.kotlin.idea.core.refactoring.reportDeclarationConflict
|
||||
import org.jetbrains.kotlin.idea.refactoring.CallableRefactoring
|
||||
import org.jetbrains.kotlin.idea.refactoring.getAffectedCallables
|
||||
import org.jetbrains.kotlin.idea.refactoring.getContainingScope
|
||||
import org.jetbrains.kotlin.idea.references.JetReference
|
||||
import org.jetbrains.kotlin.idea.references.JetSimpleNameReference
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.DefaultSearchHelper
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.UsagesSearchTarget
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.search
|
||||
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.siblings
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getCall
|
||||
import java.util.ArrayList
|
||||
|
||||
public class ConvertPropertyToFunctionIntention : JetSelfTargetingIntention<JetProperty>(javaClass(), "Convert property to function") {
|
||||
private inner class Converter(
|
||||
@@ -61,13 +52,13 @@ public class ConvertPropertyToFunctionIntention : JetSelfTargetingIntention<JetP
|
||||
context: BindingContext
|
||||
): CallableRefactoring<CallableDescriptor>(project, descriptor, context, getText()) {
|
||||
|
||||
private fun convertJetProperty(originalProperty: JetProperty, psiFactory: JetPsiFactory) {
|
||||
private fun convertProperty(originalProperty: JetProperty, psiFactory: JetPsiFactory) {
|
||||
val property = originalProperty.copy() as JetProperty;
|
||||
val getter = property.getGetter();
|
||||
|
||||
val sampleFunction = psiFactory.createFunction("fun foo() {\n\n}");
|
||||
|
||||
property.getValOrVarNode().getPsi().replace(sampleFunction.getFunKeyword());
|
||||
property.getValOrVarNode().getPsi().replace(sampleFunction.getFunKeyword()!!);
|
||||
property.addAfter(psiFactory.createParameterList("()"), property.getNameIdentifier());
|
||||
if (property.getInitializer() == null) {
|
||||
if (getter != null) {
|
||||
@@ -164,7 +155,7 @@ public class ConvertPropertyToFunctionIntention : JetSelfTargetingIntention<JetP
|
||||
|
||||
callables.forEach {
|
||||
when (it) {
|
||||
is JetProperty -> convertJetProperty(it, kotlinPsiFactory)
|
||||
is JetProperty -> convertProperty(it, kotlinPsiFactory)
|
||||
is PsiMethod -> it.setName(propertyName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun main(args: Array<String>) {
|
||||
String.class
|
||||
<error descr="Name expected">}</error><EOLError descr="Expecting '}'"></EOLError>
|
||||
String.class<EOLError descr="Name expected"></EOLError>
|
||||
}
|
||||
|
||||
// EA-56152: An attempt to build light class in checker to get diagnotics
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Add function body" "true"
|
||||
package a {
|
||||
fun <caret>foo() {
|
||||
}
|
||||
fun foo() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user