[FE 1.0] Check for type mismatch for empty when statements

^KT-47922 Fixed
This commit is contained in:
Dmitriy Novozhilov
2021-08-04 13:16:04 +03:00
committed by TeamCityServer
parent 60195114c1
commit 8578f0beea
24 changed files with 487 additions and 22 deletions
@@ -0,0 +1,11 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
sealed class Sealed {
}
fun foo(s: Sealed): Int {
return <!NO_ELSE_IN_WHEN!>when<!>(s) {
// We do not return anything, so else branch must be here
}
}
@@ -1,12 +1,11 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_EXPRESSION
sealed class Sealed {
}
fun foo(s: Sealed): Int {
return <!NO_ELSE_IN_WHEN!>when<!>(s) {
return <!TYPE_MISMATCH!><!NO_ELSE_IN_WHEN!>when<!>(s) {
// We do not return anything, so else branch must be here
}
}<!>
}