// RUN_PIPELINE_TILL: FRONTEND
/*
 * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
 *
 * SPEC VERSION: 0.1-152
 * PRIMARY LINKS: expressions, when-expression -> paragraph 2 -> sentence 1
 * expressions, when-expression -> paragraph 5 -> sentence 1
 * expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 1
 */

// DIAGNOSTICS: -UNUSED_PARAMETER

infix fun Any.sealed(a: Any?) {}

val x = 1 sealed when (1) {
    1 -> 1
    else -> 2
}

val x1 = 1 sealed /**/ when (1) {
    1 -> 1
    else -> 2
}

fun foo() {
    <!UNRESOLVED_REFERENCE!>sealed<!><!SYNTAX!><!> when {
        else -> {}
    }

    1 sealed when {
        else -> {}
    }

    1 sealed (when {
        else -> {}
    })

    1
    <!UNRESOLVED_REFERENCE!>sealed<!><!SYNTAX!><!> when {
        else -> {}
    }

    1 sealed
    when {
        else -> {}
    }
}

/* GENERATED_FIR_TAGS: equalityExpression, funWithExtensionReceiver, functionDeclaration, infix, integerLiteral,
nullableType, propertyDeclaration, whenExpression, whenWithSubject */
