K1/K2: reproduce KT-65789

This commit is contained in:
Mikhail Glukhikh
2024-03-05 11:23:08 +01:00
committed by Space Team
parent f2501ad424
commit 3b9e08d6b8
16 changed files with 462 additions and 0 deletions
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -0,0 +1,62 @@
FILE: constructorVsCompanionMember.kt
package bar
public final class Owner : R|kotlin/Any| {
public constructor(): R|bar/Owner| {
super<R|kotlin/Any|>()
}
public final companion object Companion : R|kotlin/Any| {
private constructor(): R|bar/Owner.Companion| {
super<R|kotlin/Any|>()
}
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<R|kotlin/Any|>()
}
public final val str: R|kotlin/String| = R|<local>/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<R|kotlin/Any|>()
}
public final val str: R|kotlin/String?| = R|<local>/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|
@@ -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
@@ -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
}
}
}
}
@@ -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 = <!DEPRECATED_ACCESS_TO_ENTRIES_AS_QUALIFIER!>SomeClass.entries<!>
val resultEntriesRef = SomeClass::<!DEPRECATED_ACCESS_TO_ENUM_ENTRY_PROPERTY_AS_REFERENCE!>entries<!>
@@ -0,0 +1,54 @@
FILE: constructorVsSyntheticValues.fir.kt
public final enum class SomeClass : R|kotlin/Enum<SomeClass>| {
private constructor(): R|SomeClass| {
super<R|kotlin/Enum<SomeClass>|>()
}
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<R|kotlin/Any|>()
}
public final companion object Companion : R|kotlin/Any| {
private constructor(): R|SomeClass.values.Companion| {
super<R|kotlin/Any|>()
}
}
}
public final class entries : R|kotlin/Any| {
public constructor(): R|SomeClass.entries| {
super<R|kotlin/Any|>()
}
public final companion object Companion : R|kotlin/Any| {
private constructor(): R|SomeClass.entries.Companion| {
super<R|kotlin/Any|>()
}
}
}
public final static fun values(): R|kotlin/Array<SomeClass>| {
}
public final static fun valueOf(value: R|kotlin/String|): R|SomeClass| {
}
public final static val entries: R|kotlin/enums/EnumEntries<SomeClass>|
public get(): R|kotlin/enums/EnumEntries<SomeClass>|
}
public final val resultValues: R|kotlin/Array<SomeClass>| = Q|SomeClass|.R|/SomeClass.values*s|()
public get(): R|kotlin/Array<SomeClass>|
public final val resultValuesRef: R|kotlin/reflect/KFunction0<kotlin/Array<SomeClass>>| = Q|SomeClass|::R|/SomeClass.values*s|
public get(): R|kotlin/reflect/KFunction0<kotlin/Array<SomeClass>>|
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<SomeClass.entries>| = Q|SomeClass|::R|/SomeClass.entries.entries|
public get(): R|kotlin/reflect/KFunction0<SomeClass.entries>|
@@ -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.<!OVERLOAD_RESOLUTION_AMBIGUITY!>values<!>()
val resultValuesRef = SomeClass::<!OVERLOAD_RESOLUTION_AMBIGUITY!>values<!>
val resultEntries = SomeClass.entries
val resultEntriesRef = SomeClass::entries
@@ -0,0 +1,36 @@
FILE: constructorVsSyntheticValuesPrioritized.kt
public final enum class SomeClass : R|kotlin/Enum<SomeClass>| {
private constructor(): R|SomeClass| {
super<R|kotlin/Enum<SomeClass>|>()
}
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<R|kotlin/Any|>()
}
public final companion object Companion : R|kotlin/Any| {
private constructor(): R|SomeClass.entries.Companion| {
super<R|kotlin/Any|>()
}
}
}
public final static fun values(): R|kotlin/Array<SomeClass>| {
}
public final static fun valueOf(value: R|kotlin/String|): R|SomeClass| {
}
public final static val entries: R|kotlin/enums/EnumEntries<SomeClass>|
public get(): R|kotlin/enums/EnumEntries<SomeClass>|
}
public final val resultEntries: R|kotlin/enums/EnumEntries<SomeClass>| = Q|SomeClass|.R|/SomeClass.entries*s|
public get(): R|kotlin/enums/EnumEntries<SomeClass>|
public final val resultEntriesRef: R|kotlin/reflect/KProperty0<kotlin/enums/EnumEntries<SomeClass>>| = Q|SomeClass|::R|/SomeClass.entries*s|
public get(): R|kotlin/reflect/KProperty0<kotlin/enums/EnumEntries<SomeClass>>|
@@ -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
@@ -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<R|kotlin/Any|>()
}
public final val str: R|kotlin/String| = R|<local>/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|
@@ -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")
@@ -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
}
@@ -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() {