KT-12623 Fixed ISE: Type parameter ... not found for public fun ...
#KT-12623 Fixed Also EA-72653 fixed.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1486,7 +1486,16 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
if (at(LT)) {
|
||||
PsiBuilder.Marker error = mark();
|
||||
parseTypeParameterList(TokenSet.orSet(TokenSet.create(LPAR), valueParametersFollow));
|
||||
errorIf(error, typeParameterListOccurred, "Only one type parameter list is allowed for a function");
|
||||
if (typeParameterListOccurred) {
|
||||
int offset = myBuilder.getCurrentOffset();
|
||||
error.rollbackTo();
|
||||
error = mark();
|
||||
advance(offset - myBuilder.getCurrentOffset());
|
||||
error.error("Only one type parameter list is allowed for a function");
|
||||
}
|
||||
else {
|
||||
error.drop();
|
||||
}
|
||||
typeParameterListOccurred = true;
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -6,4 +6,8 @@ fun @[a()] T.foo<, T, , T>(a : foo) : bar
|
||||
fun @[a()] T.foo<T, T>(, a : foo, , a: b) : bar
|
||||
|
||||
fun foo() : = a;
|
||||
fun foo() = ;
|
||||
fun foo() = ;
|
||||
|
||||
fun <T> foo<D>()
|
||||
fun <T> foo<D()
|
||||
fun <T> A.<foo()
|
||||
|
||||
+57
@@ -312,3 +312,60 @@ JetFile: Functions_ERR.kt
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiErrorElement:Only one type parameter list is allowed for a function
|
||||
PsiElement(LT)('<')
|
||||
PsiElement(IDENTIFIER)('D')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiErrorElement:Only one type parameter list is allowed for a function
|
||||
PsiElement(LT)('<')
|
||||
PsiElement(IDENTIFIER)('D')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiElement(DOT)('.')
|
||||
PsiErrorElement:Only one type parameter list is allowed for a function
|
||||
PsiElement(LT)('<')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiErrorElement:Expecting '('
|
||||
<empty list>
|
||||
@@ -0,0 +1 @@
|
||||
<problems/>
|
||||
+1
@@ -0,0 +1 @@
|
||||
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.OverridingDeprecatedMemberInspection
|
||||
@@ -0,0 +1,5 @@
|
||||
// KT-12623 ISE: Type parameter ... not found for public fun ...
|
||||
|
||||
fun <T> boo<X>() {}
|
||||
|
||||
fun <T, C: MutableCollection<T>> Collection<partitionTo(first: C, second: C, f:(T) -> Boolean): Pair<C, C> = TODO()
|
||||
@@ -214,6 +214,12 @@ public class InspectionTestGenerated extends AbstractInspectionTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoSetOfTypeparameters/inspectionData/inspections.test")
|
||||
public void testTwoSetOfTypeparameters_inspectionData_Inspections_test() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspections/twoSetOfTypeparameters/inspectionData/inspections.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("unusedImport/inspectionData/inspections.test")
|
||||
public void testUnusedImport_inspectionData_Inspections_test() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspections/unusedImport/inspectionData/inspections.test");
|
||||
|
||||
Reference in New Issue
Block a user