Files
kotlin-fork/compiler/testData/diagnostics/tests/controlStructures/kt4310.kt
T
Dmitry Petrov 1a3a296827 KT-10139: any if without else used in expression is an error
regardless of expected type: it can't be an expression, even of type Unit.

 #KT-10139 Fixed
2015-12-01 10:36:40 +03:00

11 lines
187 B
Kotlin
Vendored

package f
fun test(a: Boolean, b: Boolean): Int {
return if(a) {
1
} else {
<!TYPE_MISMATCH, INVALID_IF_AS_EXPRESSION!>if (b) {
3
}<!>
}
}