JVM add ABI tests for non-approximated SAM types
Note that resulting SAM method
public final method accept(p0: java.lang.Object): void
has a signature less specific than the resulting bridge method
public synthetic bridge method accept(p0: X): void
This commit is contained in:
committed by
TeamCityServer
parent
c77884f067
commit
f30fc4863c
@@ -0,0 +1,20 @@
|
||||
interface X
|
||||
interface Z
|
||||
|
||||
interface A : X, Z
|
||||
interface B : X, Z
|
||||
|
||||
fun interface IFoo<T> where T : X, T : Z {
|
||||
fun accept(t: T)
|
||||
}
|
||||
|
||||
fun <T> sel(x: T, y: T) = x
|
||||
|
||||
class G<T> where T: X, T: Z {
|
||||
fun check(x: IFoo<in T>) {}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val g = sel(G<A>(), G<B>()) // g: G<out { X & Z }>
|
||||
g.check {} // (*) target SAM type: IFoo<{ X & Z }> (TODO: report a compile time error for this case)
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
@kotlin.Metadata
|
||||
public interface A {
|
||||
// source: 'nonApproxToValidSupertype.kt'
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface B {
|
||||
// source: 'nonApproxToValidSupertype.kt'
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class G {
|
||||
// source: 'nonApproxToValidSupertype.kt'
|
||||
public method <init>(): void
|
||||
public final method check(@org.jetbrains.annotations.NotNull p0: IFoo): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface IFoo {
|
||||
// source: 'nonApproxToValidSupertype.kt'
|
||||
public abstract method accept(@org.jetbrains.annotations.NotNull p0: X): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
final class NonApproxToValidSupertypeKt$test$1 {
|
||||
// source: 'nonApproxToValidSupertype.kt'
|
||||
enclosing method NonApproxToValidSupertypeKt.test()V
|
||||
public final static field INSTANCE: NonApproxToValidSupertypeKt$test$1
|
||||
inner (anonymous) class NonApproxToValidSupertypeKt$test$1
|
||||
static method <clinit>(): void
|
||||
method <init>(): void
|
||||
public final method accept(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void
|
||||
public synthetic bridge method accept(p0: X): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class NonApproxToValidSupertypeKt {
|
||||
// source: 'nonApproxToValidSupertype.kt'
|
||||
inner (anonymous) class NonApproxToValidSupertypeKt$test$1
|
||||
public final static method sel(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object
|
||||
public final static method test(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface X {
|
||||
// source: 'nonApproxToValidSupertype.kt'
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface Z {
|
||||
// source: 'nonApproxToValidSupertype.kt'
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
interface X: U, W
|
||||
interface Z: U, W
|
||||
|
||||
interface U
|
||||
interface W
|
||||
|
||||
interface A : X, Z
|
||||
interface B : X, Z
|
||||
|
||||
fun interface IFoo<T> where T : U, T : W {
|
||||
fun accept(t: T)
|
||||
}
|
||||
|
||||
fun <T> sel(x: T, y: T) = x
|
||||
|
||||
class G<T> where T: U, T: W {
|
||||
fun check(x: IFoo<in T>) {}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val g = sel(G<A>(), G<B>())
|
||||
g.check {} // TODO: report a compile time error for this case
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
@kotlin.Metadata
|
||||
public interface A {
|
||||
// source: 'nonApproxToValidSupertype2.kt'
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface B {
|
||||
// source: 'nonApproxToValidSupertype2.kt'
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class G {
|
||||
// source: 'nonApproxToValidSupertype2.kt'
|
||||
public method <init>(): void
|
||||
public final method check(@org.jetbrains.annotations.NotNull p0: IFoo): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface IFoo {
|
||||
// source: 'nonApproxToValidSupertype2.kt'
|
||||
public abstract method accept(@org.jetbrains.annotations.NotNull p0: U): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
final class NonApproxToValidSupertype2Kt$test$1 {
|
||||
// source: 'nonApproxToValidSupertype2.kt'
|
||||
enclosing method NonApproxToValidSupertype2Kt.test()V
|
||||
public final static field INSTANCE: NonApproxToValidSupertype2Kt$test$1
|
||||
inner (anonymous) class NonApproxToValidSupertype2Kt$test$1
|
||||
static method <clinit>(): void
|
||||
method <init>(): void
|
||||
public final method accept(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void
|
||||
public synthetic bridge method accept(p0: U): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class NonApproxToValidSupertype2Kt {
|
||||
// source: 'nonApproxToValidSupertype2.kt'
|
||||
inner (anonymous) class NonApproxToValidSupertype2Kt$test$1
|
||||
public final static method sel(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object
|
||||
public final static method test(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface U {
|
||||
// source: 'nonApproxToValidSupertype2.kt'
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface W {
|
||||
// source: 'nonApproxToValidSupertype2.kt'
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface X {
|
||||
// source: 'nonApproxToValidSupertype2.kt'
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface Z {
|
||||
// source: 'nonApproxToValidSupertype2.kt'
|
||||
}
|
||||
Reference in New Issue
Block a user