456ba79793
Previous resolution sequence (static scope, nested classes scope, receiver) and a check against type parameters only made sense when there's a type, not an expression, on the LHS of a callable reference. Also TransientReceiver is incorrect in such case because private-to-this visibility check only works for ExpressionReceiver values
25 lines
565 B
Kotlin
Vendored
25 lines
565 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_MEMBER!>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_MEMBER!>func<!>
|
|
}
|
|
|
|
private fun func(t: T): T = t
|
|
}
|