Checking for return type in kotlin signature if have super methods.

This commit is contained in:
Evgeny Gerashchenko
2012-12-04 16:01:34 +04:00
parent 6975691e7a
commit 5e86cbe004
6 changed files with 71 additions and 6 deletions
@@ -0,0 +1,21 @@
package test;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import jet.runtime.typeinfo.KotlinSignature;
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
public interface CantMakeImmutableInSubclass {
public interface Super {
@KotlinSignature("fun foo(): MutableCollection<String>")
Collection<String> foo();
}
public interface Sub extends Super {
@ExpectLoadError("Return type is changed to not subtype for method which overrides another: List<String>, was: MutableList<String>")
@KotlinSignature("fun foo(): List<String>")
List<String> foo();
}
}
@@ -0,0 +1,12 @@
package test
public trait CantMakeImmutableInSubclass: Object {
public trait Super: Object {
public fun foo(): MutableCollection<String>
}
public trait Sub: Super {
override fun foo(): MutableList<String>
}
}
@@ -0,0 +1,10 @@
namespace test
public abstract trait test.CantMakeImmutableInSubclass : java.lang.Object {
public abstract trait test.CantMakeImmutableInSubclass.Sub : test.CantMakeImmutableInSubclass.Super {
public abstract override /*1*/ fun foo(): jet.MutableList<jet.String>
}
public abstract trait test.CantMakeImmutableInSubclass.Super : java.lang.Object {
public abstract fun foo(): jet.MutableCollection<jet.String>
}
}