// RUN_PIPELINE_TILL: BACKEND
// ISSUE: KT-51228

interface A {
    fun foo()
}

fun Any.test_1() {
    when(this) {
        is A -> {
            foo() // ok
            ::foo // UNRESOLVED_REFERENCE, should be ok
        }
        else -> throw Exception()
    }
}

fun Any.test_2() {
    when(this) {
        is A -> {
            foo(); // ok
            { foo() }
        }
        else -> {}
    }
}

fun Any.test_3() {
    if (this is A) {
        val f = ::foo // ok
    }
}

/* GENERATED_FIR_TAGS: callableReference, funWithExtensionReceiver, functionDeclaration, ifExpression,
interfaceDeclaration, isExpression, lambdaLiteral, localProperty, propertyDeclaration, smartcast, thisExpression,
whenExpression, whenWithSubject */
