Files
kotlin-fork/compiler/testData/diagnostics/tests/dataFlow/smartCastWithLambdaAndCallableReference.kt
T
Nikolay Lunyak 425d5e808b [FIR] Link some tests with issues
Just in case.

^KT-59874
2023-11-14 15:19:33 +00:00

23 lines
366 B
Kotlin
Vendored

// ISSUE: KT-56744
// SKIP_TXT
fun <T> T.myApply(block: T.() -> Unit): T = this
fun bar(): Int = 1
interface A : C
interface B : C
interface C {
fun baz()
}
fun Any.foo() = myApply {
when (this) {
is A -> ::bar
is B -> ::bar
else -> throw RuntimeException()
}
<!UNRESOLVED_REFERENCE!>baz<!>() // Smart cast should work
}