Files
kotlin-fork/compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt
T
Ivan Kylchik 7cf9dda8dc [JS] Support evaluation of const intrinsics for K2
#KT-56023 Fixed
#KT-51582 Fixed
2023-03-24 15:55:04 +00:00

20 lines
477 B
Kotlin
Vendored

// TARGET_BACKEND: JVM_IR
// TARGET_BACKEND: NATIVE
// TARGET_BACKEND: JS_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"
}