K2: reproduce KT-61844

This commit is contained in:
Mikhail Glukhikh
2023-09-20 17:10:48 +02:00
committed by Space Team
parent 36df749697
commit b9302869d5
9 changed files with 78 additions and 0 deletions
@@ -28263,6 +28263,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt");
}
@Test
@TestMetadata("privateInvokeOwner.kt")
public void testPrivateInvokeOwner() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/privateInvokeOwner.kt");
}
@Test
@TestMetadata("reportFunctionExpectedOnSimpleUnresolved.kt")
public void testReportFunctionExpectedOnSimpleUnresolved() throws Exception {
@@ -28263,6 +28263,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt");
}
@Test
@TestMetadata("privateInvokeOwner.kt")
public void testPrivateInvokeOwner() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/privateInvokeOwner.kt");
}
@Test
@TestMetadata("reportFunctionExpectedOnSimpleUnresolved.kt")
public void testReportFunctionExpectedOnSimpleUnresolved() throws Exception {
@@ -28263,6 +28263,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt");
}
@Test
@TestMetadata("privateInvokeOwner.kt")
public void testPrivateInvokeOwner() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/privateInvokeOwner.kt");
}
@Test
@TestMetadata("reportFunctionExpectedOnSimpleUnresolved.kt")
public void testReportFunctionExpectedOnSimpleUnresolved() throws Exception {
@@ -28275,6 +28275,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt");
}
@Test
@TestMetadata("privateInvokeOwner.kt")
public void testPrivateInvokeOwner() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/privateInvokeOwner.kt");
}
@Test
@TestMetadata("reportFunctionExpectedOnSimpleUnresolved.kt")
public void testReportFunctionExpectedOnSimpleUnresolved() throws Exception {
@@ -0,0 +1,11 @@
// 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)
}
}
@@ -0,0 +1,15 @@
FILE: privateInvokeOwner.fir.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|
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|)
}
}
@@ -0,0 +1,11 @@
// 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.transformer(bar)
foo.transformer.invoke(bar)
}
}
@@ -0,0 +1,11 @@
package
public final class Foo</*0*/ I, /*1*/ out O> {
public constructor Foo</*0*/ I, /*1*/ out O>(/*0*/ transformer: (I) -> O)
private final val transformer: (I) -> O
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final fun </*0*/ I, /*1*/ O> transform(/*0*/ foo: Foo<I, O>, /*1*/ bar: I): kotlin.Unit
}
@@ -30057,6 +30057,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt");
}
@Test
@TestMetadata("privateInvokeOwner.kt")
public void testPrivateInvokeOwner() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/privateInvokeOwner.kt");
}
@Test
@TestMetadata("reportFunctionExpectedOnSimpleUnresolved.kt")
public void testReportFunctionExpectedOnSimpleUnresolved() throws Exception {