Fix exception happening while parsing an incorrect file
^KTIJ-21546 Fixed
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// !LANGUAGE: -SuspendFunctionAsSupertype
|
||||
typealias Action = () -> Unit
|
||||
|
||||
interface SAM {
|
||||
fun run()
|
||||
}
|
||||
|
||||
typealias Test1 = suspend () -> Unit
|
||||
typealias Test2 = suspend Int.() -> Unit
|
||||
typealias Test3 = <!WRONG_MODIFIER_TARGET!>suspend<!> Function0<Unit>
|
||||
typealias Test4 = <!WRONG_MODIFIER_TARGET!>suspend<!> Action
|
||||
typealias Test5 = List<suspend () -> Unit>
|
||||
typealias Test6 = <!WRONG_MODIFIER_TARGET!>suspend<!> List<() -> Unit>
|
||||
typealias Test7 = <!WRONG_MODIFIER_TARGET!>suspend<!> SAM
|
||||
typealias Test8 = <!WRONG_MODIFIER_TARGET!>suspend<!> kotlin.coroutines.SuspendFunction0<Unit>
|
||||
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(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>{ val x: <!WRONG_MODIFIER_TARGET!>suspend<!> String? = null; "" }()<!>) suspend () -> Unit)?
|
||||
typealias Test20 = (@A(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>"".let { val x: <!WRONG_MODIFIER_TARGET!>suspend<!> String? = null; it }<!>) suspend () -> Unit)?
|
||||
|
||||
interface Supertype1 : suspend () -> Unit {
|
||||
|
||||
}
|
||||
|
||||
interface Supertype2 : <!SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE!>suspend String.() -> Unit<!> {
|
||||
|
||||
}
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class A(val value: String = "")
|
||||
|
||||
interface RS
|
||||
+1031
File diff suppressed because it is too large
Load Diff
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user