diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriority.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriority.kt index 52582b87302..a06261ea243 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriority.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriority.kt @@ -29,6 +29,7 @@ class E { } fun main() { + E.f // Resolves to (2) in old FE (Resolves to (1) in FIR) E.f() // Resolves to (2) in old FE (Resolves to (1) in FIR) - E.f.invoke() // Resolves to (1) + E.f.invoke() // Resolves to (1) in old FE and FIR } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriority.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriority.txt index b43ae45e48c..c094ebce781 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriority.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriority.txt @@ -74,6 +74,7 @@ FILE: invokePriority.kt } public final fun main(): R|kotlin/Unit| { + Q|E.f| Q|E.f|.R|/E.f.invoke|() Q|E.f|.R|/E.f.invoke|() } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriorityComplex.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriorityComplex.kt new file mode 100644 index 00000000000..e7cfd8a43dc --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriorityComplex.kt @@ -0,0 +1,24 @@ +class AHolder(val a: Int) +class E { + object foo { // (1) + val a: Int = 42 + } + companion object { // (2) + val foo: AHolder = AHolder(52) + } +} +class EE { + object foo {} // (1) + companion object { // (2) + val foo: AHolder = AHolder(52) + } +} +fun main() { + E.foo.a // (1) in old FE and FIR + E.foo // (2) !!! in old FE, (1) in FIR + with(E.foo) { + a // (2) in old FE, (1) in FIR + } + + EE.foo.a // (1) !!! in old FE and FIR +} diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriorityComplex.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriorityComplex.txt new file mode 100644 index 00000000000..b9b5de53eb4 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriorityComplex.txt @@ -0,0 +1,68 @@ +FILE: invokePriorityComplex.kt + public final class AHolder : R|kotlin/Any| { + public constructor(a: R|kotlin/Int|): R|AHolder| { + super() + } + + public final val a: R|kotlin/Int| = R|/a| + public get(): R|kotlin/Int| + + } + public final class E : R|kotlin/Any| { + public constructor(): R|E| { + super() + } + + public final object foo : R|kotlin/Any| { + private constructor(): R|E.foo| { + super() + } + + public final val a: R|kotlin/Int| = Int(42) + public get(): R|kotlin/Int| + + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|E.Companion| { + super() + } + + public final val foo: R|AHolder| = R|/AHolder.AHolder|(Int(52)) + public get(): R|AHolder| + + } + + } + public final class EE : R|kotlin/Any| { + public constructor(): R|EE| { + super() + } + + public final object foo : R|kotlin/Any| { + private constructor(): R|EE.foo| { + super() + } + + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|EE.Companion| { + super() + } + + public final val foo: R|AHolder| = R|/AHolder.AHolder|(Int(52)) + public get(): R|AHolder| + + } + + } + public final fun main(): R|kotlin/Unit| { + Q|E.foo|.R|/E.foo.a| + Q|E.foo| + R|kotlin/with|(Q|E.foo|, = with@fun R|E.foo|.(): R|kotlin/Int| { + ^ this@R|special/anonymous|.R|/E.foo.a| + } + ) + Q|EE.foo|.# + } diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java index ec7546bac28..3f830886973 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java @@ -868,6 +868,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriority.kt"); } + @TestMetadata("invokePriorityComplex.kt") + public void testInvokePriorityComplex() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriorityComplex.kt"); + } + @TestMetadata("KJKComplexHierarchyNestedLoop.kt") public void testKJKComplexHierarchyNestedLoop() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt");