blob: cbf5a7eb4a212145ff6ad5d247d13cd606b1c6c1 [file]
// RUN_PIPELINE_TILL: FRONTEND
// DIAGNOSTICS: -USELESS_ELVIS
// ISSUE: KT-44705
fun test_1(x: String?, y: String?) {
while (true) {
x ?: <!INVALID_IF_AS_EXPRESSION!>if<!> (y == null) break
}
}
fun test_2(x: String?, y: String?) {
while (true) {
val z = x ?: <!INVALID_IF_AS_EXPRESSION!>if<!> (y == null) break
}
}
fun test_3(x: String?, y: String?) {
while (true) {
x ?: <!NO_ELSE_IN_WHEN!>when<!> { true -> break }
x ?: <!NO_ELSE_IN_WHEN!>when<!> (y) { "hello" -> break }
}
}
fun test_4(x: String?, y: String?) {
while (true) {
val a = x ?: <!NO_ELSE_IN_WHEN!>when<!> { true -> break }
val b = x ?: <!NO_ELSE_IN_WHEN!>when<!> (y) { "hello" -> break }
}
}
/* GENERATED_FIR_TAGS: break, elvisExpression, equalityExpression, functionDeclaration, ifExpression, localProperty,
nullableType, propertyDeclaration, smartcast, stringLiteral, whenExpression, whenWithSubject, whileLoop */