Files
kotlin-fork/compiler/testData/diagnostics/tests/callableReference/bound/privateToThis.fir.kt
T
Kirill Rakhman d91000e39c [FIR] Report INAPPLICABLE_CANDIDATE or more specific diagnostic for callable references
... instead of just UNRESOLVED_REFERENCE when something went wrong
during resolution.

#KT-59401 related
2023-11-08 15:45:48 +00:00

25 lines
571 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_VARIABLE
class Foo<out T>(name: T) {
private var prop: T = name
private set
fun testProp() {
val ok1 = this::prop
val ok2 = this@Foo::prop
val ok3 = object { val y: Any = this@Foo::prop }
val fail1 = Foo(prop)::<!INVISIBLE_REFERENCE!>prop<!>
}
fun testFunc() {
val ok1 = this::func
val ok2 = this@Foo::func
val ok3 = object { val y: Any = this@Foo::func }
val fail1 = Foo(prop)::<!INVISIBLE_REFERENCE!>func<!>
}
private fun func(t: T): T = t
}