[FE 1.0] Fix false-negative INVALID_IF_AS_EXPRESSION_WARNING and NO_ELSE_IN_WHEN_WARNING

^KT-51711 Fixed
This commit is contained in:
Dmitriy Novozhilov
2022-03-28 10:37:38 +04:00
committed by teamcity
parent c67c1a69b9
commit 565c61a702
7 changed files with 63 additions and 8 deletions
@@ -0,0 +1,22 @@
// FIR_IDENTICAL
// LANGUAGE: -ProhibitNonExhaustiveIfInRhsOfElvis
// ISSUE: KT-51711
// WITH_STDLIB
private fun fake(a: String?) {}
fun test_1(x: String?, y: String?) {
while (true) {
x ?: if (y == null) break else fake(y)
}
}
fun test_2(x: String?, y: String?) {
while (true) {
x ?: when {
true -> break
else -> y?.filter { it.isLowerCase() }
}
}
}
@@ -0,0 +1,5 @@
package
private fun fake(/*0*/ a: kotlin.String?): kotlin.Unit
public fun test_1(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.String?): kotlin.Unit
public fun test_2(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.String?): kotlin.Unit