diff --git a/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.kt b/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.kt index a525cc41b78..47cd69fc4af 100644 --- a/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.kt +++ b/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.kt @@ -29,6 +29,6 @@ class E { } fun main() { - E.f() // Resolves to (2) + E.f() // Resolves to (2) in old FE (to (1) in FIR with object implicit invoke support) E.f.invoke() // Resolves to (1) } \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolveWithStdlib/problems/qualifierPriority.kt b/compiler/fir/resolve/testData/resolveWithStdlib/problems/qualifierPriority.kt new file mode 100644 index 00000000000..224bf34a93b --- /dev/null +++ b/compiler/fir/resolve/testData/resolveWithStdlib/problems/qualifierPriority.kt @@ -0,0 +1,27 @@ +class AHolder(val a: Int) + +class F { + object foo { // (1) + val a: Int = 42 + } + companion object { // (2) + val foo: AHolder = AHolder(52) + } +} +class FF { + object foo {} // (1) + companion object { // (2) + val foo: AHolder = AHolder(52) + } +} + +fun main() { + F.foo.a // (1) everywhere + F.foo // (2) in old FE, (1) in FIR + // Why companion? + with(F.foo) { + a // (2) in old FE, (1) in FIR + } + FF.foo.a // (1) everywhere + // Why not companion +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolveWithStdlib/problems/qualifierPriority.txt b/compiler/fir/resolve/testData/resolveWithStdlib/problems/qualifierPriority.txt new file mode 100644 index 00000000000..c27f1ba5d91 --- /dev/null +++ b/compiler/fir/resolve/testData/resolveWithStdlib/problems/qualifierPriority.txt @@ -0,0 +1,68 @@ +FILE: qualifierPriority.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 F : R|kotlin/Any| { + public constructor(): R|F| { + super() + } + + public final object foo : R|kotlin/Any| { + private constructor(): R|F.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|F.Companion| { + super() + } + + public final val foo: R|AHolder| = R|/AHolder.AHolder|(Int(52)) + public get(): R|AHolder| + + } + + } + public final class FF : R|kotlin/Any| { + public constructor(): R|FF| { + super() + } + + public final object foo : R|kotlin/Any| { + private constructor(): R|FF.foo| { + super() + } + + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|FF.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|F.foo|.R|/F.foo.a| + Q|F.foo| + R|kotlin/with|(Q|F.foo|, = with@fun R|F.foo|.(): R|kotlin/Int| { + ^ this@R|special/anonymous|.R|/F.foo.a| + } + ) + Q|FF.foo|.# + } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java index 66294d455e6..9002e7f32df 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java @@ -685,6 +685,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt"); } + @TestMetadata("qualifierPriority.kt") + public void testQualifierPriority() throws Exception { + runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/qualifierPriority.kt"); + } + @TestMetadata("weakHashMap.kt") public void testWeakHashMap() throws Exception { runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/weakHashMap.kt");