diff --git a/compiler/fir/resolve/testData/resolve/expresssions/qualifierPriority.kt b/compiler/fir/resolve/testData/resolve/expresssions/qualifierPriority.kt new file mode 100644 index 00000000000..acc5f54baf0 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/expresssions/qualifierPriority.kt @@ -0,0 +1,38 @@ +class A { + object B { + object C { + + } + } + companion object { + val B = "" + } +} + +val ab = A.B // property +val abc = A.B.C // object + +object D { + class E { + object F { + + } + } +} + +val D.E get() = "" + +val def = D.E.F // object +val de = D.E // extension + +enum class G { + H; + companion object { + val H = "" + + fun values(): Int = 42 + } +} + +val gh = G.H // companion property +val gv = G.values() // static function diff --git a/compiler/fir/resolve/testData/resolve/expresssions/qualifierPriority.txt b/compiler/fir/resolve/testData/resolve/expresssions/qualifierPriority.txt new file mode 100644 index 00000000000..5be61bbd650 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/expresssions/qualifierPriority.txt @@ -0,0 +1,100 @@ +FILE: qualifierPriority.kt + public final class A : R|kotlin/Any| { + public constructor(): R|A| { + super() + } + + public final object B : R|kotlin/Any| { + private constructor(): R|A.B| { + super() + } + + public final object C : R|kotlin/Any| { + private constructor(): R|A.B.C| { + super() + } + + } + + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|A.Companion| { + super() + } + + public final val B: R|kotlin/String| = String() + public get(): R|kotlin/String| + + } + + } + public final val ab: R|kotlin/String| = Q|A|.R|/A.Companion.B| + public get(): R|kotlin/String| + public final val abc: = Q|A|.R|/A.Companion.B|.# + public get(): + public final object D : R|kotlin/Any| { + private constructor(): R|D| { + super() + } + + public final class E : R|kotlin/Any| { + public constructor(): R|D.E| { + super() + } + + public final object F : R|kotlin/Any| { + private constructor(): R|D.E.F| { + super() + } + + } + + } + + } + public final val R|D|.E: R|kotlin/String| + public get(): R|kotlin/String| { + ^ String() + } + public final val def: R|D.E.F| = Q|D.E.F| + public get(): R|D.E.F| + public final val de: R|kotlin/Unit| = Q|D.E| + public get(): R|kotlin/Unit| + public final enum class G : R|kotlin/Enum| { + private constructor(): R|G| { + super() + } + + public final static enum entry H: R|G| = object : R|G| { + private constructor(): R|anonymous| { + super() + } + + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|G.Companion| { + super() + } + + public final val H: R|kotlin/String| = String() + public get(): R|kotlin/String| + + public final fun values(): R|kotlin/Int| { + ^values Int(42) + } + + } + + public final static fun values(): R|kotlin/Array| { + } + + public final static fun valueOf(value: R|kotlin/String|): R|G| { + } + + } + public final val gh: = Q|G|.# + public get(): + public final val gv: = Q|G|.#() + public get(): diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index d7f723806fe..5088ebc3924 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -604,6 +604,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/resolve/testData/resolve/expresssions/qualifiedExpressions.kt"); } + @TestMetadata("qualifierPriority.kt") + public void testQualifierPriority() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/expresssions/qualifierPriority.kt"); + } + @TestMetadata("receiverConsistency.kt") public void testReceiverConsistency() throws Exception { runTest("compiler/fir/resolve/testData/resolve/expresssions/receiverConsistency.kt"); diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java index 00ea9639253..84b3f73d33d 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java @@ -604,6 +604,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/resolve/testData/resolve/expresssions/qualifiedExpressions.kt"); } + @TestMetadata("qualifierPriority.kt") + public void testQualifierPriority() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/expresssions/qualifierPriority.kt"); + } + @TestMetadata("receiverConsistency.kt") public void testReceiverConsistency() throws Exception { runTest("compiler/fir/resolve/testData/resolve/expresssions/receiverConsistency.kt");