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,7 +1,5 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
class Outer {
val x: Int = 1
@@ -16,4 +14,4 @@ fun f(outer: Outer) {
with(outer) {
Inner(3)
}
}
}
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
interface Canvas {
val suffix: String
@@ -19,4 +17,4 @@ class Circle : Shape {
object MyCanvas : Canvas {
override val suffix = ""
}
}
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
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)
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
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
class View {
val coefficient = 42
}
context(View) val Int.dp get() = coefficient * this
context(View) val Int.dp get() = coefficient * this
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
class Param
class O {
@@ -12,4 +10,4 @@ class K {
}
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,7 +1,5 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
// WITH_STDLIB
interface Semigroup<T> {
@@ -21,4 +19,4 @@ object StringMonoid : Monoid<String> {
}
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
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
class C {
val c = 42
@@ -16,4 +14,4 @@ fun bar(c: C) {
with(c) {
foo()
}
}
}
@@ -1,7 +1,5 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// IGNORE_BACKEND: JVM
interface A {
fun a(): Int
@@ -11,4 +9,4 @@ interface B {
}
context(A, B)
val c get() = a() + b()
val c get() = a() + b()