From 3b9e08d6b8a7cebab842a7be955da8c640de3984 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 5 Mar 2024 11:23:08 +0100 Subject: [PATCH] K1/K2: reproduce KT-65789 --- ...CompilerTestFE10TestdataTestGenerated.java | 24 +++++++ ...sticCompilerFE10TestDataTestGenerated.java | 24 +++++++ ...eeOldFrontendDiagnosticsTestGenerated.java | 24 +++++++ ...siOldFrontendDiagnosticsTestGenerated.java | 24 +++++++ .../constructorVsCompanionMember.fir.txt | 62 +++++++++++++++++++ .../constructorVsCompanionMember.kt | 31 ++++++++++ .../constructorVsCompanionMember.txt | 44 +++++++++++++ .../constructorVsSyntheticValues.fir.kt | 19 ++++++ .../constructorVsSyntheticValues.fir.txt | 54 ++++++++++++++++ .../constructorVsSyntheticValues.kt | 19 ++++++ ...ructorVsSyntheticValuesPrioritized.fir.txt | 36 +++++++++++ ...constructorVsSyntheticValuesPrioritized.kt | 15 +++++ .../constructorVsTopLevel.fir.txt | 23 +++++++ .../constructorVsTopLevel.kt | 20 ++++++ .../constructorVsTopLevel.txt | 19 ++++++ .../test/runners/DiagnosticTestGenerated.java | 24 +++++++ 16 files changed, 462 insertions(+) create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.fir.txt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.txt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.fir.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.fir.txt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.fir.txt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.fir.txt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.txt 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 dd88833ada2..676de7d3868 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 @@ -46453,6 +46453,30 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorCaseSpace.kt"); } + @Test + @TestMetadata("constructorVsCompanionMember.kt") + public void testConstructorVsCompanionMember() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.kt"); + } + + @Test + @TestMetadata("constructorVsSyntheticValues.kt") + public void testConstructorVsSyntheticValues() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.kt"); + } + + @Test + @TestMetadata("constructorVsSyntheticValuesPrioritized.kt") + public void testConstructorVsSyntheticValuesPrioritized() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.kt"); + } + + @Test + @TestMetadata("constructorVsTopLevel.kt") + public void testConstructorVsTopLevel() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.kt"); + } + @Test @TestMetadata("qualifierEnumEntryOrCompanionMemberCase.kt") public void testQualifierEnumEntryOrCompanionMemberCase() { 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 2ca95bad6a7..710bc475510 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 @@ -46453,6 +46453,30 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorCaseSpace.kt"); } + @Test + @TestMetadata("constructorVsCompanionMember.kt") + public void testConstructorVsCompanionMember() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.kt"); + } + + @Test + @TestMetadata("constructorVsSyntheticValues.kt") + public void testConstructorVsSyntheticValues() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.kt"); + } + + @Test + @TestMetadata("constructorVsSyntheticValuesPrioritized.kt") + public void testConstructorVsSyntheticValuesPrioritized() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.kt"); + } + + @Test + @TestMetadata("constructorVsTopLevel.kt") + public void testConstructorVsTopLevel() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.kt"); + } + @Test @TestMetadata("qualifierEnumEntryOrCompanionMemberCase.kt") public void testQualifierEnumEntryOrCompanionMemberCase() { 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 73d4bf91f06..c7021f497d2 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 @@ -44083,6 +44083,30 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorCaseSpace.kt"); } + @Test + @TestMetadata("constructorVsCompanionMember.kt") + public void testConstructorVsCompanionMember() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.kt"); + } + + @Test + @TestMetadata("constructorVsSyntheticValues.kt") + public void testConstructorVsSyntheticValues() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.kt"); + } + + @Test + @TestMetadata("constructorVsSyntheticValuesPrioritized.kt") + public void testConstructorVsSyntheticValuesPrioritized() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.kt"); + } + + @Test + @TestMetadata("constructorVsTopLevel.kt") + public void testConstructorVsTopLevel() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.kt"); + } + @Test @TestMetadata("qualifierEnumEntryOrCompanionMemberCase.kt") public void testQualifierEnumEntryOrCompanionMemberCase() { 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 de4b5d6d866..16cdb9ea250 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 @@ -44221,6 +44221,30 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorCaseSpace.kt"); } + @Test + @TestMetadata("constructorVsCompanionMember.kt") + public void testConstructorVsCompanionMember() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.kt"); + } + + @Test + @TestMetadata("constructorVsSyntheticValues.kt") + public void testConstructorVsSyntheticValues() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.kt"); + } + + @Test + @TestMetadata("constructorVsSyntheticValuesPrioritized.kt") + public void testConstructorVsSyntheticValuesPrioritized() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.kt"); + } + + @Test + @TestMetadata("constructorVsTopLevel.kt") + public void testConstructorVsTopLevel() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.kt"); + } + @Test @TestMetadata("qualifierEnumEntryOrCompanionMemberCase.kt") public void testQualifierEnumEntryOrCompanionMemberCase() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.fir.txt new file mode 100644 index 00000000000..de21f30ac3d --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.fir.txt @@ -0,0 +1,62 @@ +FILE: constructorVsCompanionMember.kt + package bar + + public final class Owner : R|kotlin/Any| { + public constructor(): R|bar/Owner| { + super() + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|bar/Owner.Companion| { + super() + } + + public final fun Foo(string: R|kotlin/String?|): R|kotlin/Unit| { + } + + public final class Foo : R|kotlin/Any| { + public constructor(str: R|kotlin/String|): R|bar/Owner.Companion.Foo| { + super() + } + + public final val str: R|kotlin/String| = R|/str| + public get(): R|kotlin/String| + + } + + public final fun Bar(string: R|kotlin/String|): R|kotlin/Unit| { + } + + public final class Bar : R|kotlin/Any| { + public constructor(str: R|kotlin/String?|): R|bar/Owner.Companion.Bar| { + super() + } + + public final val str: R|kotlin/String?| = R|/str| + public get(): R|kotlin/String?| + + } + + public final val foo: R|kotlin/Unit| = this@R|bar/Owner.Companion|.R|bar/Owner.Companion.Foo|(String(1)) + public get(): R|kotlin/Unit| + + public final val bar: R|kotlin/Unit| = this@R|bar/Owner.Companion|.R|bar/Owner.Companion.Bar|(String(2)) + public get(): R|kotlin/Unit| + + } + + public final val foo: R|bar/Owner.Companion.Foo| = R|bar/Owner.Companion.Foo.Foo|(String(3)) + public get(): R|bar/Owner.Companion.Foo| + + public final val bar: R|bar/Owner.Companion.Bar| = R|bar/Owner.Companion.Bar.Bar|(String(4)) + public get(): R|bar/Owner.Companion.Bar| + + } + public final val ownerFoo: R|kotlin/Unit| = Q|bar/Owner|.R|bar/Owner.Companion.Foo|(String(1)) + public get(): R|kotlin/Unit| + public final val ownerCompanionFoo: R|bar/Owner.Companion.Foo| = Q|bar/Owner.Companion|.R|bar/Owner.Companion.Foo.Foo|(String(2)) + public get(): R|bar/Owner.Companion.Foo| + public final val ownerBar: R|kotlin/Unit| = Q|bar/Owner|.R|bar/Owner.Companion.Bar|(String(3)) + public get(): R|kotlin/Unit| + public final val ownerCompanionBar: R|bar/Owner.Companion.Bar| = Q|bar/Owner.Companion|.R|bar/Owner.Companion.Bar.Bar|(String(4)) + public get(): R|bar/Owner.Companion.Bar| diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.kt new file mode 100644 index 00000000000..e449eb569ea --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.kt @@ -0,0 +1,31 @@ +// FIR_IDENTICAL +// ISSUE: KT-65789 +// DIAGNOSTICS: -DEBUG_INFO_LEAKING_THIS +// FIR_DUMP + +package bar + +class Owner { + companion object { + + fun Foo(string: String?) {} + + class Foo(val str: String) + + fun Bar(string: String) {} + + class Bar(val str: String?) + + val foo = Foo("1") // K1/K2: function + val bar = Bar("2") // K1/K2: function + } + + val foo = Foo("3") // K1/K2: constructor + val bar = Bar("4") // K1/K2: constructor +} + +val ownerFoo = Owner.Foo("1") // K1/K2: function +val ownerCompanionFoo = Owner.Companion.Foo("2") // K1/K2: constructor + +val ownerBar = Owner.Bar("3") // K1/K2: function +val ownerCompanionBar = Owner.Companion.Bar("4") // K1/K2: constructor diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.txt b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.txt new file mode 100644 index 00000000000..08d83e2132b --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.txt @@ -0,0 +1,44 @@ +package + +package bar { + public val ownerBar: kotlin.Unit + public val ownerCompanionBar: bar.Owner.Companion.Bar + public val ownerCompanionFoo: bar.Owner.Companion.Foo + public val ownerFoo: kotlin.Unit + + public final class Owner { + public constructor Owner() + public final val bar: bar.Owner.Companion.Bar + public final val foo: bar.Owner.Companion.Foo + 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 companion object Companion { + private constructor Companion() + public final val bar: kotlin.Unit + public final val foo: kotlin.Unit + public final fun Bar(/*0*/ string: kotlin.String): kotlin.Unit + public final fun Foo(/*0*/ string: kotlin.String?): kotlin.Unit + 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 class Bar { + public constructor Bar(/*0*/ str: kotlin.String?) + public final val str: kotlin.String? + 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 class Foo { + public constructor Foo(/*0*/ str: kotlin.String) + public final val str: kotlin.String + 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 + } + } + } +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.fir.kt new file mode 100644 index 00000000000..1c557ac075c --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.fir.kt @@ -0,0 +1,19 @@ +// ISSUE: KT-65789 +// LANGUAGE: -PrioritizedEnumEntries +// FIR_DUMP + +enum class SomeClass { + FIRST, LAST; + + class values { + companion object + } + class entries { + companion object + } +} + +val resultValues = SomeClass.values() +val resultValuesRef = SomeClass::values +val resultEntries = SomeClass.entries +val resultEntriesRef = SomeClass::entries diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.fir.txt new file mode 100644 index 00000000000..2b0603f1107 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.fir.txt @@ -0,0 +1,54 @@ +FILE: constructorVsSyntheticValues.fir.kt + public final enum class SomeClass : R|kotlin/Enum| { + private constructor(): R|SomeClass| { + super|>() + } + + public final static enum entry FIRST: R|SomeClass| + public final static enum entry LAST: R|SomeClass| + public final class values : R|kotlin/Any| { + public constructor(): R|SomeClass.values| { + super() + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|SomeClass.values.Companion| { + super() + } + + } + + } + + public final class entries : R|kotlin/Any| { + public constructor(): R|SomeClass.entries| { + super() + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|SomeClass.entries.Companion| { + super() + } + + } + + } + + public final static fun values(): R|kotlin/Array| { + } + + public final static fun valueOf(value: R|kotlin/String|): R|SomeClass| { + } + + public final static val entries: R|kotlin/enums/EnumEntries| + public get(): R|kotlin/enums/EnumEntries| + + } + public final val resultValues: R|kotlin/Array| = Q|SomeClass|.R|/SomeClass.values*s|() + public get(): R|kotlin/Array| + public final val resultValuesRef: R|kotlin/reflect/KFunction0>| = Q|SomeClass|::R|/SomeClass.values*s| + public get(): R|kotlin/reflect/KFunction0>| + public final val resultEntries: R|SomeClass.entries.Companion| = Q|SomeClass.entries| + public get(): R|SomeClass.entries.Companion| + public final val resultEntriesRef: R|kotlin/reflect/KFunction0| = Q|SomeClass|::R|/SomeClass.entries.entries| + public get(): R|kotlin/reflect/KFunction0| diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.kt new file mode 100644 index 00000000000..523cb802af3 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.kt @@ -0,0 +1,19 @@ +// ISSUE: KT-65789 +// LANGUAGE: -PrioritizedEnumEntries +// FIR_DUMP + +enum class SomeClass { + FIRST, LAST; + + class values { + companion object + } + class entries { + companion object + } +} + +val resultValues = SomeClass.values() +val resultValuesRef = SomeClass::values +val resultEntries = SomeClass.entries +val resultEntriesRef = SomeClass::entries diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.fir.txt new file mode 100644 index 00000000000..e04909f1c32 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.fir.txt @@ -0,0 +1,36 @@ +FILE: constructorVsSyntheticValuesPrioritized.kt + public final enum class SomeClass : R|kotlin/Enum| { + private constructor(): R|SomeClass| { + super|>() + } + + public final static enum entry FIRST: R|SomeClass| + public final static enum entry LAST: R|SomeClass| + public final class entries : R|kotlin/Any| { + public constructor(): R|SomeClass.entries| { + super() + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|SomeClass.entries.Companion| { + super() + } + + } + + } + + public final static fun values(): R|kotlin/Array| { + } + + public final static fun valueOf(value: R|kotlin/String|): R|SomeClass| { + } + + public final static val entries: R|kotlin/enums/EnumEntries| + public get(): R|kotlin/enums/EnumEntries| + + } + public final val resultEntries: R|kotlin/enums/EnumEntries| = Q|SomeClass|.R|/SomeClass.entries*s| + public get(): R|kotlin/enums/EnumEntries| + public final val resultEntriesRef: R|kotlin/reflect/KProperty0>| = Q|SomeClass|::R|/SomeClass.entries*s| + public get(): R|kotlin/reflect/KProperty0>| diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.kt new file mode 100644 index 00000000000..9423d738b66 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.kt @@ -0,0 +1,15 @@ +// FIR_IDENTICAL +// ISSUE: KT-65789 +// LANGUAGE: +PrioritizedEnumEntries +// FIR_DUMP + +enum class SomeClass { + FIRST, LAST; + + class entries { + companion object + } +} + +val resultEntries = SomeClass.entries +val resultEntriesRef = SomeClass::entries diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.fir.txt new file mode 100644 index 00000000000..6ef68434690 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.fir.txt @@ -0,0 +1,23 @@ +FILE: Foo.kt + package bar + + public final fun Foo(string: R|kotlin/String?|): R|kotlin/Unit| { + } + public final class Foo : R|kotlin/Any| { + public constructor(str: R|kotlin/String|): R|bar/Foo| { + super() + } + + public final val str: R|kotlin/String| = R|/str| + public get(): R|kotlin/String| + + } + public final val foo: R|bar/Foo| = R|bar/Foo.Foo|(String(1)) + public get(): R|bar/Foo| + public final val barFoo: R|kotlin/Unit| = Q|bar|.R|bar/Foo|(String(2)) + public get(): R|kotlin/Unit| +FILE: another.kt + package foo + + public final val foo: R|bar/Foo| = R|bar/Foo.Foo|(String(3)) + public get(): R|bar/Foo| diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.kt new file mode 100644 index 00000000000..e06990e8423 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.kt @@ -0,0 +1,20 @@ +// FIR_IDENTICAL +// ISSUE: KT-65789 +// FIR_DUMP + +// FILE: Foo.kt +package bar + +fun Foo(string: String?) {} + +class Foo(val str: String) + +val foo = Foo("1") +val barFoo = bar.Foo("2") + +// FILE: another.kt +package foo + +import bar.Foo + +val foo = Foo("3") diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.txt b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.txt new file mode 100644 index 00000000000..c6854e79ee9 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.txt @@ -0,0 +1,19 @@ +package + +package bar { + public val barFoo: bar.Foo + public val foo: bar.Foo + public fun Foo(/*0*/ string: kotlin.String?): kotlin.Unit + + public final class Foo { + public constructor Foo(/*0*/ str: kotlin.String) + public final val str: kotlin.String + 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 + } +} + +package foo { + public val foo: bar.Foo +} 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 6046bc00eaf..6117a500c3b 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 @@ -46511,6 +46511,30 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorCaseSpace.kt"); } + @Test + @TestMetadata("constructorVsCompanionMember.kt") + public void testConstructorVsCompanionMember() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsCompanionMember.kt"); + } + + @Test + @TestMetadata("constructorVsSyntheticValues.kt") + public void testConstructorVsSyntheticValues() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValues.kt"); + } + + @Test + @TestMetadata("constructorVsSyntheticValuesPrioritized.kt") + public void testConstructorVsSyntheticValuesPrioritized() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsSyntheticValuesPrioritized.kt"); + } + + @Test + @TestMetadata("constructorVsTopLevel.kt") + public void testConstructorVsTopLevel() { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorVsTopLevel.kt"); + } + @Test @TestMetadata("qualifierEnumEntryOrCompanionMemberCase.kt") public void testQualifierEnumEntryOrCompanionMemberCase() {