diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index 2914410d91c..6432cb9e107 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -375,6 +375,24 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/equalityWithSmartCastInIfBlock.kt"); } + @Test + @TestMetadata("expressionsInQaSelectorsCornerCases.kt") + public void testExpressionsInQaSelectorsCornerCases() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsCornerCases.kt"); + } + + @Test + @TestMetadata("expressionsInQaSelectorsReceiverConversion.kt") + public void testExpressionsInQaSelectorsReceiverConversion() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsReceiverConversion.kt"); + } + + @Test + @TestMetadata("expressionsInQaSelectorsWithElvis.kt") + public void testExpressionsInQaSelectorsWithElvis() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsWithElvis.kt"); + } + @Test @TestMetadata("ExtensionCallInvoke.kt") public void testExtensionCallInvoke() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index 1d29fcf58f7..c795ae06f25 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -375,6 +375,24 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/equalityWithSmartCastInIfBlock.kt"); } + @Test + @TestMetadata("expressionsInQaSelectorsCornerCases.kt") + public void testExpressionsInQaSelectorsCornerCases() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsCornerCases.kt"); + } + + @Test + @TestMetadata("expressionsInQaSelectorsReceiverConversion.kt") + public void testExpressionsInQaSelectorsReceiverConversion() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsReceiverConversion.kt"); + } + + @Test + @TestMetadata("expressionsInQaSelectorsWithElvis.kt") + public void testExpressionsInQaSelectorsWithElvis() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsWithElvis.kt"); + } + @Test @TestMetadata("ExtensionCallInvoke.kt") public void testExtensionCallInvoke() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index 71a3023c889..dbe579eba1e 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -375,6 +375,24 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/equalityWithSmartCastInIfBlock.kt"); } + @Test + @TestMetadata("expressionsInQaSelectorsCornerCases.kt") + public void testExpressionsInQaSelectorsCornerCases() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsCornerCases.kt"); + } + + @Test + @TestMetadata("expressionsInQaSelectorsReceiverConversion.kt") + public void testExpressionsInQaSelectorsReceiverConversion() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsReceiverConversion.kt"); + } + + @Test + @TestMetadata("expressionsInQaSelectorsWithElvis.kt") + public void testExpressionsInQaSelectorsWithElvis() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsWithElvis.kt"); + } + @Test @TestMetadata("ExtensionCallInvoke.kt") public void testExtensionCallInvoke() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index 109c1f20fbd..1821a6fdc0f 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -375,6 +375,24 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/equalityWithSmartCastInIfBlock.kt"); } + @Test + @TestMetadata("expressionsInQaSelectorsCornerCases.kt") + public void testExpressionsInQaSelectorsCornerCases() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsCornerCases.kt"); + } + + @Test + @TestMetadata("expressionsInQaSelectorsReceiverConversion.kt") + public void testExpressionsInQaSelectorsReceiverConversion() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsReceiverConversion.kt"); + } + + @Test + @TestMetadata("expressionsInQaSelectorsWithElvis.kt") + public void testExpressionsInQaSelectorsWithElvis() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsWithElvis.kt"); + } + @Test @TestMetadata("ExtensionCallInvoke.kt") public void testExtensionCallInvoke() throws Exception { diff --git a/compiler/testData/diagnostics/tests/expressionsInQaSelectorsCornerCases.fir.kt b/compiler/testData/diagnostics/tests/expressionsInQaSelectorsCornerCases.fir.kt new file mode 100644 index 00000000000..e0a3353309a --- /dev/null +++ b/compiler/testData/diagnostics/tests/expressionsInQaSelectorsCornerCases.fir.kt @@ -0,0 +1,34 @@ +// ISSUE: KT-64891 + +fun T.b(): Int = 10 + +fun Int.a(it: T): Int = this + +fun main() { + 5.(::b)().inv() + 5.(::a)('=').inv() + + val c = Int::b + 5.(c)().inv() + + val f: Int.() -> Int = Int::b + 5.(f)().inv() + + 5.(Int::b)().inv() + + val d = Int::a + 5.(d)('=').inv() + + val e: Int.(Char) -> Int = Int::a + 5.(e)('=').inv() +} + +val T.x get(): Int = 10 + +fun rain() { + 5.(x)().inv() + + 5.(::x)().inv() + + 5.(Int::x)().inv() +} diff --git a/compiler/testData/diagnostics/tests/expressionsInQaSelectorsCornerCases.kt b/compiler/testData/diagnostics/tests/expressionsInQaSelectorsCornerCases.kt new file mode 100644 index 00000000000..a8cbc4e9f52 --- /dev/null +++ b/compiler/testData/diagnostics/tests/expressionsInQaSelectorsCornerCases.kt @@ -0,0 +1,34 @@ +// ISSUE: KT-64891 + +fun T.b(): Int = 10 + +fun Int.a(it: T): Int = this + +fun main() { + 5.(::b)().inv() + 5.(::a)('=').inv() + + val c = Int::b + 5.(c)().inv() + + val f: Int.() -> Int = Int::b + 5.(f)().inv() + + 5.(Int::b)().inv() + + val d = Int::a + 5.(d)('=').inv() + + val e: Int.(Char) -> Int = Int::a + 5.(e)('=').inv() +} + +val T.x get(): Int = 10 + +fun rain() { + 5.(x)().inv() + + 5.(::x)().inv() + + 5.(Int::x)().inv() +} diff --git a/compiler/testData/diagnostics/tests/expressionsInQaSelectorsReceiverConversion.fir.kt b/compiler/testData/diagnostics/tests/expressionsInQaSelectorsReceiverConversion.fir.kt new file mode 100644 index 00000000000..ec751e6aef8 --- /dev/null +++ b/compiler/testData/diagnostics/tests/expressionsInQaSelectorsReceiverConversion.fir.kt @@ -0,0 +1,5 @@ +// ISSUE: KT-64891 + +fun test(f: (Int) -> Int) { + 2.(f)() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/expressionsInQaSelectorsReceiverConversion.kt b/compiler/testData/diagnostics/tests/expressionsInQaSelectorsReceiverConversion.kt new file mode 100644 index 00000000000..9b88d7adc1b --- /dev/null +++ b/compiler/testData/diagnostics/tests/expressionsInQaSelectorsReceiverConversion.kt @@ -0,0 +1,5 @@ +// ISSUE: KT-64891 + +fun test(f: (Int) -> Int) { + 2.(f)() +} diff --git a/compiler/testData/diagnostics/tests/expressionsInQaSelectorsWithElvis.kt b/compiler/testData/diagnostics/tests/expressionsInQaSelectorsWithElvis.kt new file mode 100644 index 00000000000..d4ccafc3964 --- /dev/null +++ b/compiler/testData/diagnostics/tests/expressionsInQaSelectorsWithElvis.kt @@ -0,0 +1,6 @@ +// FIR_IDENTICAL +// ISSUE: KT-64891 + +fun test(a: (Int.() -> Int)?, b: Int.() -> Int) { + 2.(a ?: b)() +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index ed6f553592e..3e86d289508 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -375,6 +375,24 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/equalityWithSmartCastInIfBlock.kt"); } + @Test + @TestMetadata("expressionsInQaSelectorsCornerCases.kt") + public void testExpressionsInQaSelectorsCornerCases() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsCornerCases.kt"); + } + + @Test + @TestMetadata("expressionsInQaSelectorsReceiverConversion.kt") + public void testExpressionsInQaSelectorsReceiverConversion() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsReceiverConversion.kt"); + } + + @Test + @TestMetadata("expressionsInQaSelectorsWithElvis.kt") + public void testExpressionsInQaSelectorsWithElvis() throws Exception { + runTest("compiler/testData/diagnostics/tests/expressionsInQaSelectorsWithElvis.kt"); + } + @Test @TestMetadata("ExtensionCallInvoke.kt") public void testExtensionCallInvoke() throws Exception {