From b8ea48fdc29678b6d99cb1b7bad312f917ea9529 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Fri, 15 Apr 2022 10:01:02 +0300 Subject: [PATCH] Fix exception happening while parsing an incorrect file ^KTIJ-21546 Fixed --- .../kotlin/parsing/KotlinParsing.java | 3 +- compiler/testData/psi/diagnosticTags_ERR.kt | 40 + compiler/testData/psi/diagnosticTags_ERR.txt | 1031 +++++++++++++++++ .../kotlin/parsing/ParsingTestGenerated.java | 5 + 4 files changed, 1078 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/psi/diagnosticTags_ERR.kt create mode 100644 compiler/testData/psi/diagnosticTags_ERR.txt diff --git a/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinParsing.java b/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinParsing.java index b7dd48cf491..aa5387fdd24 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinParsing.java +++ b/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinParsing.java @@ -2243,7 +2243,7 @@ public class KotlinParsing extends AbstractKotlinParsing { wasIntersection = true; } - if (typeBeforeDot && at(DOT) && !wasIntersection) { + if (typeBeforeDot && at(DOT) && !wasIntersection && !wasFunctionTypeParsed) { // This is a receiver for a function type // A.(B) -> C // ^ @@ -2261,6 +2261,7 @@ public class KotlinParsing extends AbstractKotlinParsing { parseFunctionType(functionType); } else { + functionType.drop(); error("Expecting function type"); } diff --git a/compiler/testData/psi/diagnosticTags_ERR.kt b/compiler/testData/psi/diagnosticTags_ERR.kt new file mode 100644 index 00000000000..0bf40e2e6b2 --- /dev/null +++ b/compiler/testData/psi/diagnosticTags_ERR.kt @@ -0,0 +1,40 @@ +// !LANGUAGE: -SuspendFunctionAsSupertype +typealias Action = () -> Unit + +interface SAM { + fun run() +} + +typealias Test1 = suspend () -> Unit +typealias Test2 = suspend Int.() -> Unit +typealias Test3 = suspend Function0 +typealias Test4 = suspend Action +typealias Test5 = List Unit> +typealias Test6 = suspend List<() -> Unit> +typealias Test7 = suspend SAM +typealias Test8 = suspend kotlin.coroutines.SuspendFunction0 +typealias Test9 = suspend (() -> Unit) -> Unit +typealias Test10 = suspend (suspend () -> Unit) -> Unit +typealias Test11 = suspend () -> (suspend () -> Unit) +typealias Test12 = suspend (suspend (() -> Unit)) -> Unit +typealias Test13 = @A() suspend () -> Unit +typealias Test14 = @A suspend () -> Unit +typealias Test15 = (@A() suspend () -> Unit)? +typealias Test16 = (@A suspend () -> Unit)? +typealias Test17 = @A suspend RS.() -> Unit +typealias Test18 = (suspend () -> Unit)? +typealias Test19 = (@A({ val x: suspend String? = null; "" }()) suspend () -> Unit)? +typealias Test20 = (@A("".let { val x: suspend String? = null; it }) suspend () -> Unit)? + +interface Supertype1 : suspend () -> Unit { + +} + +interface Supertype2 : suspend String.() -> Unit { + +} + +@Target(AnnotationTarget.TYPE) +annotation class A(val value: String = "") + +interface RS diff --git a/compiler/testData/psi/diagnosticTags_ERR.txt b/compiler/testData/psi/diagnosticTags_ERR.txt new file mode 100644 index 00000000000..285f577f55c --- /dev/null +++ b/compiler/testData/psi/diagnosticTags_ERR.txt @@ -0,0 +1,1031 @@ +KtFile: diagnosticTags_ERR.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + TYPEALIAS + PsiComment(EOL_COMMENT)('// !LANGUAGE: -SuspendFunctionAsSupertype') + PsiWhiteSpace('\n') + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Action') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n\n') + CLASS + PsiElement(interface)('interface') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('SAM') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('run') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test1') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test2') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test3') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('WRONG_MODIFIER_TARGET') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Function0') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Unit') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test4') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('WRONG_MODIFIER_TARGET') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Action') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test5') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('List') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(GT)('>') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test6') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('WRONG_MODIFIER_TARGET') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('List') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Unit') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test7') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('WRONG_MODIFIER_TARGET') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('SAM') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test8') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('WRONG_MODIFIER_TARGET') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('kotlin') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('coroutines') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('SuspendFunction0') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Unit') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test9') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test10') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test11') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test12') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test13') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test14') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test15') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test16') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test17') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('RS') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test18') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test19') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + PsiErrorElement:Expecting an expression + + PsiErrorElement:Expecting ')' + PsiElement(LT)('<') + PsiErrorElement:Type expected + PsiElement(EXCL)('!') + PsiErrorElement:Expecting comma or ')' + + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ANNOTATION_ARGUMENT_MUST_BE_CONST') + PsiErrorElement:Unexpected token + PsiElement(EXCL)('!') + PsiErrorElement:Expecting comma or ')' + + PsiErrorElement:Expecting ')' + PsiElement(GT)('>') + PsiErrorElement:Expecting '->' to specify return type of a function type + + TYPE_REFERENCE + + FUN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace(' ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(LT)('<') + PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line) + PsiElement(EXCL)('!') + PsiElement(IDENTIFIER)('WRONG_MODIFIER_TARGET') + PsiElement(EXCL)('!') + PsiElement(GT)('>') + PsiElement(IDENTIFIER)('suspend') + PsiElement(LT)('<') + PsiElement(EXCL)('!') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('String') + PsiElement(QUEST)('?') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + PsiElement(null)('null') + PsiErrorElement:Expecting an element + PsiElement(SEMICOLON)(';') + PsiWhiteSpace(' ') + STRING_TEMPLATE + PsiElement(OPEN_QUOTE)('"') + PsiElement(CLOSING_QUOTE)('"') + PsiWhiteSpace(' ') + PsiElement(RBRACE)('}') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Unit') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiErrorElement:Expecting a top level declaration + PsiElement(QUEST)('?') + PsiWhiteSpace('\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Test20') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + PsiErrorElement:Expecting an expression + + PsiErrorElement:Expecting ')' + PsiElement(LT)('<') + PsiErrorElement:Type expected + PsiElement(EXCL)('!') + PsiErrorElement:Expecting comma or ')' + + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ANNOTATION_ARGUMENT_MUST_BE_CONST') + PsiErrorElement:Unexpected token + PsiElement(EXCL)('!') + PsiErrorElement:Expecting comma or ')' + + PsiErrorElement:Expecting ')' + PsiElement(GT)('>') + PsiErrorElement:Expecting '->' to specify return type of a function type + PsiElement(OPEN_QUOTE)('"') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(CLOSING_QUOTE)('"') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('let') + PsiWhiteSpace(' ') + FUN + PsiErrorElement:Expecting a top level declaration + + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace(' ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(LT)('<') + PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line) + PsiElement(EXCL)('!') + PsiElement(IDENTIFIER)('WRONG_MODIFIER_TARGET') + PsiElement(EXCL)('!') + PsiElement(GT)('>') + PsiElement(IDENTIFIER)('suspend') + PsiElement(LT)('<') + PsiElement(EXCL)('!') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('String') + PsiElement(QUEST)('?') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + PsiElement(null)('null') + PsiErrorElement:Expecting an element + PsiElement(SEMICOLON)(';') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('it') + PsiWhiteSpace(' ') + PsiElement(RBRACE)('}') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Unit') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiErrorElement:Expecting a top level declaration + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + CLASS + PsiElement(interface)('interface') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Supertype1') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + SUPER_TYPE_LIST + SUPER_TYPE_ENTRY + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + CLASS + PsiElement(interface)('interface') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Supertype2') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + SUPER_TYPE_LIST + SUPER_TYPE_ENTRY + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('String') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Unit') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(EXCL)('!') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace(' ') + FUN + PsiErrorElement:Expecting a top level declaration + + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Target') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('AnnotationTarget') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('TYPE') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + PsiElement(annotation)('annotation') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('value') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + STRING_TEMPLATE + PsiElement(OPEN_QUOTE)('"') + PsiElement(CLOSING_QUOTE)('"') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + CLASS + PsiElement(interface)('interface') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('RS') \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java index 16771026f67..713dc71a03e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java @@ -161,6 +161,11 @@ public class ParsingTestGenerated extends AbstractParsingTest { runTest("compiler/testData/psi/destructuringInLambdas_ERR.kt"); } + @TestMetadata("diagnosticTags_ERR.kt") + public void testDiagnosticTags_ERR() throws Exception { + runTest("compiler/testData/psi/diagnosticTags_ERR.kt"); + } + @TestMetadata("DocCommentAfterFileAnnotations.kt") public void testDocCommentAfterFileAnnotations() throws Exception { runTest("compiler/testData/psi/DocCommentAfterFileAnnotations.kt");