Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/tryCatch/assignTry.fir.kt
T
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00

111 lines
1.4 KiB
Kotlin
Vendored

// SKIP_TXT
class ExcA : Exception()
class ExcB : Exception()
fun test2() {
val s: String? = <!INITIALIZER_TYPE_MISMATCH!>try {
""
}
catch (e: ExcA) {
null
}
catch (e: ExcB) {
10
}<!>
s<!UNSAFE_CALL!>.<!>length
}
fun test3() {
val s: String? = try {
""
}
catch (e: ExcA) {
null
}
catch (e: ExcB) {
return
}
s<!UNSAFE_CALL!>.<!>length
}
fun test4() {
val s: String? = try {
""
}
catch (e: ExcA) {
null
}
finally {
""
}
s<!UNSAFE_CALL!>.<!>length
}
fun test5() {
val s: String? = try {
""
}
catch (e: ExcA) {
null
}
finally {
return
}
s<!UNSAFE_CALL!>.<!>length
}
fun test6() {
val s: String? = try {
""
}
catch (e: ExcA) {
return
}
catch (e: ExcB) {
return
}
s<!UNSAFE_CALL!>.<!>length
}
fun test7() {
val s: String? = try {
""
}
catch (e: ExcA) {
""
}
catch (e: ExcB) {
""
}
s<!UNSAFE_CALL!>.<!>length
}
fun test8() {
val s = try {
""
} catch (e: ExcA) {
null
}
s<!UNSAFE_CALL!>.<!>length
}
fun test9() {
val s = try {
""
} catch (e: ExcA) {
""
}
s.length
}
fun test10() {
val x = try {
""
} finally {
42
}
x.length
}