Files
kotlin-fork/compiler/testData/codegen/box/finally/kt3894.kt
T
Alexander Udalov 3dcd85bdb4 Add toString() to Any, fix all tests
#KT-4517 Fixed
2014-03-02 19:54:49 +04:00

36 lines
550 B
Kotlin

class MyString {
var s = ""
fun plus(x : String) : MyString {
s += x
return this
}
override fun toString(): String {
return s
}
}
fun test1() : MyString {
var r = MyString()
while (true) {
try {
r + "Try"
if (true) {
r + "Break"
break
}
} finally {
return r + "Finally"
}
}
}
fun box(): String {
if (test1().toString() != "TryBreakFinally") return "fail1: ${test1().toString()}"
return "OK"
}