From 19e4127f4f5e9d8c694f5715c7a6d82732a6a65c Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Fri, 29 May 2015 14:05:33 +0300 Subject: [PATCH] Do not wrap primary ctor of object into ErrorElement It helps to resolve them as for classes Diagnostic with same content will be reported instead --- .../jetbrains/kotlin/parsing/JetParsing.java | 3 - .../declarations/ConstructorModifiers.txt | 104 +++++++------- .../objects/declarations/EmptyParentheses.txt | 27 ++-- .../objects/declarations/Everything.txt | 49 ++++--- .../declarations/ParametersInParentheses.txt | 129 +++++++++--------- .../TypeParametersAndParentheses.txt | 43 +++--- .../recovery/objects/declarations/Where.txt | 27 ++-- .../expressions/ConstructorModifiers.txt | 86 ++++++------ .../ConstructorModifiersAndName.txt | 104 +++++++------- .../objects/expressions/EmptyParentheses.txt | 27 ++-- .../objects/expressions/Everything.txt | 49 ++++--- .../objects/expressions/InFunction.txt | 86 ++++++------ .../expressions/ParametersInParentheses.txt | 129 +++++++++--------- .../TypeParametersAndParentheses.txt | 43 +++--- .../objects/expressions/TypeParameterss.txt | 43 +++--- .../recovery/objects/expressions/Where.txt | 27 ++-- 16 files changed, 465 insertions(+), 511 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java index efa7c34f509..2b851f64d5a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java @@ -754,7 +754,6 @@ public class JetParsing extends AbstractJetParsing { boolean typeParametersDeclared = parseTypeParameterList(TYPE_PARAMETER_GT_RECOVERY_SET); typeParamsMarker.error("Type parameters are not allowed for objects"); - OptionalMarker constructorModifiersMarker = new OptionalMarker(object); PsiBuilder.Marker beforeConstructorModifiers = mark(); PsiBuilder.Marker primaryConstructorMarker = mark(); boolean hasConstructorModifiers = parseModifierList( @@ -764,7 +763,6 @@ public class JetParsing extends AbstractJetParsing { // Some modifiers found, but no parentheses following: class has already ended, and we are looking at something else if ((object && at(CONSTRUCTOR_KEYWORD)) || (hasConstructorModifiers && !atSet(LPAR, LBRACE, COLON, CONSTRUCTOR_KEYWORD))) { beforeConstructorModifiers.rollbackTo(); - constructorModifiersMarker.drop(); return object ? OBJECT_DECLARATION : CLASS; } @@ -796,7 +794,6 @@ public class JetParsing extends AbstractJetParsing { else { primaryConstructorMarker.drop(); } - constructorModifiersMarker.error("Constructors are not allowed for objects"); if (at(COLON)) { advance(); // COLON diff --git a/compiler/testData/psi/recovery/objects/declarations/ConstructorModifiers.txt b/compiler/testData/psi/recovery/objects/declarations/ConstructorModifiers.txt index cd00be79eab..819560a3dd2 100644 --- a/compiler/testData/psi/recovery/objects/declarations/ConstructorModifiers.txt +++ b/compiler/testData/psi/recovery/objects/declarations/ConstructorModifiers.txt @@ -7,14 +7,13 @@ JetFile: ConstructorModifiers.kt OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - PsiElement(private)('private') - PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + PsiElement(private)('private') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') OBJECT_DECLARATION PsiElement(object)('object') @@ -22,14 +21,13 @@ JetFile: ConstructorModifiers.kt OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - PsiElement(private)('private') - PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + PsiElement(private)('private') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -41,14 +39,13 @@ JetFile: ConstructorModifiers.kt OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - PsiElement(private)('private') - PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + PsiElement(private)('private') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') @@ -70,34 +67,33 @@ JetFile: ConstructorModifiers.kt OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - PsiElement(private)('private') - PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACKET)(']') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') \ No newline at end of file + PsiElement(private)('private') + PsiWhiteSpace(' ') + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/recovery/objects/declarations/EmptyParentheses.txt b/compiler/testData/psi/recovery/objects/declarations/EmptyParentheses.txt index 7d4e4e968dd..7737b2dc0c1 100644 --- a/compiler/testData/psi/recovery/objects/declarations/EmptyParentheses.txt +++ b/compiler/testData/psi/recovery/objects/declarations/EmptyParentheses.txt @@ -6,22 +6,20 @@ JetFile: EmptyParentheses.kt PsiWhiteSpace(' ') OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') OBJECT_DECLARATION PsiElement(object)('object') PsiWhiteSpace(' ') OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -32,11 +30,10 @@ JetFile: EmptyParentheses.kt PsiWhiteSpace(' ') OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/recovery/objects/declarations/Everything.txt b/compiler/testData/psi/recovery/objects/declarations/Everything.txt index 5e25cea150e..266a5282937 100644 --- a/compiler/testData/psi/recovery/objects/declarations/Everything.txt +++ b/compiler/testData/psi/recovery/objects/declarations/Everything.txt @@ -17,32 +17,31 @@ JetFile: Everything.kt PsiElement(IDENTIFIER)('R') PsiElement(GT)('>') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - PsiElement(private)('private') - PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('x') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(COMMA)(',') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + PsiElement(private)('private') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('x') + PsiElement(COLON)(':') PsiWhiteSpace(' ') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('y') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(RPAR)(')') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('y') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/recovery/objects/declarations/ParametersInParentheses.txt b/compiler/testData/psi/recovery/objects/declarations/ParametersInParentheses.txt index 35311124f43..7fcc07d2c45 100644 --- a/compiler/testData/psi/recovery/objects/declarations/ParametersInParentheses.txt +++ b/compiler/testData/psi/recovery/objects/declarations/ParametersInParentheses.txt @@ -6,58 +6,56 @@ JetFile: ParametersInParentheses.kt PsiWhiteSpace(' ') OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('a') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(COMMA)(',') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') PsiWhiteSpace(' ') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('b') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('String') - PsiElement(RPAR)(')') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('b') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') OBJECT_DECLARATION PsiElement(object)('object') PsiWhiteSpace(' ') OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('a') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(COMMA)(',') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') PsiWhiteSpace(' ') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('b') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('String') - PsiElement(RPAR)(')') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('b') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -68,29 +66,28 @@ JetFile: ParametersInParentheses.kt PsiWhiteSpace(' ') OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('a') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(COMMA)(',') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') PsiWhiteSpace(' ') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('b') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('String') - PsiElement(RPAR)(')') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('b') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/recovery/objects/declarations/TypeParametersAndParentheses.txt b/compiler/testData/psi/recovery/objects/declarations/TypeParametersAndParentheses.txt index 41c02129de2..6351ad347bc 100644 --- a/compiler/testData/psi/recovery/objects/declarations/TypeParametersAndParentheses.txt +++ b/compiler/testData/psi/recovery/objects/declarations/TypeParametersAndParentheses.txt @@ -16,11 +16,10 @@ JetFile: TypeParametersAndParentheses.kt TYPE_PARAMETER PsiElement(IDENTIFIER)('R') PsiElement(GT)('>') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') OBJECT_DECLARATION PsiElement(object)('object') @@ -37,19 +36,18 @@ JetFile: TypeParametersAndParentheses.kt TYPE_PARAMETER PsiElement(IDENTIFIER)('R') PsiElement(GT)('>') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('x') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('x') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -70,11 +68,10 @@ JetFile: TypeParametersAndParentheses.kt TYPE_PARAMETER PsiElement(IDENTIFIER)('R') PsiElement(GT)('>') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/recovery/objects/declarations/Where.txt b/compiler/testData/psi/recovery/objects/declarations/Where.txt index 2f465e7471c..2f4e2f049df 100644 --- a/compiler/testData/psi/recovery/objects/declarations/Where.txt +++ b/compiler/testData/psi/recovery/objects/declarations/Where.txt @@ -59,11 +59,10 @@ JetFile: Where.kt PsiWhiteSpace(' ') OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiErrorElement:Where clause is not allowed for objects PsiErrorElement:Type constraints are not allowed when no type parameters declared @@ -86,11 +85,10 @@ JetFile: Where.kt PsiWhiteSpace(' ') OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') @@ -122,11 +120,10 @@ JetFile: Where.kt PsiWhiteSpace(' ') OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('Foo') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/recovery/objects/expressions/ConstructorModifiers.txt b/compiler/testData/psi/recovery/objects/expressions/ConstructorModifiers.txt index a39fe6f500c..8bbe2f18720 100644 --- a/compiler/testData/psi/recovery/objects/expressions/ConstructorModifiers.txt +++ b/compiler/testData/psi/recovery/objects/expressions/ConstructorModifiers.txt @@ -15,11 +15,10 @@ JetFile: ConstructorModifiers.kt PsiErrorElement:An object expression cannot bind a name PsiElement(IDENTIFIER)('private') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -39,11 +38,10 @@ JetFile: ConstructorModifiers.kt PsiErrorElement:An object expression cannot bind a name PsiElement(IDENTIFIER)('private') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') @@ -70,37 +68,36 @@ JetFile: ConstructorModifiers.kt OBJECT_DECLARATION PsiElement(object)('object') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - PsiElement(private)('private') - PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACKET)(']') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PsiElement(private)('private') + PsiWhiteSpace(' ') + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -120,11 +117,10 @@ JetFile: ConstructorModifiers.kt PsiErrorElement:An object expression cannot bind a name PsiElement(IDENTIFIER)('private') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') CLASS_BODY PsiErrorElement:Expecting a class body \ No newline at end of file diff --git a/compiler/testData/psi/recovery/objects/expressions/ConstructorModifiersAndName.txt b/compiler/testData/psi/recovery/objects/expressions/ConstructorModifiersAndName.txt index 2a85d318791..295fa8a53c9 100644 --- a/compiler/testData/psi/recovery/objects/expressions/ConstructorModifiersAndName.txt +++ b/compiler/testData/psi/recovery/objects/expressions/ConstructorModifiersAndName.txt @@ -15,14 +15,13 @@ JetFile: ConstructorModifiersAndName.kt PsiErrorElement:An object expression cannot bind a name PsiElement(IDENTIFIER)('Name') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - PsiElement(private)('private') - PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + PsiElement(private)('private') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -42,14 +41,13 @@ JetFile: ConstructorModifiersAndName.kt PsiErrorElement:An object expression cannot bind a name PsiElement(IDENTIFIER)('Name') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - PsiElement(private)('private') - PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + PsiElement(private)('private') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') @@ -79,37 +77,36 @@ JetFile: ConstructorModifiersAndName.kt PsiErrorElement:An object expression cannot bind a name PsiElement(IDENTIFIER)('Name') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - PsiElement(private)('private') - PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACKET)(']') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PsiElement(private)('private') + PsiWhiteSpace(' ') + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -129,14 +126,13 @@ JetFile: ConstructorModifiersAndName.kt PsiErrorElement:An object expression cannot bind a name PsiElement(IDENTIFIER)('Name') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - PsiElement(private)('private') - PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + PsiElement(private)('private') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') CLASS_BODY PsiErrorElement:Expecting a class body \ No newline at end of file diff --git a/compiler/testData/psi/recovery/objects/expressions/EmptyParentheses.txt b/compiler/testData/psi/recovery/objects/expressions/EmptyParentheses.txt index 9c456b3657d..ea71da9875a 100644 --- a/compiler/testData/psi/recovery/objects/expressions/EmptyParentheses.txt +++ b/compiler/testData/psi/recovery/objects/expressions/EmptyParentheses.txt @@ -11,11 +11,10 @@ JetFile: EmptyParentheses.kt OBJECT_LITERAL OBJECT_DECLARATION PsiElement(object)('object') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -31,11 +30,10 @@ JetFile: EmptyParentheses.kt OBJECT_LITERAL OBJECT_DECLARATION PsiElement(object)('object') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') @@ -61,11 +59,10 @@ JetFile: EmptyParentheses.kt OBJECT_LITERAL OBJECT_DECLARATION PsiElement(object)('object') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') CLASS_BODY PsiErrorElement:Expecting a class body \ No newline at end of file diff --git a/compiler/testData/psi/recovery/objects/expressions/Everything.txt b/compiler/testData/psi/recovery/objects/expressions/Everything.txt index 3229281fa58..d18552df0e3 100644 --- a/compiler/testData/psi/recovery/objects/expressions/Everything.txt +++ b/compiler/testData/psi/recovery/objects/expressions/Everything.txt @@ -22,32 +22,31 @@ JetFile: Everything.kt PsiElement(IDENTIFIER)('R') PsiElement(GT)('>') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - PsiElement(private)('private') - PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('x') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(COMMA)(',') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + PsiElement(private)('private') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('x') + PsiElement(COLON)(':') PsiWhiteSpace(' ') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('y') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(RPAR)(')') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('y') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/recovery/objects/expressions/InFunction.txt b/compiler/testData/psi/recovery/objects/expressions/InFunction.txt index 938c64d2472..da41856d0f8 100644 --- a/compiler/testData/psi/recovery/objects/expressions/InFunction.txt +++ b/compiler/testData/psi/recovery/objects/expressions/InFunction.txt @@ -26,11 +26,10 @@ JetFile: InFunction.kt PsiErrorElement:An object expression cannot bind a name PsiElement(IDENTIFIER)('private') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace('\n\n ') CLASS_BODY PsiErrorElement:Expecting a class body @@ -49,11 +48,10 @@ JetFile: InFunction.kt PsiErrorElement:An object expression cannot bind a name PsiElement(IDENTIFIER)('private') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') @@ -78,37 +76,36 @@ JetFile: InFunction.kt OBJECT_DECLARATION PsiElement(object)('object') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - PsiElement(private)('private') - PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACKET)(']') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PsiElement(private)('private') + PsiWhiteSpace(' ') + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace('\n\n ') CLASS_BODY PsiErrorElement:Expecting a class body @@ -127,11 +124,10 @@ JetFile: InFunction.kt PsiErrorElement:An object expression cannot bind a name PsiElement(IDENTIFIER)('private') PsiWhiteSpace(' ') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace('\n') CLASS_BODY PsiErrorElement:Expecting a class body diff --git a/compiler/testData/psi/recovery/objects/expressions/ParametersInParentheses.txt b/compiler/testData/psi/recovery/objects/expressions/ParametersInParentheses.txt index 3211da093e0..b43684c81d8 100644 --- a/compiler/testData/psi/recovery/objects/expressions/ParametersInParentheses.txt +++ b/compiler/testData/psi/recovery/objects/expressions/ParametersInParentheses.txt @@ -11,29 +11,28 @@ JetFile: ParametersInParentheses.kt OBJECT_LITERAL OBJECT_DECLARATION PsiElement(object)('object') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('a') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(COMMA)(',') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') PsiWhiteSpace(' ') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('b') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('String') - PsiElement(RPAR)(')') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('b') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -49,29 +48,28 @@ JetFile: ParametersInParentheses.kt OBJECT_LITERAL OBJECT_DECLARATION PsiElement(object)('object') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('a') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(COMMA)(',') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') PsiWhiteSpace(' ') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('b') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('String') - PsiElement(RPAR)(')') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('b') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') @@ -97,29 +95,28 @@ JetFile: ParametersInParentheses.kt OBJECT_LITERAL OBJECT_DECLARATION PsiElement(object)('object') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('a') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(COMMA)(',') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') PsiWhiteSpace(' ') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('b') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('String') - PsiElement(RPAR)(')') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('b') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(RPAR)(')') CLASS_BODY PsiErrorElement:Expecting a class body \ No newline at end of file diff --git a/compiler/testData/psi/recovery/objects/expressions/TypeParametersAndParentheses.txt b/compiler/testData/psi/recovery/objects/expressions/TypeParametersAndParentheses.txt index 723f4f00be6..b74162ff623 100644 --- a/compiler/testData/psi/recovery/objects/expressions/TypeParametersAndParentheses.txt +++ b/compiler/testData/psi/recovery/objects/expressions/TypeParametersAndParentheses.txt @@ -21,19 +21,18 @@ JetFile: TypeParametersAndParentheses.kt TYPE_PARAMETER PsiElement(IDENTIFIER)('R') PsiElement(GT)('>') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('x') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('x') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -59,11 +58,10 @@ JetFile: TypeParametersAndParentheses.kt TYPE_PARAMETER PsiElement(IDENTIFIER)('R') PsiElement(GT)('>') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') @@ -99,11 +97,10 @@ JetFile: TypeParametersAndParentheses.kt TYPE_PARAMETER PsiElement(IDENTIFIER)('R') PsiElement(GT)('>') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') CLASS_BODY PsiErrorElement:Expecting a class body \ No newline at end of file diff --git a/compiler/testData/psi/recovery/objects/expressions/TypeParameterss.txt b/compiler/testData/psi/recovery/objects/expressions/TypeParameterss.txt index 80da6564bb2..a18da3ce43d 100644 --- a/compiler/testData/psi/recovery/objects/expressions/TypeParameterss.txt +++ b/compiler/testData/psi/recovery/objects/expressions/TypeParameterss.txt @@ -71,29 +71,28 @@ JetFile: TypeParameterss.kt OBJECT_LITERAL OBJECT_DECLARATION PsiElement(object)('object') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('a') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(COMMA)(',') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') PsiWhiteSpace(' ') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('b') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('String') - PsiElement(RPAR)(')') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('b') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(RPAR)(')') CLASS_BODY PsiErrorElement:Expecting a class body \ No newline at end of file diff --git a/compiler/testData/psi/recovery/objects/expressions/Where.txt b/compiler/testData/psi/recovery/objects/expressions/Where.txt index f9f75e69899..9e05b4ee70f 100644 --- a/compiler/testData/psi/recovery/objects/expressions/Where.txt +++ b/compiler/testData/psi/recovery/objects/expressions/Where.txt @@ -85,11 +85,10 @@ JetFile: Where.kt OBJECT_LITERAL OBJECT_DECLARATION PsiElement(object)('object') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiErrorElement:Where clause is not allowed for objects PsiErrorElement:Type constraints are not allowed when no type parameters declared @@ -121,11 +120,10 @@ JetFile: Where.kt OBJECT_LITERAL OBJECT_DECLARATION PsiElement(object)('object') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') @@ -166,11 +164,10 @@ JetFile: Where.kt OBJECT_LITERAL OBJECT_DECLARATION PsiElement(object)('object') - PsiErrorElement:Constructors are not allowed for objects - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ')