Move IR interpreter's tests from ir/loweredIr directory into box
This commit is contained in:
-35
@@ -1,35 +0,0 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// WITH_STDLIB
|
||||
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
|
||||
object A {
|
||||
@JvmStatic
|
||||
val somePropertyFromObject: Int = 0
|
||||
|
||||
@JvmStatic
|
||||
fun someFunctionFromObject(str: String): String = str
|
||||
}
|
||||
|
||||
class B {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val somePropertyFromCompanionObject: Int = 0
|
||||
|
||||
@JvmStatic
|
||||
fun someFunctionFromCompanionObject(str: String): String = str
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
|
||||
fun box(): String {
|
||||
// `name` call must be optimized with `ConstEvaluationLowering`
|
||||
if (A::somePropertyFromObject.name != "somePropertyFromObject") return "Fail 1"
|
||||
if (A::someFunctionFromObject.name != "someFunctionFromObject") return "Fail 2"
|
||||
if (B.Companion::somePropertyFromCompanionObject.name != "somePropertyFromCompanionObject") return "Fail 3"
|
||||
if (B.Companion::someFunctionFromCompanionObject.name != "someFunctionFromCompanionObject") return "Fail 4"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
object K : Code("K")
|
||||
|
||||
open class Code(val x: String) {
|
||||
override fun toString() = "$x"
|
||||
}
|
||||
|
||||
class O {
|
||||
companion object: Code("O")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return "$O" + "$K" // must not be evaluated during compile time
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// WITH_STDLIB
|
||||
|
||||
object Test {
|
||||
fun foo(): String = "foo " + this
|
||||
|
||||
fun bar(): String = "bar $this"
|
||||
|
||||
fun baz(): String = "baz " + this.toString()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (!Test.foo().startsWith("foo ")) return "Fail ${Test.foo()}"
|
||||
if (!Test.bar().startsWith("bar ")) return "Fail ${Test.bar()}"
|
||||
if (!Test.baz().startsWith("baz ")) return "Fail ${Test.baz()}"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user