Added checking type parameters count in alternative signatures.
This commit is contained in:
+6
@@ -204,6 +204,12 @@ class AlternativeSignatureParsing {
|
||||
|
||||
static List<TypeParameterDescriptor> computeAlternativeTypeParameters(List<TypeParameterDescriptor> typeParameterDescriptors,
|
||||
JetNamedFunction altFunDeclaration) throws AlternativeSignatureMismatchException {
|
||||
if (typeParameterDescriptors.size() != altFunDeclaration.getTypeParameters().size()) {
|
||||
throw new AlternativeSignatureMismatchException(
|
||||
String.format("Method signature has %d type parameters, but alternative signature has %d",
|
||||
typeParameterDescriptors.size(), altFunDeclaration.getTypeParameters().size()));
|
||||
}
|
||||
|
||||
List<TypeParameterDescriptor> altParamDescriptors = new ArrayList<TypeParameterDescriptor>();
|
||||
for (int i = 0, size = typeParameterDescriptors.size(); i < size; i++) {
|
||||
TypeParameterDescriptor pd = typeParameterDescriptors.get(i);
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package test;
|
||||
|
||||
import java.lang.UnsupportedOperationException;
|
||||
import java.util.*;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
|
||||
import jet.runtime.typeinfo.KotlinSignature;
|
||||
|
||||
public class WrongTypeParametersCount {
|
||||
@KotlinSignature("fun <A, B, C> foo(a : A, b : List<out B>)")
|
||||
public <A, B> void foo(A a, List<? extends B> b) {
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package test
|
||||
|
||||
import java.util.*
|
||||
|
||||
public open class WrongTypeParametersCount : Object() {
|
||||
public open fun <erased A, erased B> foo(p0 : A?, p1 : List<out B>?) {
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
namespace test
|
||||
|
||||
public open class test.WrongTypeParametersCount : java.lang.Object {
|
||||
public final /*constructor*/ fun <init>(): test.WrongTypeParametersCount
|
||||
public open fun </*0*/ A : jet.Any?, /*1*/ B : jet.Any?>foo(/*0*/ p0: A?, /*1*/ p1: java.util.List<out B>?): jet.Tuple0
|
||||
}
|
||||
Reference in New Issue
Block a user