K2: add bytecode listing tests
#KT-57171 Fixed
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
@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: 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'
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
// K1 generates `accept(Object)` and bridge `accept(X)` in the SAM adapter.
|
||||
// K2 generates `accept(X)` only. It is fine though, because if `check`'s parameter is passed where Z is expected, checkcast is added.
|
||||
|
||||
interface X
|
||||
interface Z
|
||||
|
||||
@@ -17,4 +20,4 @@ class G<T> where T: X, T: Z {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
+62
@@ -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: X): 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'
|
||||
}
|
||||
+4
-1
@@ -1,3 +1,6 @@
|
||||
// K1 generates `accept(Object)` and bridge `accept(U)` in the SAM adapter.
|
||||
// K2 generates `accept(X)` and bridge `accept(U)`. It is fine though, because if `check`'s parameter is passed where Z or W is expected, checkcast is added.
|
||||
|
||||
interface X: U, W
|
||||
interface Z: U, W
|
||||
|
||||
@@ -20,4 +23,4 @@ class G<T> where T: U, T: W {
|
||||
fun test() {
|
||||
val g = sel(G<A>(), G<B>())
|
||||
g.check {} // TODO: report a compile time error for this case
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user