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();
|
PsiBuilder.Marker error = mark();
|
||||||
parseTypeParameterList(TokenSet.orSet(TokenSet.create(LPAR), valueParametersFollow));
|
parseTypeParameterList(TokenSet.orSet(TokenSet.create(LPAR), valueParametersFollow));
|
||||||
if (typeParameterListOccurred) {
|
if (typeParameterListOccurred) {
|
||||||
int offset = myBuilder.getCurrentOffset();
|
int finishIndex = myBuilder.rawTokenIndex();
|
||||||
error.rollbackTo();
|
error.rollbackTo();
|
||||||
error = mark();
|
error = mark();
|
||||||
advance(offset - myBuilder.getCurrentOffset());
|
advance(finishIndex - myBuilder.rawTokenIndex());
|
||||||
error.error("Only one type parameter list is allowed for a function");
|
error.error("Only one type parameter list is allowed for a function");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+2
-3
@@ -370,7 +370,6 @@ KtFile: Functions_ERR.kt
|
|||||||
PsiErrorElement:Only one type parameter list is allowed for a function
|
PsiErrorElement:Only one type parameter list is allowed for a function
|
||||||
PsiElement(LT)('<')
|
PsiElement(LT)('<')
|
||||||
PsiElement(IDENTIFIER)('foo')
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiErrorElement:Expecting '('
|
|
||||||
<empty list>
|
|
||||||
@@ -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");
|
runTest("idea/testData/checker/ForRangeConventions.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("FunctionOnlyOneTypeParametersList.kt")
|
||||||
|
public void testFunctionOnlyOneTypeParametersList() throws Exception {
|
||||||
|
runTest("idea/testData/checker/FunctionOnlyOneTypeParametersList.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("FunctionReturnTypes.kt")
|
@TestMetadata("FunctionReturnTypes.kt")
|
||||||
public void testFunctionReturnTypes() throws Exception {
|
public void testFunctionReturnTypes() throws Exception {
|
||||||
runTest("idea/testData/checker/FunctionReturnTypes.kt");
|
runTest("idea/testData/checker/FunctionReturnTypes.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user