[FIR] Move check for _private-to-this_ visibility into checker
^KT-55446 ^KT-65790 Fixed
This commit is contained in:
committed by
Space Team
parent
5fe1e0c1a5
commit
c64575f4a2
+1
-1
@@ -14,7 +14,7 @@ class Test<in I> {
|
||||
apply(foo())
|
||||
apply(this.foo())
|
||||
with(Test<I>()) {
|
||||
apply(foo()) // resolved to this@Test.foo
|
||||
apply(<!INVISIBLE_REFERENCE!>foo<!>()) // K1: this@Test.foo, K2: this@with.foo, see KT-55446
|
||||
apply(this.<!INVISIBLE_REFERENCE!>foo<!>())
|
||||
apply(this@with.<!INVISIBLE_REFERENCE!>foo<!>())
|
||||
apply(this@Test.foo())
|
||||
|
||||
@@ -14,7 +14,7 @@ class Test<in I> {
|
||||
apply(foo())
|
||||
apply(this.foo())
|
||||
with(Test<I>()) {
|
||||
apply(foo()) // resolved to this@Test.foo
|
||||
apply(foo()) // K1: this@Test.foo, K2: this@with.foo, see KT-55446
|
||||
apply(this.<!INVISIBLE_MEMBER("foo; private/*private to this*/; 'Test'")!>foo<!>())
|
||||
apply(this@with.<!INVISIBLE_MEMBER("foo; private/*private to this*/; 'Test'")!>foo<!>())
|
||||
apply(this@Test.foo())
|
||||
|
||||
@@ -14,7 +14,7 @@ class Test<in I, out O> {
|
||||
apply(i)
|
||||
apply(this.i)
|
||||
with(Test<I, O>()) {
|
||||
apply(i) // resolved to this@Test.i
|
||||
apply(<!INVISIBLE_REFERENCE!>i<!>) // K1: this@Test.i, K2: this@with.i, see KT-55446
|
||||
apply(this.<!INVISIBLE_REFERENCE!>i<!>)
|
||||
apply(this@with.<!INVISIBLE_REFERENCE!>i<!>)
|
||||
apply(this@Test.i)
|
||||
|
||||
@@ -14,7 +14,7 @@ class Test<in I, out O> {
|
||||
apply(i)
|
||||
apply(this.i)
|
||||
with(Test<I, O>()) {
|
||||
apply(i) // resolved to this@Test.i
|
||||
apply(i) // K1: this@Test.i, K2: this@with.i, see KT-55446
|
||||
apply(this.<!INVISIBLE_MEMBER("i; private/*private to this*/; 'Test'")!>i<!>)
|
||||
apply(this@with.<!INVISIBLE_MEMBER("i; private/*private to this*/; 'Test'")!>i<!>)
|
||||
apply(this@Test.i)
|
||||
|
||||
@@ -14,7 +14,7 @@ class Test<in I, out O> {
|
||||
i = getT()
|
||||
this.i = getT()
|
||||
with(Test<I, O>()) {
|
||||
i = getT() // resolved to this@Test.i
|
||||
<!INVISIBLE_REFERENCE!>i<!> = getT() // K1: this@Test.i, K2: this@with.i, see KT-55446
|
||||
this.<!INVISIBLE_REFERENCE!>i<!> = getT()
|
||||
this@with.<!INVISIBLE_REFERENCE!>i<!> = getT()
|
||||
this@Test.i = getT()
|
||||
|
||||
@@ -14,7 +14,7 @@ class Test<in I, out O> {
|
||||
i = getT()
|
||||
this.i = getT()
|
||||
with(Test<I, O>()) {
|
||||
i = getT() // resolved to this@Test.i
|
||||
i = getT() // K1: this@Test.i, K2: this@with.i, see KT-55446
|
||||
this.<!INVISIBLE_MEMBER("i; private/*private to this*/; 'Test'")!>i<!> = getT()
|
||||
this@with.<!INVISIBLE_MEMBER("i; private/*private to this*/; 'Test'")!>i<!> = getT()
|
||||
this@Test.i = getT()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// FIR_DUMP
|
||||
|
||||
// explicit types
|
||||
class A<in T>(t: T) {
|
||||
private val t: T = t // PRIVATE_TO_THIS
|
||||
|
||||
@@ -24,3 +25,13 @@ class A<in T>(t: T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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_REFERENCE!>tt<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ FILE: privateToThis.fir.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
private/*private to this*/ final val t: R|T| = R|<local>/t|
|
||||
private/*private to this*/ get(): R|T|
|
||||
private final val t: R|T| = R|<local>/t|
|
||||
private get(): R|T|
|
||||
|
||||
private final val i: R|A.B<T>| = this@R|/A|.R|SubstitutionOverride</A.B.B>|()
|
||||
private get(): R|A.B<T>|
|
||||
@@ -16,11 +16,11 @@ FILE: privateToThis.fir.kt
|
||||
}
|
||||
|
||||
public final fun foo(a: R|A<kotlin/String>|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/String| = R|<local>/a|.R|SubstitutionOverride</A.t: R|kotlin/String|><HIDDEN: /A.t is invisible>#|
|
||||
lval x: R|kotlin/String| = R|<local>/a|.R|SubstitutionOverride</A.t: R|kotlin/String|>|
|
||||
}
|
||||
|
||||
public final fun bar(a: R|A<*>|): R|kotlin/Unit| {
|
||||
R|<local>/a|.R|SubstitutionOverride</A.t: R|CapturedType(*)|><HIDDEN: /A.t is invisible>#|
|
||||
R|<local>/a|.R|SubstitutionOverride</A.t: R|CapturedType(*)|>|
|
||||
}
|
||||
|
||||
public final inner class B<in Outer(T)> : R|kotlin/Any| {
|
||||
@@ -35,3 +35,19 @@ FILE: privateToThis.fir.kt
|
||||
}
|
||||
|
||||
}
|
||||
public final class C<in T> : R|kotlin/Any| {
|
||||
public constructor<in T>(t: R|T|): R|C<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
private final val t: R|T| = R|<local>/t|
|
||||
private get(): R|T|
|
||||
|
||||
private final val tt: R|T| = R|<local>/t|
|
||||
private get(): R|T|
|
||||
|
||||
public final fun foo(a: R|C<kotlin/String>|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/String| = R|<local>/a|.R|SubstitutionOverride</C.tt: R|kotlin/String|>|
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// FIR_DUMP
|
||||
|
||||
// explicit types
|
||||
class A<in T>(t: T) {
|
||||
private val t: T = t // PRIVATE_TO_THIS
|
||||
|
||||
@@ -24,3 +25,13 @@ class A<in T>(t: T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,3 +19,14 @@ public final class A</*0*/ in T> {
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public final class C</*0*/ in T> {
|
||||
public constructor C</*0*/ in T>(/*0*/ t: T)
|
||||
private/*private to this*/ final val t: T
|
||||
private/*private to this*/ final val tt: T
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(/*0*/ a: C<kotlin.String>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ class Foo<in T> : Base<<!TYPE_VARIANCE_CONFLICT_ERROR!>T<!>>() {
|
||||
|
||||
fun bar(f: Foo<Bar>) {
|
||||
val dnn = f.<!INVISIBLE_REFERENCE!>dnn<!>
|
||||
// This case (and any other with non-denotable type) requires KT-55446 to be fixed
|
||||
val flex = f.flex
|
||||
val flex = f.<!INVISIBLE_REFERENCE!>flex<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ class Foo<in T> : Base<<!TYPE_VARIANCE_CONFLICT_ERROR!>T<!>>() {
|
||||
|
||||
fun bar(f: Foo<Bar>) {
|
||||
val dnn = f.<!INVISIBLE_MEMBER!>dnn<!>
|
||||
// This case (and any other with non-denotable type) requires KT-55446 to be fixed
|
||||
val flex = f.<!INVISIBLE_MEMBER!>flex<!>
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -1,19 +1,19 @@
|
||||
public final class A<in I> : R|kotlin/Any| {
|
||||
private/*private to this*/ final fun bas(): R|I|
|
||||
private final fun bas(): R|I|
|
||||
|
||||
private/*private to this*/ final val foo: R|I|
|
||||
private/*private to this*/ get(): R|I|
|
||||
private final val foo: R|I|
|
||||
private get(): R|I|
|
||||
|
||||
private/*private to this*/ final var bar: R|I|
|
||||
private/*private to this*/ get(): R|I|
|
||||
private/*private to this*/ set(value: R|I|): R|kotlin/Unit|
|
||||
private final var bar: R|I|
|
||||
private get(): R|I|
|
||||
private set(value: R|I|): R|kotlin/Unit|
|
||||
|
||||
private/*private to this*/ final val val_with_accessors: R|I|
|
||||
private/*private to this*/ get(): R|I|
|
||||
private final val val_with_accessors: R|I|
|
||||
private get(): R|I|
|
||||
|
||||
private/*private to this*/ final var var_with_accessors: R|I|
|
||||
private/*private to this*/ get(): R|I|
|
||||
private/*private to this*/ set(value: R|I|): R|kotlin/Unit|
|
||||
private final var var_with_accessors: R|I|
|
||||
private get(): R|I|
|
||||
private set(value: R|I|): R|kotlin/Unit|
|
||||
|
||||
public constructor<in I>(): R|test/A<I>|
|
||||
|
||||
|
||||
Reference in New Issue
Block a user