Fix exception happening while parsing an incorrect file

^KTIJ-21546 Fixed
This commit is contained in:
Denis.Zharkov
2022-04-15 10:01:02 +03:00
committed by teamcity
parent 989cef6c3c
commit b8ea48fdc2
4 changed files with 1078 additions and 1 deletions
@@ -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");
}