Files
kotlin-fork/compiler/testData/diagnostics/tests/when/whenWithNothingAndLambdas.kt
T
Pavel Kirpichenkov a9391c8dfb [NI] Remove Nothing result type restriction in most cases
Make Nothing as result type not suitable only for if, when, try and ?: special functions.
2019-12-25 14:59:05 +03:00

39 lines
917 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// NI_EXPECTED_FILE
val <!OI;IMPLICIT_NOTHING_PROPERTY_TYPE!>test1<!> = when {
true -> { <!OI;TYPE_MISMATCH!>{ true }<!> }
else -> TODO()
}
val test1a: () -> Boolean = when {
true -> { { true } }
else -> TODO()
}
val <!OI;IMPLICIT_NOTHING_PROPERTY_TYPE!>test2<!> = when {
true -> { <!OI;TYPE_MISMATCH!>{ true }<!> }
else -> when {
true -> { <!OI;TYPE_MISMATCH!>{ true }<!> }
else -> TODO()
}
}
val test2a: () -> Boolean = when {
true -> { { true } }
else -> when {
true -> { <!OI;TYPE_MISMATCH!>{ true }<!> } // TODO
else -> TODO()
}
}
val <!OI;IMPLICIT_NOTHING_PROPERTY_TYPE!>test3<!> = when {
true -> { <!OI;TYPE_MISMATCH!>{ true }<!> }
true -> { <!OI;TYPE_MISMATCH!>{ true }<!> }
else -> TODO()
}
val test3a: () -> Boolean = when {
true -> { { true } }
true -> { { true } }
else -> TODO()
}