Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/regressions/kt2838.kt
T
Svetlana Isakova 79cec6411d Mark only unreachable parts of element if it has reachable parts
like for 'return todo()' mark only 'return'
2014-06-21 12:26:33 +04:00

18 lines
401 B
Kotlin

// !DIAGNOSTICS: -UNREACHABLE_CODE
//KT-2838 Type inference failed on passing null as a nullable argument
package a
fun foo<T>(a: T, b: Map<T, String>?) = b?.get(a)
fun bar<T>(a: T, b: Map<T, String>) = b.get(a)
fun test(a: Int) {
foo(a, null)
bar(a, <!NULL_FOR_NONNULL_TYPE!>null<!>)
}
fun test1(a: Int) {
foo(a, throw Exception())
}
fun test2(a: Int) {
bar(a, throw Exception())
}