K2: add bytecode listing tests
#KT-57171 Fixed
This commit is contained in:
+2543
File diff suppressed because it is too large
Load Diff
+2543
File diff suppressed because it is too large
Load Diff
+4
-1
@@ -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 {
|
||||||
@@ -7,4 +10,4 @@ interface IFoo {
|
|||||||
@Ann fun String.testExtFun()
|
@Ann fun String.testExtFun()
|
||||||
}
|
}
|
||||||
|
|
||||||
class DFoo(d: IFoo) : IFoo by d
|
class DFoo(d: IFoo) : IFoo by d
|
||||||
|
|||||||
+18
@@ -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
|
||||||
+25
@@ -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
|
||||||
|
}
|
||||||
Vendored
+4
-2
@@ -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> {
|
||||||
|
|||||||
Vendored
+3
@@ -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>
|
||||||
|
|||||||
Vendored
+3
@@ -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>
|
||||||
|
|||||||
compiler/testData/codegen/bytecodeListing/collectionStubs/abstractStubSignatures/genericStringMap.kt
Vendored
+3
@@ -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>
|
||||||
|
|||||||
Vendored
+4
-1
@@ -1,3 +1,6 @@
|
|||||||
// WITH_SIGNATURES
|
// WITH_SIGNATURES
|
||||||
|
|
||||||
abstract class NumberStringMap : Map<Number, String>
|
// 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>
|
||||||
|
|||||||
+4
-1
@@ -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>()
|
||||||
|
|||||||
compiler/testData/codegen/bytecodeListing/collectionStubs/abstractStubSignatures/stringGenericMap.kt
Vendored
+3
@@ -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>
|
||||||
|
|||||||
+4
-1
@@ -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
|
||||||
@@ -16,4 +19,4 @@ class DGenericMapEntry<K, V>(d: Map.Entry<K, V>) : Map.Entry<K, V> by d
|
|||||||
|
|
||||||
class DGenericCollectionBySet<T>(d: Set<T>) : Collection<T> by d
|
class DGenericCollectionBySet<T>(d: Set<T>) : Collection<T> by d
|
||||||
|
|
||||||
class DGenericCollectionByList<T>(d: List<T>) : Collection<T> by d
|
class DGenericCollectionByList<T>(d: List<T>) : Collection<T> by d
|
||||||
|
|||||||
+4
-1
@@ -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
|
||||||
@@ -16,4 +19,4 @@ class DStringMapEntry(d: Map.Entry<String, Number>) : Map.Entry<String, Number>
|
|||||||
|
|
||||||
class DStringCollectionBySet(d: Set<String>) : Collection<String> by d
|
class DStringCollectionBySet(d: Set<String>) : Collection<String> by d
|
||||||
|
|
||||||
class DStringCollectionByList(d: List<String>) : Collection<String> by d
|
class DStringCollectionByList(d: List<String>) : Collection<String> by d
|
||||||
|
|||||||
Vendored
+5
-1
@@ -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
|
||||||
@@ -17,4 +21,4 @@ class DStringMapEntry(d: Map.Entry<String, Number>) : Map.Entry<String, Number>
|
|||||||
|
|
||||||
class DStringCollectionBySet(d: Set<String>) : Collection<String> by d
|
class DStringCollectionBySet(d: Set<String>) : Collection<String> by d
|
||||||
|
|
||||||
class DStringCollectionByList(d: List<String>) : Collection<String> by d
|
class DStringCollectionByList(d: List<String>) : Collection<String> by d
|
||||||
|
|||||||
+4
-1
@@ -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
|
||||||
@@ -16,4 +19,4 @@ class DIntMapEntry(d: Map.Entry<Int, Double>) : Map.Entry<Int, Double> by d
|
|||||||
|
|
||||||
class DIntCollectionBySet(d: Set<Int>) : Collection<Int> by d
|
class DIntCollectionBySet(d: Set<Int>) : Collection<Int> by d
|
||||||
|
|
||||||
class DIntCollectionByList(d: List<Int>) : Collection<Int> by d
|
class DIntCollectionByList(d: List<Int>) : Collection<Int> by d
|
||||||
|
|||||||
Vendored
+4
-1
@@ -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
|
||||||
@@ -19,4 +22,4 @@ class DIntMapEntry(d: Map.Entry<Int, Double>) : Map.Entry<Int, Double> by d
|
|||||||
|
|
||||||
class DIntCollectionBySet(d: Set<Int>) : Collection<Int> by d
|
class DIntCollectionBySet(d: Set<Int>) : Collection<Int> by d
|
||||||
|
|
||||||
class DIntCollectionByList(d: List<Int>) : Collection<Int> by d
|
class DIntCollectionByList(d: List<Int>) : Collection<Int> by d
|
||||||
|
|||||||
Vendored
+5
-1
@@ -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
|
||||||
@@ -17,4 +21,4 @@ class DGenericMapEntry<K, V>(d: Map.Entry<K, V>) : Map.Entry<K, V> by d
|
|||||||
|
|
||||||
class DGenericCollectionBySet<T>(d: Set<T>) : Collection<T> by d
|
class DGenericCollectionBySet<T>(d: Set<T>) : Collection<T> by d
|
||||||
|
|
||||||
class DGenericCollectionByList<T>(d: List<T>) : Collection<T> by d
|
class DGenericCollectionByList<T>(d: List<T>) : Collection<T> by d
|
||||||
|
|||||||
+3
@@ -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>
|
||||||
|
|||||||
+4
-1
@@ -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>
|
||||||
|
|||||||
Vendored
+3
-1
@@ -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>()
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -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>()
|
||||||
|
|||||||
Vendored
+3
@@ -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.*
|
||||||
@@ -11,4 +10,4 @@ class Test1 : Iterable<String> {
|
|||||||
class Test2 : Iterable<String> {
|
class Test2 : Iterable<String> {
|
||||||
private val received = Array<String>(0) { "" }
|
private val received = Array<String>(0) { "" }
|
||||||
override fun iterator() = received.iterator()
|
override fun iterator() = received.iterator()
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -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> {
|
||||||
@@ -20,4 +23,4 @@ class MyMap<K, V> : Map<K, V> {
|
|||||||
override fun containsValue(value: V): Boolean = TODO()
|
override fun containsValue(value: V): Boolean = TODO()
|
||||||
override fun get(key: K): V = TODO()
|
override fun get(key: K): V = TODO()
|
||||||
override fun isEmpty(): Boolean = TODO()
|
override fun isEmpty(): Boolean = TODO()
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -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> {
|
||||||
@@ -9,4 +12,4 @@ abstract class ObservableMutableMap<K, V> : ObservableMap<K, V> {
|
|||||||
|
|
||||||
fun putAll(from: Map<out K, V>) {
|
fun putAll(from: Map<out 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
|
||||||
@@ -16,4 +14,4 @@ fun f(outer: Outer) {
|
|||||||
with(outer) {
|
with(outer) {
|
||||||
Inner(3)
|
Inner(3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -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
|
||||||
@@ -19,4 +17,4 @@ class Circle : Shape {
|
|||||||
|
|
||||||
object MyCanvas : Canvas {
|
object MyCanvas : Canvas {
|
||||||
override val suffix = ""
|
override val suffix = ""
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -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)
|
||||||
|
|
||||||
@@ -9,4 +7,4 @@ context(Comparator<T>)
|
|||||||
infix operator fun <T> T.compareTo(other: T) = compare(this, other)
|
infix operator fun <T> T.compareTo(other: T) = compare(this, other)
|
||||||
|
|
||||||
context(Comparator<T>)
|
context(Comparator<T>)
|
||||||
val <T> Pair<T, T>.min get() = if (first < second) first else second
|
val <T> Pair<T, T>.min get() = if (first < second) first else second
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
// !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
|
||||||
}
|
}
|
||||||
|
|
||||||
context(View) val Int.dp get() = coefficient * this
|
context(View) val Int.dp get() = coefficient * this
|
||||||
|
|||||||
+1
-3
@@ -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 {
|
||||||
@@ -12,4 +10,4 @@ class K {
|
|||||||
}
|
}
|
||||||
|
|
||||||
context(O)
|
context(O)
|
||||||
fun <T> K.f(g: context(O) K.(Param) -> T) = g(this@O, this@K, Param())
|
fun <T> K.f(g: context(O) K.(Param) -> T) = g(this@O, this@K, Param())
|
||||||
|
|||||||
+1
-3
@@ -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> {
|
||||||
@@ -21,4 +19,4 @@ object StringMonoid : Monoid<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
context(Monoid<T>)
|
context(Monoid<T>)
|
||||||
fun <T> List<T>.sum(): T = fold(unit) { acc, e -> acc.combine(e) }
|
fun <T> List<T>.sum(): T = fold(unit) { acc, e -> acc.combine(e) }
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -16,4 +14,4 @@ fun bar(c: C) {
|
|||||||
with(c) {
|
with(c) {
|
||||||
foo()
|
foo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -11,4 +9,4 @@ interface B {
|
|||||||
}
|
}
|
||||||
|
|
||||||
context(A, B)
|
context(A, B)
|
||||||
val c get() = a() + b()
|
val c get() = a() + b()
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
+2
@@ -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,
|
||||||
|
|||||||
+4
-1
@@ -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() = ""
|
||||||
@@ -24,4 +27,4 @@ class ExplicitOverride : IFoo {
|
|||||||
class ExplicitOverride2 : IFoo2 {
|
class ExplicitOverride2 : IFoo2 {
|
||||||
override val prop: String get() = ""
|
override val prop: String get() = ""
|
||||||
override val String.extProp: String get() = ""
|
override val String.extProp: String get() = ""
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -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
|
||||||
}
|
}
|
||||||
@@ -18,4 +21,4 @@ annotation class Ann
|
|||||||
|
|
||||||
enum class WithAnnotations {
|
enum class WithAnnotations {
|
||||||
@Ann A, @Ann B
|
@Ann A, @Ann B
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -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,
|
||||||
@@ -16,4 +19,4 @@ annotation class Ann(
|
|||||||
[1u, 1u],
|
[1u, 1u],
|
||||||
ulongArrayOf(1u, 1u)
|
ulongArrayOf(1u, 1u)
|
||||||
)
|
)
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
|
|||||||
Vendored
+3
-1
@@ -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)
|
||||||
|
|
||||||
@@ -23,4 +25,4 @@ enum class TestEnum(val z: Z) {
|
|||||||
|
|
||||||
class TestInner {
|
class TestInner {
|
||||||
inner class Inner(val z: Z)
|
inner class Inner(val z: Z)
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-1
@@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-1
@@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
@@ -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
|
||||||
|
|||||||
+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 X
|
||||||
interface Z
|
interface Z
|
||||||
|
|
||||||
@@ -17,4 +20,4 @@ class G<T> where T: X, T: Z {
|
|||||||
fun test() {
|
fun test() {
|
||||||
val g = sel(G<A>(), G<B>()) // g: G<out { X & Z }>
|
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)
|
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 X: U, W
|
||||||
interface Z: U, W
|
interface Z: U, W
|
||||||
|
|
||||||
@@ -20,4 +23,4 @@ class G<T> where T: U, T: W {
|
|||||||
fun test() {
|
fun test() {
|
||||||
val g = sel(G<A>(), G<B>())
|
val g = sel(G<A>(), G<B>())
|
||||||
g.check {} // TODO: report a compile time error for this case
|
g.check {} // TODO: report a compile time error for this case
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -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)
|
||||||
@@ -11,4 +14,4 @@ sealed class TestSubclassAfterAllDefaults(val x: Int = 0)
|
|||||||
class X3 : TestSubclassAfterAllDefaults()
|
class X3 : TestSubclassAfterAllDefaults()
|
||||||
|
|
||||||
class X4: TestSubclassBefore(1)
|
class X4: TestSubclassBefore(1)
|
||||||
sealed class TestSubclassBefore(val x: Int)
|
sealed class TestSubclassBefore(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>
|
||||||
|
|||||||
+4
-1
@@ -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> {
|
||||||
@@ -12,4 +15,4 @@ abstract class MapSImpl<B> : Map<String, B> {
|
|||||||
|
|
||||||
abstract class MapNImpl<A : Number, B> : MapN<A, B> {
|
abstract class MapNImpl<A : Number, B> : MapN<A, B> {
|
||||||
override fun containsKey(key: A): Boolean = false
|
override fun containsKey(key: A): Boolean = false
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -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
|
||||||
|
|||||||
+6
@@ -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 {
|
||||||
|
|||||||
+8
@@ -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") {
|
||||||
|
|||||||
Reference in New Issue
Block a user