Removing redundant projections when loading from Java.

This commit is contained in:
Evgeny Gerashchenko
2012-11-30 19:09:01 +04:00
parent 46a485da01
commit 01b3d75374
21 changed files with 94 additions and 52 deletions
@@ -0,0 +1,8 @@
package test;
import java.util.Collection;
public interface RemoveRedundantProjectionKind {
void f(Collection<? extends CharSequence> collection);
void f(Comparable<? super CharSequence> comparator);
}
@@ -0,0 +1,6 @@
package test
public trait RemoveRedundantProjectionKind: Object {
public fun f(p0: Collection<CharSequence?>?)
public fun f(p0: Comparable<CharSequence?>?)
}
@@ -0,0 +1,6 @@
namespace test
public abstract trait test.RemoveRedundantProjectionKind : java.lang.Object {
public abstract fun f(/*0*/ p0: jet.Collection<jet.CharSequence?>?): jet.Tuple0
public abstract fun f(/*0*/ p0: jet.Comparable<jet.CharSequence?>?): jet.Tuple0
}
@@ -7,7 +7,7 @@ import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
public class WrongTypeParameterBoundStructure1 {
@ExpectLoadError("'java.lang.Runnable?' type in method signature has 0 type arguments, while 'Runnable<Int>' in alternative signature has 1 of them")
@KotlinSignature("fun <A, B : Runnable<Int>> foo(a : A, b : List<out B>) where B : List<Cloneable>")
@KotlinSignature("fun <A, B : Runnable<Int>> foo(a : A, b : List<B>) where B : List<Cloneable>")
public <A, B extends Runnable & List<Cloneable>> void foo(A a, List<? extends B> b) {
}
}
@@ -3,6 +3,6 @@ package test
import java.util.*
public open class WrongTypeParameterBoundStructure1 : Object() {
public open fun <erased A, erased B : Runnable?> foo(p0 : A?, p1 : List<out B>?) where B : List<Cloneable?>? {
public open fun <erased A, erased B : Runnable?> foo(p0 : A?, p1 : List<B>?) where B : List<Cloneable?>? {
}
}
@@ -2,5 +2,5 @@ namespace test
public open class test.WrongTypeParameterBoundStructure1 : java.lang.Object {
public final /*constructor*/ fun <init>(): test.WrongTypeParameterBoundStructure1
public open fun </*0*/ A : jet.Any?, /*1*/ B : java.lang.Runnable? & jet.List<java.lang.Cloneable?>?>foo(/*0*/ p0: A?, /*1*/ p1: jet.List<out B>?): jet.Tuple0
public open fun </*0*/ A : jet.Any?, /*1*/ B : java.lang.Runnable? & jet.List<java.lang.Cloneable?>?>foo(/*0*/ p0: A?, /*1*/ p1: jet.List<B>?): jet.Tuple0
}
@@ -7,7 +7,7 @@ import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
public class WrongTypeParameterBoundStructure2 {
@ExpectLoadError("'jet.List<java.lang.Cloneable?>?' type in method signature has 1 type arguments, while 'List' in alternative signature has 0 of them")
@KotlinSignature("fun <A, B : Runnable> foo(a : A, b : List<out B>) where B : List")
@KotlinSignature("fun <A, B : Runnable> foo(a : A, b : List<B>) where B : List")
public <A, B extends Runnable & List<Cloneable>> void foo(A a, List<? extends B> b) {
}
}
@@ -3,6 +3,6 @@ package test
import java.util.*
public open class WrongTypeParameterBoundStructure2 : Object() {
public open fun <erased A, erased B : Runnable?> foo(p0 : A?, p1 : List<out B>?) where B : List<Cloneable?>? {
public open fun <erased A, erased B : Runnable?> foo(p0 : A?, p1 : List<B>?) where B : List<Cloneable?>? {
}
}
@@ -2,5 +2,5 @@ namespace test
public open class test.WrongTypeParameterBoundStructure2 : java.lang.Object {
public final /*constructor*/ fun <init>(): test.WrongTypeParameterBoundStructure2
public open fun </*0*/ A : jet.Any?, /*1*/ B : java.lang.Runnable? & jet.List<java.lang.Cloneable?>?>foo(/*0*/ p0: A?, /*1*/ p1: jet.List<out B>?): jet.Tuple0
public open fun </*0*/ A : jet.Any?, /*1*/ B : java.lang.Runnable? & jet.List<java.lang.Cloneable?>?>foo(/*0*/ p0: A?, /*1*/ p1: jet.List<B>?): jet.Tuple0
}
@@ -7,7 +7,7 @@ import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
public class WrongTypeParametersCount {
@ExpectLoadError("Method signature has 2 type parameters, but alternative signature has 3")
@KotlinSignature("fun <A, B, C> foo(a : A, b : List<out B>)")
@KotlinSignature("fun <A, B, C> foo(a : A, b : List<B>)")
public <A, B> void foo(A a, List<? extends B> b) {
}
}
@@ -3,6 +3,6 @@ package test
import java.util.*
public open class WrongTypeParametersCount : Object() {
public open fun <erased A, erased B> foo(p0 : A?, p1 : List<out B>?) {
public open fun <erased A, erased B> foo(p0 : A?, p1 : List<B>?) {
}
}
@@ -2,5 +2,5 @@ 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: jet.List<out B>?): jet.Tuple0
public open fun </*0*/ A : jet.Any?, /*1*/ B : jet.Any?>foo(/*0*/ p0: A?, /*1*/ p1: jet.List<B>?): jet.Tuple0
}
@@ -1,5 +1,6 @@
package test;
import java.lang.Number;
import java.util.*;
import jet.runtime.typeinfo.KotlinSignature;
@@ -7,8 +8,8 @@ import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
public class WrongTypeVariance {
@ExpectLoadError("Variance mismatch, actual: out, in alternative signature: ")
@KotlinSignature("fun copy(a : List<out Number>, b : List<Number>) : MutableList<Number>")
public List<Number> copy(List<? extends Number> from, List<? extends Number> to) {
@KotlinSignature("fun copy(a : Array<out Number>, b : Array<Number>) : MutableList<Number>")
public List<Number> copy(Number[] from, Number[] to) {
throw new UnsupportedOperationException();
}
}
@@ -3,7 +3,7 @@ package test
import java.util.*
public open class WrongTypeVariance : Object() {
public open fun copy(p0 : List<out jet.Number?>?, p1 : List<out jet.Number?>?) : MutableList<jet.Number?>? {
public open fun copy(p0 : Array<out Number?>?, p1 : Array<out Number?>?) : MutableList<Number?>? {
throw UnsupportedOperationException()
}
}
@@ -2,5 +2,5 @@ namespace test
public open class test.WrongTypeVariance : java.lang.Object {
public final /*constructor*/ fun <init>(): test.WrongTypeVariance
public open fun copy(/*0*/ p0: jet.List<out jet.Number?>?, /*1*/ p1: jet.List<out jet.Number?>?): jet.MutableList<jet.Number?>?
public open fun copy(/*0*/ p0: jet.Array<out jet.Number?>?, /*1*/ p1: jet.Array<out jet.Number?>?): jet.MutableList<jet.Number?>?
}