Files
kotlin-fork/js/js.translator/testData/box/char/charInStringTemplate.kt
T
Alexey Andreev 3b3fd0fa0d JS: fix DCE limits in test data to fit new kotlin.js size
The size has increased due to new implementation of KClass
2017-10-06 18:16:51 +03:00

25 lines
618 B
Kotlin
Vendored

// EXPECTED_REACHABLE_NODES: 1114
package foo
var log = ""
fun sideEffects(c: Char?, msg: String): Char? {
log += msg
return c
}
fun box(): String {
val name = run { "John" } // Force compiler to actually do some concatenation
assertEquals("${'$'}name = $name", "\$name = John")
val ch1: Char? = null
assertEquals("${ch1}name = $name", "nullname = John")
val ch2: Char? = '$'
assertEquals("${ch2}name = $name", "\$name = John")
assertEquals("${sideEffects('$', "1")!!}${sideEffects('n', "2")}ame = $name", "\$name = John")
assertEquals(log, "12")
return "OK"
}