Files
kotlin/compiler/testData/codegen/bytecodeText/componentEvaluatesOnlyOnce.kt
Alexander Udalov 620143ae5b Add test on bytecode text
Test data should be a Kotlin source file with zero or more comments e.g. of
the form: '// 1 INVOKEVIRTUAL'. The test then checks that the generated
bytecode for this file contains exactly one occurrence of the string
'INVOKEVIRTUAL'
2013-02-11 02:01:43 +04:00

20 lines
387 B
Kotlin
Vendored

class S(val a: String, val b: String) {
fun component1() : String = a
fun component2() : String = b
}
fun S.component3() = ((a + b) as java.lang.String).substring(2)
class Tester() {
fun box() : String {
val (o,k,ok,ok2) = S("O","K")
return o + k + ok + ok2
}
fun S.component4() = ((a + b) as java.lang.String).substring(2)
}
fun box() = Tester().box()
// 1 NEW S