K2: fix "private to this" determination logic in accordance with K1

#KT-61844 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-09-20 17:43:44 +02:00
committed by Space Team
parent b9302869d5
commit ae19cd91bf
5 changed files with 28 additions and 25 deletions
@@ -1,11 +0,0 @@
// ISSUE: KT-61844
// FIR_DUMP
class Foo<I, out O>(
private val transformer: (I) -> O,
) {
fun <I, O> transform(foo: Foo<I, O>, bar: I) {
foo.<!FUNCTION_EXPECTED!>transformer<!>(bar)
foo.<!INVISIBLE_REFERENCE!>transformer<!>.invoke(bar)
}
}
@@ -1,15 +1,15 @@
FILE: privateInvokeOwner.fir.kt
FILE: privateInvokeOwner.kt
public final class Foo<I, out O> : R|kotlin/Any| {
public constructor<I, out O>(transformer: R|(I) -> O|): R|Foo<I, O>| {
super<R|kotlin/Any|>()
}
private/*private to this*/ final val transformer: R|(I) -> O| = R|<local>/transformer|
private/*private to this*/ get(): R|(I) -> O|
private final val transformer: R|(I) -> O| = R|<local>/transformer|
private get(): R|(I) -> O|
public final fun <I, O> transform(foo: R|Foo<I, O>|, bar: R|I|): R|kotlin/Unit| {
R|<local>/foo|.<Expression 'transformer' of type 'kotlin/Function1<I, O>' cannot be invoked as a function>#(R|<local>/bar|)
R|<local>/foo|.R|SubstitutionOverride</Foo.transformer: R|(I) -> O|><HIDDEN: /Foo.transformer is invisible>#|.R|SubstitutionOverride<kotlin/Function1.invoke: R|O|>|(R|<local>/bar|)
R|<local>/foo|.R|SubstitutionOverride</Foo.transformer: R|(I) -> O|>|.R|SubstitutionOverride<kotlin/Function1.invoke: R|O|>|(R|<local>/bar|)
R|<local>/foo|.R|SubstitutionOverride</Foo.transformer: R|(I) -> O|>|.R|SubstitutionOverride<kotlin/Function1.invoke: R|O|>|(R|<local>/bar|)
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// ISSUE: KT-61844
// FIR_DUMP