1ddcdcfc39
Basically we want to allow object interpretation only when we try to access some const val property. #KT-57810 Fixed
20 lines
576 B
Kotlin
Vendored
20 lines
576 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 = "<!EVALUATED("bar ")!>bar <!>$this"
|
|
|
|
fun baz(): String = "baz " + this.toString()
|
|
}
|
|
|
|
fun box(): String {
|
|
if (!Test.foo().startsWith("foo ")) return "<!EVALUATED("Fail ")!>Fail <!>${Test.foo()}"
|
|
if (!Test.bar().startsWith("bar ")) return "<!EVALUATED("Fail ")!>Fail <!>${Test.bar()}"
|
|
if (!Test.baz().startsWith("baz ")) return "<!EVALUATED("Fail ")!>Fail <!>${Test.baz()}"
|
|
return "OK"
|
|
}
|