Supported checking for changing signature in submethods.

#KT-2776 in progress
This commit is contained in:
Evgeny Gerashchenko
2012-11-26 17:25:50 +04:00
parent dd671313c5
commit 8d7de5d063
20 changed files with 295 additions and 6 deletions
@@ -0,0 +1,20 @@
package test;
import org.jetbrains.annotations.NotNull;
import jet.runtime.typeinfo.KotlinSignature;
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
import java.util.*;
public interface ChangeProjectionKind1 {
public interface Super {
@KotlinSignature("fun foo(p: MutableList<in String>)")
void foo(List<String> p);
}
public interface Sub extends Super {
@ExpectLoadError("Variance mismatch, actual: in, in alternative signature: ")
@KotlinSignature("fun foo(p: MutableList<String>)")
void foo(List<String> p);
}
}
@@ -0,0 +1,12 @@
package test
public trait ChangeProjectionKind1: Object {
public trait Super: Object {
public fun foo(p0: MutableList<in String>)
}
public trait Sub: Super {
override fun foo(p0: MutableList<in String>)
}
}
@@ -0,0 +1,10 @@
namespace test
public abstract trait test.ChangeProjectionKind1 : java.lang.Object {
public abstract trait test.ChangeProjectionKind1.Sub : test.ChangeProjectionKind1.Super {
public abstract override /*1*/ fun foo(/*0*/ p0: jet.MutableList<in jet.String>): jet.Tuple0
}
public abstract trait test.ChangeProjectionKind1.Super : java.lang.Object {
public abstract fun foo(/*0*/ p0: jet.MutableList<in jet.String>): jet.Tuple0
}
}
@@ -0,0 +1,20 @@
package test;
import org.jetbrains.annotations.NotNull;
import jet.runtime.typeinfo.KotlinSignature;
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
import java.util.*;
public interface ChangeProjectionKind2 {
public interface Super {
@KotlinSignature("fun foo(p: MutableList<String>)")
void foo(List<String> p);
}
public interface Sub extends Super {
@ExpectLoadError("Parameter type changed for method which overrides another: MutableList<in String>, was: MutableList<String>")
@KotlinSignature("fun foo(p: MutableList<in String>)")
void foo(List<String> p);
}
}
@@ -0,0 +1,12 @@
package test
public trait ChangeProjectionKind2: Object {
public trait Super: Object {
public fun foo(p0: MutableList<String>)
}
public trait Sub: Super {
override fun foo(p0: MutableList<String>)
}
}
@@ -0,0 +1,10 @@
namespace test
public abstract trait test.ChangeProjectionKind2 : java.lang.Object {
public abstract trait test.ChangeProjectionKind2.Sub : test.ChangeProjectionKind2.Super {
public abstract override /*1*/ fun foo(/*0*/ p0: jet.MutableList<jet.String>): jet.Tuple0
}
public abstract trait test.ChangeProjectionKind2.Super : java.lang.Object {
public abstract fun foo(/*0*/ p0: jet.MutableList<jet.String>): jet.Tuple0
}
}
@@ -0,0 +1,20 @@
package test;
import org.jetbrains.annotations.NotNull;
import jet.runtime.typeinfo.KotlinSignature;
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
import java.util.*;
public interface MutableToReadOnly {
public interface Super {
@KotlinSignature("fun foo(p: MutableList<String>)")
void foo(List<String> p);
}
public interface Sub extends Super {
@ExpectLoadError("Parameter type changed for method which overrides another: List<String>, was: MutableList<String>")
@KotlinSignature("fun foo(p: List<String>)")
void foo(List<String> p);
}
}
@@ -0,0 +1,12 @@
package test
public trait MutableToReadOnly: Object {
public trait Super: Object {
public fun foo(p0: MutableList<String>)
}
public trait Sub: Super {
override fun foo(p0: MutableList<String>)
}
}
@@ -0,0 +1,10 @@
namespace test
public abstract trait test.MutableToReadOnly : java.lang.Object {
public abstract trait test.MutableToReadOnly.Sub : test.MutableToReadOnly.Super {
public abstract override /*1*/ fun foo(/*0*/ p0: jet.MutableList<jet.String>): jet.Tuple0
}
public abstract trait test.MutableToReadOnly.Super : java.lang.Object {
public abstract fun foo(/*0*/ p0: jet.MutableList<jet.String>): jet.Tuple0
}
}
@@ -0,0 +1,19 @@
package test;
import org.jetbrains.annotations.NotNull;
import jet.runtime.typeinfo.KotlinSignature;
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
public interface NullableToNotNullKotlinSignature {
public interface Super {
@KotlinSignature("fun foo(p: String?)")
void foo(String p);
}
public interface Sub extends Super {
@ExpectLoadError("Parameter type changed for method which overrides another: String, was: String?")
@KotlinSignature("fun foo(p: String)")
void foo(String p);
}
}
@@ -0,0 +1,12 @@
package test
public trait NullableToNotNullKotlinSignature: Object {
public trait Super: Object {
public fun foo(p0: String?)
}
public trait Sub: Super {
override fun foo(p0: String?)
}
}
@@ -0,0 +1,10 @@
namespace test
public abstract trait test.NullableToNotNullKotlinSignature : java.lang.Object {
public abstract trait test.NullableToNotNullKotlinSignature.Sub : test.NullableToNotNullKotlinSignature.Super {
public abstract override /*1*/ fun foo(/*0*/ p0: jet.String?): jet.Tuple0
}
public abstract trait test.NullableToNotNullKotlinSignature.Super : java.lang.Object {
public abstract fun foo(/*0*/ p0: jet.String?): jet.Tuple0
}
}
@@ -0,0 +1,20 @@
package test;
import org.jetbrains.annotations.NotNull;
import jet.runtime.typeinfo.KotlinSignature;
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
import java.util.*;
public interface ReadOnlyToMutable {
public interface Super {
@KotlinSignature("fun foo(p: List<String>)")
void foo(List<String> p);
}
public interface Sub extends Super {
@ExpectLoadError("Parameter type changed for method which overrides another: MutableList<String>, was: List<String>")
@KotlinSignature("fun foo(p: MutableList<String>)")
void foo(List<String> p);
}
}
@@ -0,0 +1,12 @@
package test
public trait ReadOnlyToMutable: Object {
public trait Super: Object {
public fun foo(p0: List<String>)
}
public trait Sub: Super {
override fun foo(p0: List<String>)
}
}
@@ -0,0 +1,10 @@
namespace test
public abstract trait test.ReadOnlyToMutable : java.lang.Object {
public abstract trait test.ReadOnlyToMutable.Sub : test.ReadOnlyToMutable.Super {
public abstract override /*1*/ fun foo(/*0*/ p0: jet.List<jet.String>): jet.Tuple0
}
public abstract trait test.ReadOnlyToMutable.Super : java.lang.Object {
public abstract fun foo(/*0*/ p0: jet.List<jet.String>): jet.Tuple0
}
}