K2: add bytecode listing tests

#KT-57171 Fixed
This commit is contained in:
Alexander Udalov
2023-03-10 00:18:25 +01:00
parent f8deae4570
commit f0fba7be64
59 changed files with 5423 additions and 55 deletions
@@ -1,3 +1,6 @@
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57228 K2: annotations for interface member properties implemented by delegation are copied
annotation class Ann annotation class Ann
interface IFoo { interface IFoo {
@@ -0,0 +1,18 @@
// !LANGUAGE: +RepeatableAnnotations
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// FULL_JDK
// JVM_TARGET: 1.8
// IGNORE_BACKEND_K1: JVM_IR
// ^ "c", "d" is not detected because of KT-48141.
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: ["c", "d", "a", "b"] because of KT-57219 K2: incorrect relative order of normal and use-site-targeted annotations on property getter in the resulting bytecode
@Repeatable
annotation class A(val v: String)
@get:A("a") @get:A("b")
val ab: Int
@get:A("c") @get:A("d") get() = 0
@@ -0,0 +1,25 @@
@kotlin.jvm.internal.RepeatableContainer
@java.lang.annotation.Retention(value=RUNTIME)
@kotlin.Metadata
public annotation class A$Container {
// source: 'propertyGetterSeveralUseSiteTargets.kt'
public abstract method value(): A[]
public inner class A$Container
}
@kotlin.annotation.Repeatable
@java.lang.annotation.Retention(value=RUNTIME)
@java.lang.annotation.Repeatable(value=A$Container::class)
@kotlin.Metadata
public annotation class A {
// source: 'propertyGetterSeveralUseSiteTargets.kt'
public abstract method v(): java.lang.String
public inner class A$Container
}
@kotlin.Metadata
public final class PropertyGetterSeveralUseSiteTargetsKt {
// source: 'propertyGetterSeveralUseSiteTargets.kt'
public final static @A$Container(value=[A(v="a"), A(v="b"), A(v="c"), A(v="d")]) method getAb(): int
public inner class A$Container
}
@@ -4,6 +4,9 @@
// FULL_JDK // FULL_JDK
// JVM_TARGET: 1.8 // JVM_TARGET: 1.8
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57219 K2: incorrect relative order of normal and use-site-targeted annotations on property getter in the resulting bytecode
@Repeatable @Repeatable
annotation class A(val v: String) annotation class A(val v: String)
@@ -19,5 +22,4 @@ val ef: Int
@get:A("g") @get:A("g")
val ghi: Int val ghi: Int
// "i" is not detected because of KT-48141. @A("h") get() = 0
@A("h") @get:A("i") get() = 0
@@ -1,6 +1,9 @@
// WITH_STDLIB // WITH_STDLIB
// FULL_JDK // FULL_JDK
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57269 K2: collection stub for `sort` is not generated for custom List subclasses
import java.util.* import java.util.*
class ListSet<out E : Any> : List<E>, Set<E> { class ListSet<out E : Any> : List<E>, Set<E> {
@@ -1,3 +1,6 @@
// WITH_SIGNATURES // WITH_SIGNATURES
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
abstract class ByteShortMap : Map<Byte, Short> abstract class ByteShortMap : Map<Byte, Short>
@@ -1,3 +1,6 @@
// WITH_SIGNATURES // WITH_SIGNATURES
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
abstract class GenericMap<K, V> : Map<K, V> abstract class GenericMap<K, V> : Map<K, V>
@@ -1,3 +1,6 @@
// WITH_SIGNATURES // WITH_SIGNATURES
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
abstract class GenericStringMap<K> : Map<K, String> abstract class GenericStringMap<K> : Map<K, String>
@@ -1,3 +1,6 @@
// WITH_SIGNATURES // WITH_SIGNATURES
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
abstract class NumberStringMap : Map<Number, String> abstract class NumberStringMap : Map<Number, String>
@@ -1,5 +1,8 @@
// WITH_SIGNATURES // WITH_SIGNATURES
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
abstract class GenericMap<K, V> : Map<K, V> abstract class GenericMap<K, V> : Map<K, V>
abstract class NumberStringMap : GenericMap<Number, String>() abstract class NumberStringMap : GenericMap<Number, String>()
@@ -1,3 +1,6 @@
// WITH_SIGNATURES // WITH_SIGNATURES
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
abstract class StringGenericMap<V> : Map<String, V> abstract class StringGenericMap<V> : Map<String, V>
@@ -1,3 +1,6 @@
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
class DGenericIterator<T>(d: Iterator<T>) : Iterator<T> by d class DGenericIterator<T>(d: Iterator<T>) : Iterator<T> by d
class DGenericListIterator<T>(d: ListIterator<T>) : ListIterator<T> by d class DGenericListIterator<T>(d: ListIterator<T>) : ListIterator<T> by d
@@ -1,3 +1,6 @@
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
class DStringIterator(d: Iterator<String>) : Iterator<String> by d class DStringIterator(d: Iterator<String>) : Iterator<String> by d
class DStringListIterator(d: ListIterator<String>) : ListIterator<String> by d class DStringListIterator(d: ListIterator<String>) : ListIterator<String> by d
@@ -1,4 +1,8 @@
// FULL_JDK // FULL_JDK
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57269 K2: collection stub for `sort` is not generated for custom List subclasses
class DStringIterator(d: Iterator<String>) : Iterator<String> by d class DStringIterator(d: Iterator<String>) : Iterator<String> by d
class DStringListIterator(d: ListIterator<String>) : ListIterator<String> by d class DStringListIterator(d: ListIterator<String>) : ListIterator<String> by d
@@ -1,3 +1,6 @@
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
class DIntIterator(d: Iterator<Int>) : Iterator<Int> by d class DIntIterator(d: Iterator<Int>) : Iterator<Int> by d
class DIntListIterator(d: ListIterator<Int>) : ListIterator<Int> by d class DIntListIterator(d: ListIterator<Int>) : ListIterator<Int> by d
@@ -1,6 +1,9 @@
// FULL_JDK // FULL_JDK
// See also: https://youtrack.jetbrains.com/issue/KT-42330 // See also: https://youtrack.jetbrains.com/issue/KT-42330
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57269 K2: collection stub for `sort` is not generated for custom List subclasses
class DIntIterator(d: Iterator<Int>) : Iterator<Int> by d class DIntIterator(d: Iterator<Int>) : Iterator<Int> by d
class DIntListIterator(d: ListIterator<Int>) : ListIterator<Int> by d class DIntListIterator(d: ListIterator<Int>) : ListIterator<Int> by d
@@ -1,4 +1,8 @@
// FULL_JDK // FULL_JDK
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57269 K2: collection stub for `sort` is not generated for custom List subclasses
class DGenericIterator<T>(d: Iterator<T>) : Iterator<T> by d class DGenericIterator<T>(d: Iterator<T>) : Iterator<T> by d
class DGenericListIterator<T>(d: ListIterator<T>) : ListIterator<T> by d class DGenericListIterator<T>(d: ListIterator<T>) : ListIterator<T> by d
@@ -1,6 +1,9 @@
// FULL_JDK // FULL_JDK
// See: KT-42114, KT-42115 // See: KT-42114, KT-42115
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57269 K2: collection stub for `sort` is not generated for custom List subclasses
abstract class AbstractIterator : Iterator<String> abstract class AbstractIterator : Iterator<String>
abstract class AbstractIterable : Iterable<String> abstract class AbstractIterable : Iterable<String>
@@ -1,3 +1,6 @@
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57299 K2: VerifyError due to overriding final method `size` on a subclass of Collection and Set
abstract class AC<X> : Collection<X> abstract class AC<X> : Collection<X>
abstract class ASet<T> : AC<T>(), Set<T> abstract class ASet<T> : AC<T>(), Set<T>
@@ -1,5 +1,8 @@
// WITH_STDLIB // WITH_STDLIB
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57300 K2: subclass of MutableCollection with primitive element type has methods with boxed type
abstract class AIterD : AbstractIterator<Double>() abstract class AIterD : AbstractIterator<Double>()
abstract class ACollD : AbstractCollection<Double>() abstract class ACollD : AbstractCollection<Double>()
@@ -11,4 +14,3 @@ abstract class ASetD : AbstractSet<Double>()
abstract class AMSetD : AbstractMutableSet<Double>() abstract class AMSetD : AbstractMutableSet<Double>()
abstract class AListD : AbstractList<Double>() abstract class AListD : AbstractList<Double>()
@@ -1,5 +1,11 @@
// WITH_STDLIB // WITH_STDLIB
// IGNORE_BACKEND_K2: JVM_IR
// FIR status:
// 1) KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
// 2) KT-57300 K2: subclass of MutableCollection with primitive element type has methods with boxed type
// (`containsValue(Ljava/lang/Double;)Z` instead of `containsValue(D)Z`)
abstract class AMapSD : AbstractMap<String, Double>() abstract class AMapSD : AbstractMap<String, Double>()
abstract class AMMapSD : AbstractMutableMap<String, Double>() abstract class AMMapSD : AbstractMutableMap<String, Double>()
@@ -1,5 +1,8 @@
// WITH_STDLIB // WITH_STDLIB
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57300 K2: subclass of MutableCollection with primitive element type has methods with boxed type
abstract class AMListD : AbstractMutableList<Double>() abstract class AMListD : AbstractMutableList<Double>()
abstract class AMListI : AbstractMutableList<Int>() abstract class AMListI : AbstractMutableList<Int>()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_K2: JVM_IR
// FULL_JDK // FULL_JDK
import java.util.concurrent.* import java.util.concurrent.*
@@ -1,6 +1,9 @@
// Ensure the proper collection stubs are added, in // Ensure the proper collection stubs are added, in
// particular *not* when specialized implementations are provided. // particular *not* when specialized implementations are provided.
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
class MyMap<K, V> : Map<K, V> { class MyMap<K, V> : Map<K, V> {
class MySet<E> : Set<E> { class MySet<E> : Set<E> {
@@ -1,5 +1,8 @@
// See KT-42033 // See KT-42033
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
interface ObservableMap<K, V> : Map<K, V> interface ObservableMap<K, V> : Map<K, V>
abstract class ObservableMutableMap<K, V> : ObservableMap<K, V> { abstract class ObservableMutableMap<K, V> : ObservableMap<K, V> {
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers // !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR // TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
class Outer { class Outer {
val x: Int = 1 val x: Int = 1
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers // !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR // TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
interface Canvas { interface Canvas {
val suffix: String val suffix: String
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers // !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR // TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
data class Pair<A, B>(val first: A, val second: B) data class Pair<A, B>(val first: A, val second: B)
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers // !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR // TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
class View { class View {
val coefficient = 42 val coefficient = 42
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers // !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR // TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
class Param class Param
class O { class O {
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers // !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR // TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
// WITH_STDLIB // WITH_STDLIB
interface Semigroup<T> { interface Semigroup<T> {
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers // !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR // TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
class C { class C {
val c = 42 val c = 42
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers // !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR // TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
interface A { interface A {
fun a(): Int fun a(): Int
@@ -1,5 +1,8 @@
// !LANGUAGE: +SuspendConversion // !LANGUAGE: +SuspendConversion
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57244 K2: slightly different naming scheme for suspend conversion adapters
fun myApply(f: suspend () -> Unit) {} fun myApply(f: suspend () -> Unit) {}
fun test(f: () -> Unit) { fun test(f: () -> Unit) {
@@ -1,4 +1,6 @@
// WITH_STDLIB // WITH_STDLIB
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57216 K2: non-trivial enum declaration does not have ACC_FINAL in the bytecode
enum class Test { enum class Test {
@Deprecated("") ENTRY1, @Deprecated("") ENTRY1,
@@ -1,3 +1,6 @@
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57228 K2: annotations for interface member properties implemented by delegation are copied
interface IFoo { interface IFoo {
@Deprecated("") @Deprecated("")
val prop: String get() = "" val prop: String get() = ""
+3
View File
@@ -1,3 +1,6 @@
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57216 K2: non-trivial enum declaration does not have ACC_FINAL in the bytecode
enum class SimpleEnum { enum class SimpleEnum {
A, B, C A, B, C
} }
@@ -3,6 +3,9 @@
// FULL_JDK // FULL_JDK
// WITH_STDLIB // WITH_STDLIB
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57216 K2: non-trivial enum declaration does not have ACC_FINAL in the bytecode
enum class SimpleEnum { enum class SimpleEnum {
A, B, C A, B, C
} }
@@ -1,6 +1,9 @@
// !LANGUAGE: +InlineClasses // !LANGUAGE: +InlineClasses
// WITH_STDLIB // WITH_STDLIB
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57211 K2: incorrect "error: an annotation argument must be a compile-time constant" on unsigned array in annotation argument
annotation class Ann( annotation class Ann(
val u: UInt, val u: UInt,
val uba: UByteArray, val uba: UByteArray,
@@ -1,4 +1,6 @@
// !LANGUAGE: +InlineClasses // !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57216 K2: non-trivial enum declaration does not have ACC_FINAL in the bytecode
inline class Z(val x: Int) inline class Z(val x: Int)
@@ -1,5 +1,9 @@
// IGNORE_ANNOTATIONS // IGNORE_ANNOTATIONS
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
// (in this case, it's `getOrDefault-impl` because of inline class mangling, and then `remove` is unmangled for some reason)
inline class InlineMap<K, V>(private val map: Map<K, V>) : Map<K, V> { inline class InlineMap<K, V>(private val map: Map<K, V>) : Map<K, V> {
override val entries: Set<Map.Entry<K, V>> get() = map.entries override val entries: Set<Map.Entry<K, V>> get() = map.entries
override val keys: Set<K> get() = map.keys override val keys: Set<K> get() = map.keys
@@ -10,4 +14,3 @@ inline class InlineMap<K, V>(private val map: Map<K, V>) : Map<K, V> {
override fun get(key: K): V? = map[key] override fun get(key: K): V? = map[key]
override fun isEmpty(): Boolean = map.isEmpty() override fun isEmpty(): Boolean = map.isEmpty()
} }
@@ -1,5 +1,9 @@
// IGNORE_ANNOTATIONS // IGNORE_ANNOTATIONS
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
// (in this case, it's `remove-impl`/`getOrDefault-impl` because of inline class mangling)
inline class InlineMutableMap<K, V>(private val mmap: MutableMap<K, V>) : MutableMap<K, V> { inline class InlineMutableMap<K, V>(private val mmap: MutableMap<K, V>) : MutableMap<K, V> {
override val size: Int get() = mmap.size override val size: Int get() = mmap.size
override fun containsKey(key: K): Boolean = mmap.containsKey(key) override fun containsKey(key: K): Boolean = mmap.containsKey(key)
@@ -14,4 +18,3 @@ inline class InlineMutableMap<K, V>(private val mmap: MutableMap<K, V>) : Mutabl
override fun putAll(from: Map<out K, V>) { mmap.putAll(from) } override fun putAll(from: Map<out K, V>) { mmap.putAll(from) }
override fun remove(key: K): V? = mmap.remove(key) override fun remove(key: K): V? = mmap.remove(key)
} }
@@ -1,5 +1,9 @@
// IGNORE_ANNOTATIONS // IGNORE_ANNOTATIONS
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
// (in this case, it's `getOrDefault-h8vw2VU` because of inline class mangling, and then `remove` is unmangled for some reason)
inline class IK(val x: Int) inline class IK(val x: Int)
inline class IV(val x: Double) inline class IV(val x: Double)
@@ -13,4 +17,3 @@ inline class InlineMap(private val map: Map<IK, IV>) : Map<IK, IV> {
override fun get(key: IK): IV? = map[key] override fun get(key: IK): IV? = map[key]
override fun isEmpty(): Boolean = map.isEmpty() override fun isEmpty(): Boolean = map.isEmpty()
} }
@@ -1,5 +1,9 @@
// IGNORE_ANNOTATIONS // IGNORE_ANNOTATIONS
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
// (in this case, it's `remove-YEowaJk`/`getOrDefault-h8vw2VU` because of inline class mangling)
inline class IK(val x: Int) inline class IK(val x: Int)
inline class IV(val x: Double) inline class IV(val x: Double)
@@ -17,4 +21,3 @@ inline class InlineMutableMap(private val mmap: MutableMap<IK, IV>) : MutableMap
override fun putAll(from: Map<out IK, IV>) { mmap.putAll(from) } override fun putAll(from: Map<out IK, IV>) { mmap.putAll(from) }
override fun remove(key: IK): IV? = mmap.remove(key) override fun remove(key: IK): IV? = mmap.remove(key)
} }
+5
View File
@@ -1,3 +1,8 @@
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: delegated implementation for `foo` is generated in `C`, which makes this code execute fine at runtime.
// For K1, invoking `C.foo` leads to AbstractMethodError, see KT-46120.
// Probably there should be a frontend error. (But if not, then K2 is correct.)
// FILE: kt45934.kt // FILE: kt45934.kt
class C(client: J) : I by client class C(client: J) : I by client
@@ -3,6 +3,9 @@
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// WITH_STDLIB // WITH_STDLIB
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: K2 incorrectly generates Anno.class, need to investigate after KT-57243 is fixed.
@file:Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE") // TODO: support common sources in the test infrastructure @file:Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE") // TODO: support common sources in the test infrastructure
@OptionalExpectation @OptionalExpectation
@@ -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 X
interface Z interface Z
@@ -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'
}
@@ -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 X: U, W
interface Z: U, W interface Z: U, W
@@ -1,5 +1,8 @@
// !LANGUAGE: -AllowSealedInheritorsInDifferentFilesOfSamePackage // !LANGUAGE: -AllowSealedInheritorsInDifferentFilesOfSamePackage
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: don't support legacy feature
sealed class TestNoSubclasses(val x: Int) sealed class TestNoSubclasses(val x: Int)
sealed class TestSubclassAfter(val x: Int) sealed class TestSubclassAfter(val x: Int)
@@ -1,5 +1,8 @@
// WITH_STDLIB // WITH_STDLIB
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
open class A : HashMap<String, String>() open class A : HashMap<String, String>()
class B : A() class B : A()
@@ -1,6 +1,9 @@
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FULL_JDK // FULL_JDK
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57301 K2: `getOrDefault` and bridges are not generated for certain Map subclasses
// FILE: kt48945.kt // FILE: kt48945.kt
interface MSS : Map<String, String> interface MSS : Map<String, String>
interface GM<K, V> : Map<K, V> interface GM<K, V> : Map<K, V>
@@ -1,5 +1,8 @@
// WITH_SIGNATURES // WITH_SIGNATURES
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
interface MapN<K : Number, V> : Map<K, V> interface MapN<K : Number, V> : Map<K, V>
abstract class MapImpl<A, B> : Map<A, B> { abstract class MapImpl<A, B> : Map<A, B> {
@@ -2,6 +2,9 @@
// WITH_STDLIB // WITH_STDLIB
// FULL_JDK // FULL_JDK
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57301 K2: `getOrDefault` and bridges are not generated for certain Map subclasses
abstract class AMap1<K1, V1>(private val m: Map<K1, V1>) : Map<K1, V1> by m abstract class AMap1<K1, V1>(private val m: Map<K1, V1>) : Map<K1, V1> by m
interface Value2 interface Value2
@@ -469,6 +469,12 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
runTest("compiler/testData/codegen/bytecodeListing/annotations/repeatable/nonRepeatedAnnotationWithItsContainer.kt"); runTest("compiler/testData/codegen/bytecodeListing/annotations/repeatable/nonRepeatedAnnotationWithItsContainer.kt");
} }
@Test
@TestMetadata("propertyGetterSeveralUseSiteTargets.kt")
public void testPropertyGetterSeveralUseSiteTargets() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/annotations/repeatable/propertyGetterSeveralUseSiteTargets.kt");
}
@Test @Test
@TestMetadata("propertyGetterUseSiteTarget.kt") @TestMetadata("propertyGetterUseSiteTarget.kt")
public void testPropertyGetterUseSiteTarget() throws Exception { public void testPropertyGetterUseSiteTarget() throws Exception {
@@ -313,6 +313,14 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
testClass<AbstractFirPsiSerializeCompileKotlinAgainstInlineKotlinTest> { testClass<AbstractFirPsiSerializeCompileKotlinAgainstInlineKotlinTest> {
model("codegen/boxInline") model("codegen/boxInline")
} }
testClass<AbstractFirPsiBytecodeListingTest> {
model("codegen/bytecodeListing")
}
testClass<AbstractFirLightTreeBytecodeListingTest> {
model("codegen/bytecodeListing")
}
} }
testGroup(testsRoot = "compiler/fir/fir2ir/tests-gen", testDataRoot = "compiler/fir/fir2ir/testData") { testGroup(testsRoot = "compiler/fir/fir2ir/tests-gen", testDataRoot = "compiler/fir/fir2ir/testData") {