Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.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

35 lines
537 B
Kotlin
Vendored

// SKIP_TXT
class ExcA : Exception()
class ExcB(val map: Map<Int, Int>) : Exception()
fun test0(): List<Int> = run {
try {
emptyList()
} finally {
""
fun foo() {}
}
}
fun test1(): Map<Int, Int> = run {
try {
emptyMap()
} catch (e: ExcA) {
emptyMap()
} catch (e: ExcB) {
e.map
} finally {
""
}
}
fun test2(): Map<Int, Int> = run {
<!ARGUMENT_TYPE_MISMATCH!>try {
emptyMap()
} catch (e: ExcA) {
mapOf("" to "")
}<!>
}