Add some tests for inference and DFA of try/catch/finally

This commit is contained in:
Dmitriy Novozhilov
2019-02-17 12:15:27 +03:00
parent 8d3271cc68
commit 4e64b07727
16 changed files with 865 additions and 0 deletions
@@ -0,0 +1,34 @@
// !WITH_NEW_INFERENCE
class ExcA : Exception()
class ExcB(val map: Map<Int, Int>) : Exception()
fun test0(): List<Int> = run {
try {
emptyList()
} finally {
<!UNUSED_EXPRESSION!>""<!>
fun foo() {}
}
}
fun test1(): Map<Int, Int> = <!NI;TYPE_MISMATCH!>run {
<!NI;TYPE_MISMATCH!>try {
emptyMap()
} catch (e: ExcA) {
emptyMap()
} catch (e: ExcB) {
e.map
} finally {
<!UNUSED_EXPRESSION!>""<!>
}<!>
}<!>
fun test2(): Map<Int, Int> = <!NI;TYPE_MISMATCH!>run {
<!NI;TYPE_MISMATCH!>try {
emptyMap()
} catch (e: ExcA) {
<!OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>mapOf("" to "")<!>
}<!>
}<!>