Parser invalid error advancing for postfix type parameters list #KT-30835 Fixed
This commit is contained in:
@@ -1576,10 +1576,10 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
PsiBuilder.Marker error = mark();
|
||||
parseTypeParameterList(TokenSet.orSet(TokenSet.create(LPAR), valueParametersFollow));
|
||||
if (typeParameterListOccurred) {
|
||||
int offset = myBuilder.getCurrentOffset();
|
||||
int finishIndex = myBuilder.rawTokenIndex();
|
||||
error.rollbackTo();
|
||||
error = mark();
|
||||
advance(offset - myBuilder.getCurrentOffset());
|
||||
advance(finishIndex - myBuilder.rawTokenIndex());
|
||||
error.error("Only one type parameter list is allowed for a function");
|
||||
}
|
||||
else {
|
||||
|
||||
+2
-3
@@ -370,7 +370,6 @@ KtFile: Functions_ERR.kt
|
||||
PsiErrorElement:Only one type parameter list is allowed for a function
|
||||
PsiElement(LT)('<')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiErrorElement:Expecting '('
|
||||
<empty list>
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -0,0 +1 @@
|
||||
fun <T> foo<error><SOME_TYPE></error> () {}
|
||||
@@ -126,6 +126,11 @@ public class PsiCheckerTestGenerated extends AbstractPsiCheckerTest {
|
||||
runTest("idea/testData/checker/ForRangeConventions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionOnlyOneTypeParametersList.kt")
|
||||
public void testFunctionOnlyOneTypeParametersList() throws Exception {
|
||||
runTest("idea/testData/checker/FunctionOnlyOneTypeParametersList.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionReturnTypes.kt")
|
||||
public void testFunctionReturnTypes() throws Exception {
|
||||
runTest("idea/testData/checker/FunctionReturnTypes.kt");
|
||||
|
||||
Reference in New Issue
Block a user