Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastOnImplicitReceiverOfCallableReference.kt
T
Dmitriy Novozhilov 2796d21ec6 [FIR] Create snapshot of tower data context for postponed callable referneces
This fixes an issue if type of some implicit receiver was changed because
  of changed smartcast in outer scope

^KT-51228 Fixed
2022-05-12 12:15:31 +03:00

32 lines
453 B
Kotlin
Vendored

// 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
}
}