// LANGUAGE: -ProhibitNonExhaustiveIfInRhsOfElvis // DIAGNOSTICS: -USELESS_ELVIS // ISSUE: KT-44705 fun test_1(x: String?, y: String?) { while (true) { x ?: if (y == null) break } } fun test_2(x: String?, y: String?) { while (true) { val z = x ?: if (y == null) break } } fun test_3(x: String?, y: String?) { while (true) { x ?: when { true -> break } x ?: when (y) { "hello" -> break } } } fun test_4(x: String?, y: String?) { while (true) { val a = x ?: when { true -> break } val b = x ?: when (y) { "hello" -> break } } }