Files
kotlin-fork/compiler/testData/diagnostics/tests/visibility/privateToThis.kt
T
Dmitriy Novozhilov c64575f4a2 [FIR] Move check for _private-to-this_ visibility into checker
^KT-55446
^KT-65790 Fixed
2024-02-15 13:08:35 +00:00

38 lines
653 B
Kotlin
Vendored

// FIR_DUMP
// explicit types
class A<in T>(t: T) {
private val t: T = t // PRIVATE_TO_THIS
private val i: B = B()
fun test() {
val x: T = t // Ok
val y: T = this.t // Ok
}
fun foo(a: A<String>) {
val x: String = a.<!INVISIBLE_MEMBER!>t<!> // Invisible!
}
fun bar(a: A<*>) {
a.<!INVISIBLE_MEMBER!>t<!> // Invisible!
}
inner class B {
fun baz(a: A<*>) {
a.i
}
}
}
// implicit types
class C<in T>(t: T) {
private val t: T = t
private val tt = t
fun foo(a: C<String>) {
val x: String = a.<!INVISIBLE_MEMBER!>tt<!>
}
}