K2: introduce prioritized enum entries resolve by a 2.1 feature
Related to KT-48872
This commit is contained in:
committed by
Space Team
parent
b92f1e2036
commit
905e1dcd3b
+30
@@ -11071,6 +11071,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/conflictingPropertyEntriesAndReferenceOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingPropertyEntriesAndReferencePrioritized.kt")
|
||||
public void testConflictingPropertyEntriesAndReferencePrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/conflictingPropertyEntriesAndReferencePrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClash.kt")
|
||||
public void testEntriesPropertyAsExtensionClash() throws Exception {
|
||||
@@ -11083,6 +11089,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClashPrioritized.kt")
|
||||
public void testEntriesPropertyAsExtensionClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClash.kt")
|
||||
public void testEntriesPropertyImportedClash() throws Exception {
|
||||
@@ -11095,6 +11107,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClashPrioritized.kt")
|
||||
public void testEntriesPropertyImportedClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClash.kt")
|
||||
public void testEntriesPropertyInCompanionClash() throws Exception {
|
||||
@@ -11119,6 +11137,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyWithJvmStaticClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyWithJvmStaticClashPrioritized.kt")
|
||||
public void testEntriesPropertyWithJvmStaticClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyWithJvmStaticClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesUnsupported.kt")
|
||||
public void testEntriesUnsupported() throws Exception {
|
||||
@@ -11167,6 +11191,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nameShadowingOfExternallyDefinedEntriesPrioritized.kt")
|
||||
public void testNameShadowingOfExternallyDefinedEntriesPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsic.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsic() throws Exception {
|
||||
|
||||
+30
@@ -11071,6 +11071,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/conflictingPropertyEntriesAndReferenceOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingPropertyEntriesAndReferencePrioritized.kt")
|
||||
public void testConflictingPropertyEntriesAndReferencePrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/conflictingPropertyEntriesAndReferencePrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClash.kt")
|
||||
public void testEntriesPropertyAsExtensionClash() throws Exception {
|
||||
@@ -11083,6 +11089,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClashPrioritized.kt")
|
||||
public void testEntriesPropertyAsExtensionClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClash.kt")
|
||||
public void testEntriesPropertyImportedClash() throws Exception {
|
||||
@@ -11095,6 +11107,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClashPrioritized.kt")
|
||||
public void testEntriesPropertyImportedClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClash.kt")
|
||||
public void testEntriesPropertyInCompanionClash() throws Exception {
|
||||
@@ -11119,6 +11137,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyWithJvmStaticClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyWithJvmStaticClashPrioritized.kt")
|
||||
public void testEntriesPropertyWithJvmStaticClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyWithJvmStaticClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesUnsupported.kt")
|
||||
public void testEntriesUnsupported() throws Exception {
|
||||
@@ -11167,6 +11191,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nameShadowingOfExternallyDefinedEntriesPrioritized.kt")
|
||||
public void testNameShadowingOfExternallyDefinedEntriesPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsic.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsic() throws Exception {
|
||||
|
||||
+30
@@ -11071,6 +11071,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/conflictingPropertyEntriesAndReferenceOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingPropertyEntriesAndReferencePrioritized.kt")
|
||||
public void testConflictingPropertyEntriesAndReferencePrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/conflictingPropertyEntriesAndReferencePrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClash.kt")
|
||||
public void testEntriesPropertyAsExtensionClash() throws Exception {
|
||||
@@ -11083,6 +11089,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClashPrioritized.kt")
|
||||
public void testEntriesPropertyAsExtensionClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClash.kt")
|
||||
public void testEntriesPropertyImportedClash() throws Exception {
|
||||
@@ -11095,6 +11107,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClashPrioritized.kt")
|
||||
public void testEntriesPropertyImportedClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClash.kt")
|
||||
public void testEntriesPropertyInCompanionClash() throws Exception {
|
||||
@@ -11119,6 +11137,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyWithJvmStaticClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyWithJvmStaticClashPrioritized.kt")
|
||||
public void testEntriesPropertyWithJvmStaticClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyWithJvmStaticClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesUnsupported.kt")
|
||||
public void testEntriesUnsupported() throws Exception {
|
||||
@@ -11167,6 +11191,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nameShadowingOfExternallyDefinedEntriesPrioritized.kt")
|
||||
public void testNameShadowingOfExternallyDefinedEntriesPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsic.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsic() throws Exception {
|
||||
|
||||
+30
@@ -11077,6 +11077,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/conflictingPropertyEntriesAndReferenceOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingPropertyEntriesAndReferencePrioritized.kt")
|
||||
public void testConflictingPropertyEntriesAndReferencePrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/conflictingPropertyEntriesAndReferencePrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClash.kt")
|
||||
public void testEntriesPropertyAsExtensionClash() throws Exception {
|
||||
@@ -11089,6 +11095,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClashPrioritized.kt")
|
||||
public void testEntriesPropertyAsExtensionClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClash.kt")
|
||||
public void testEntriesPropertyImportedClash() throws Exception {
|
||||
@@ -11101,6 +11113,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClashPrioritized.kt")
|
||||
public void testEntriesPropertyImportedClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClash.kt")
|
||||
public void testEntriesPropertyInCompanionClash() throws Exception {
|
||||
@@ -11125,6 +11143,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyWithJvmStaticClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyWithJvmStaticClashPrioritized.kt")
|
||||
public void testEntriesPropertyWithJvmStaticClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyWithJvmStaticClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesUnsupported.kt")
|
||||
public void testEntriesUnsupported() throws Exception {
|
||||
@@ -11173,6 +11197,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nameShadowingOfExternallyDefinedEntriesPrioritized.kt")
|
||||
public void testNameShadowingOfExternallyDefinedEntriesPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsic.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsic() throws Exception {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.resolve.calls
|
||||
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||
@@ -95,7 +96,9 @@ class CandidateFactory private constructor(
|
||||
// Flag all property references that are resolved from an convention operator call.
|
||||
result.addDiagnostic(PropertyAsOperator)
|
||||
}
|
||||
if (symbol is FirPropertySymbol) {
|
||||
if (symbol is FirPropertySymbol &&
|
||||
!context.session.languageVersionSettings.supportsFeature(LanguageFeature.PrioritizedEnumEntries)
|
||||
) {
|
||||
val containingClass = symbol.containingClassLookupTag()?.toFirRegularClass(context.session)
|
||||
if (containingClass != null && symbol.fir.isEnumEntries(containingClass)) {
|
||||
result.addDiagnostic(LowerPriorityToPreserveCompatibilityDiagnostic)
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: +EnumEntries +PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
enum class E {
|
||||
;
|
||||
|
||||
val entries: Int = 0
|
||||
}
|
||||
|
||||
fun test() {
|
||||
E::entries
|
||||
val ref = E::entries
|
||||
val refType: (E) -> Int = E::entries
|
||||
val refTypeWithAnyExpectedType: Any = E::entries
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
FILE: conflictingPropertyEntriesAndReferencePrioritized.fir.kt
|
||||
public final enum class E : R|kotlin/Enum<E>| {
|
||||
private constructor(): R|E| {
|
||||
super<R|kotlin/Enum<E>|>()
|
||||
}
|
||||
|
||||
public final val entries: R|kotlin/Int| = Int(0)
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
public final static fun values(): R|kotlin/Array<E>| {
|
||||
}
|
||||
|
||||
public final static fun valueOf(value: R|kotlin/String|): R|E| {
|
||||
}
|
||||
|
||||
public final static val entries: R|kotlin/enums/EnumEntries<E>|
|
||||
public get(): R|kotlin/enums/EnumEntries<E>|
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
Q|E|::R|/E.entries*s|
|
||||
lval ref: R|kotlin/reflect/KProperty0<kotlin/enums/EnumEntries<E>>| = Q|E|::R|/E.entries*s|
|
||||
lval refType: R|(E) -> kotlin/Int| = Q|E|::R|/E.entries|
|
||||
lval refTypeWithAnyExpectedType: R|kotlin/Any| = Q|E|::R|/E.entries*s|
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: +EnumEntries +PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
enum class E {
|
||||
;
|
||||
|
||||
val entries: Int = 0
|
||||
}
|
||||
|
||||
fun test() {
|
||||
E::<!DEPRECATED_ACCESS_TO_ENUM_ENTRY_PROPERTY_AS_REFERENCE!>entries<!>
|
||||
val ref = E::<!DEPRECATED_ACCESS_TO_ENUM_ENTRY_PROPERTY_AS_REFERENCE!>entries<!>
|
||||
val refType: (E) -> Int = E::entries
|
||||
val refTypeWithAnyExpectedType: Any = E::<!DEPRECATED_ACCESS_TO_ENUM_ENTRY_PROPERTY_AS_REFERENCE!>entries<!>
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// !LANGUAGE: +EnumEntries +PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
package pckg
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object
|
||||
}
|
||||
|
||||
val A.Companion.entries: Int get() = 0
|
||||
|
||||
fun test() {
|
||||
A.entries
|
||||
A.Companion.entries
|
||||
|
||||
with(A) {
|
||||
this.entries
|
||||
entries
|
||||
}
|
||||
|
||||
with(A.Companion) {
|
||||
entries
|
||||
}
|
||||
|
||||
val aCompanion = A.Companion
|
||||
aCompanion.entries
|
||||
}
|
||||
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
FILE: entriesPropertyAsExtensionClashPrioritized.fir.kt
|
||||
package pckg
|
||||
|
||||
public final enum class A : R|kotlin/Enum<pckg/A>| {
|
||||
private constructor(): R|pckg/A| {
|
||||
super<R|kotlin/Enum<pckg/A>|>()
|
||||
}
|
||||
|
||||
public final companion object Companion : R|kotlin/Any| {
|
||||
private constructor(): R|pckg/A.Companion| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static fun values(): R|kotlin/Array<pckg/A>| {
|
||||
}
|
||||
|
||||
public final static fun valueOf(value: R|kotlin/String|): R|pckg/A| {
|
||||
}
|
||||
|
||||
public final static val entries: R|kotlin/enums/EnumEntries<pckg/A>|
|
||||
public get(): R|kotlin/enums/EnumEntries<pckg/A>|
|
||||
|
||||
}
|
||||
public final val R|pckg/A.Companion|.entries: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int| {
|
||||
^ Int(0)
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
Q|pckg/A|.R|pckg/A.entries*s|
|
||||
Q|pckg/A.Companion|.R|pckg/entries|
|
||||
R|kotlin/with|<R|pckg/A.Companion|, R|kotlin/Int|>(Q|pckg/A|, <L> = with@fun R|pckg/A.Companion|.<anonymous>(): R|kotlin/Int| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
this@R|special/anonymous|.R|pckg/entries|
|
||||
^ this@R|special/anonymous|.R|pckg/entries|
|
||||
}
|
||||
)
|
||||
R|kotlin/with|<R|pckg/A.Companion|, R|kotlin/Int|>(Q|pckg/A.Companion|, <L> = with@fun R|pckg/A.Companion|.<anonymous>(): R|kotlin/Int| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^ this@R|special/anonymous|.R|pckg/entries|
|
||||
}
|
||||
)
|
||||
lval aCompanion: R|pckg/A.Companion| = Q|pckg/A.Companion|
|
||||
R|<local>/aCompanion|.R|pckg/entries|
|
||||
}
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// !LANGUAGE: +EnumEntries +PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
package pckg
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object
|
||||
}
|
||||
|
||||
val A.Companion.entries: Int get() = 0
|
||||
|
||||
fun test() {
|
||||
A.<!DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY!>entries<!>
|
||||
A.Companion.entries
|
||||
|
||||
with(A) {
|
||||
this.entries
|
||||
entries
|
||||
}
|
||||
|
||||
with(A.Companion) {
|
||||
entries
|
||||
}
|
||||
|
||||
val aCompanion = A.Companion
|
||||
aCompanion.entries
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: +EnumEntries +PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
package foo
|
||||
|
||||
import foo.A.Companion.entries
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.entries
|
||||
|
||||
with(A) {
|
||||
entries
|
||||
}
|
||||
}
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
FILE: entriesPropertyImportedClashPrioritized.fir.kt
|
||||
package foo
|
||||
|
||||
public final enum class A : R|kotlin/Enum<foo/A>| {
|
||||
private constructor(): R|foo/A| {
|
||||
super<R|kotlin/Enum<foo/A>|>()
|
||||
}
|
||||
|
||||
public final companion object Companion : R|kotlin/Any| {
|
||||
private constructor(): R|foo/A.Companion| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val entries: R|kotlin/Int| = Int(0)
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
}
|
||||
|
||||
public final static fun values(): R|kotlin/Array<foo/A>| {
|
||||
}
|
||||
|
||||
public final static fun valueOf(value: R|kotlin/String|): R|foo/A| {
|
||||
}
|
||||
|
||||
public final static val entries: R|kotlin/enums/EnumEntries<foo/A>|
|
||||
public get(): R|kotlin/enums/EnumEntries<foo/A>|
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
Q|foo/A|.R|foo/A.entries*s|
|
||||
R|kotlin/with|<R|foo/A.Companion|, R|kotlin/Int|>(Q|foo/A|, <L> = with@fun R|foo/A.Companion|.<anonymous>(): R|kotlin/Int| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^ this@R|special/anonymous|.R|foo/A.Companion.entries|
|
||||
}
|
||||
)
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: +EnumEntries +PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
package foo
|
||||
|
||||
import foo.A.Companion.entries
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.<!DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY!>entries<!>
|
||||
|
||||
with(A) {
|
||||
entries
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
compiler/testData/diagnostics/tests/enum/entries/entriesPropertyWithJvmStaticClashPrioritized.fir.kt
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +EnumEntries +PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.entries
|
||||
|
||||
with(A) {
|
||||
entries
|
||||
}
|
||||
|
||||
A.Companion.entries
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
FILE: entriesPropertyWithJvmStaticClashPrioritized.fir.kt
|
||||
public final enum class A : R|kotlin/Enum<A>| {
|
||||
private constructor(): R|A| {
|
||||
super<R|kotlin/Enum<A>|>()
|
||||
}
|
||||
|
||||
public final companion object Companion : R|kotlin/Any| {
|
||||
private constructor(): R|A.Companion| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@R|kotlin/jvm/JvmStatic|() public final val entries: R|kotlin/Int| = Int(0)
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
}
|
||||
|
||||
public final static fun values(): R|kotlin/Array<A>| {
|
||||
}
|
||||
|
||||
public final static fun valueOf(value: R|kotlin/String|): R|A| {
|
||||
}
|
||||
|
||||
public final static val entries: R|kotlin/enums/EnumEntries<A>|
|
||||
public get(): R|kotlin/enums/EnumEntries<A>|
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
Q|A|.R|/A.entries*s|
|
||||
R|kotlin/with|<R|A.Companion|, R|kotlin/Int|>(Q|A|, <L> = with@fun R|A.Companion|.<anonymous>(): R|kotlin/Int| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^ this@R|special/anonymous|.R|/A.Companion.entries|
|
||||
}
|
||||
)
|
||||
Q|A.Companion|.R|/A.Companion.entries|
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +EnumEntries +PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.<!DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY!>entries<!>
|
||||
|
||||
with(A) {
|
||||
entries
|
||||
}
|
||||
|
||||
A.Companion.entries
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
// !LANGUAGE: +EnumEntries +PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
package pckg
|
||||
|
||||
val entries = "E"
|
||||
|
||||
enum class E {
|
||||
;
|
||||
|
||||
fun foo() {
|
||||
entries.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
pckg.entries.length
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
enum class E {
|
||||
;
|
||||
|
||||
class B {
|
||||
fun foo() {
|
||||
entries.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
pckg.entries.length
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
val entries = 0
|
||||
|
||||
fun foo() {
|
||||
// technically, this warning is incorrect but I believe it's OK to report anyway
|
||||
// first, logic in the compiler will be complicated if we'll try to avoid reporting warnings here
|
||||
// second, this code smells, it'd be better to use qualifiers here anyway
|
||||
entries + 4
|
||||
this.entries + 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
FILE: nameShadowingOfExternallyDefinedEntriesPrioritized.fir.kt
|
||||
package pckg
|
||||
|
||||
public final val entries: R|kotlin/String| = String(E)
|
||||
public get(): R|kotlin/String|
|
||||
public final enum class E : R|kotlin/Enum<pckg/E>| {
|
||||
private constructor(): R|pckg/E| {
|
||||
super<R|kotlin/Enum<pckg/E>|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
R|pckg/E.entries*s|.<Unresolved name: length>#
|
||||
Q|pckg|.R|pckg/entries|.R|kotlin/String.length|
|
||||
}
|
||||
|
||||
public final static fun values(): R|kotlin/Array<pckg/E>| {
|
||||
}
|
||||
|
||||
public final static fun valueOf(value: R|kotlin/String|): R|pckg/E| {
|
||||
}
|
||||
|
||||
public final static val entries: R|kotlin/enums/EnumEntries<pckg/E>|
|
||||
public get(): R|kotlin/enums/EnumEntries<pckg/E>|
|
||||
|
||||
}
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|pckg/A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final enum class E : R|kotlin/Enum<pckg/A.E>| {
|
||||
private constructor(): R|pckg/A.E| {
|
||||
super<R|kotlin/Enum<pckg/A.E>|>()
|
||||
}
|
||||
|
||||
public final class B : R|kotlin/Any| {
|
||||
public constructor(): R|pckg/A.E.B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
R|pckg/A.E.entries*s|.<Unresolved name: length>#
|
||||
Q|pckg|.R|pckg/entries|.R|kotlin/String.length|
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final class C : R|kotlin/Any| {
|
||||
public constructor(): R|pckg/A.E.C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val entries: R|kotlin/Int| = Int(0)
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
this@R|pckg/A.E.C|.R|pckg/A.E.C.entries|.R|kotlin/Int.plus|(Int(4))
|
||||
this@R|pckg/A.E.C|.R|pckg/A.E.C.entries|.R|kotlin/Int.plus|(Int(4))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static fun values(): R|kotlin/Array<pckg/A.E>| {
|
||||
}
|
||||
|
||||
public final static fun valueOf(value: R|kotlin/String|): R|pckg/A.E| {
|
||||
}
|
||||
|
||||
public final static val entries: R|kotlin/enums/EnumEntries<pckg/A.E>|
|
||||
public get(): R|kotlin/enums/EnumEntries<pckg/A.E>|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
// !LANGUAGE: +EnumEntries +PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
package pckg
|
||||
|
||||
val entries = "E"
|
||||
|
||||
enum class E {
|
||||
;
|
||||
|
||||
fun foo() {
|
||||
<!DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM!>entries<!>.length
|
||||
pckg.entries.length
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
enum class E {
|
||||
;
|
||||
|
||||
class B {
|
||||
fun foo() {
|
||||
<!DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM!>entries<!>.length
|
||||
pckg.entries.length
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
val entries = 0
|
||||
|
||||
fun foo() {
|
||||
// technically, this warning is incorrect but I believe it's OK to report anyway
|
||||
// first, logic in the compiler will be complicated if we'll try to avoid reporting warnings here
|
||||
// second, this code smells, it'd be better to use qualifiers here anyway
|
||||
<!DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM!>entries<!> + 4
|
||||
this.entries + 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// !LANGUAGE: +EnumEntries -PrioritizedEnumEntries
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
|
||||
|
||||
Generated
+30
@@ -11077,6 +11077,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/conflictingPropertyEntriesAndReferenceOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingPropertyEntriesAndReferencePrioritized.kt")
|
||||
public void testConflictingPropertyEntriesAndReferencePrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/conflictingPropertyEntriesAndReferencePrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClash.kt")
|
||||
public void testEntriesPropertyAsExtensionClash() throws Exception {
|
||||
@@ -11089,6 +11095,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClashPrioritized.kt")
|
||||
public void testEntriesPropertyAsExtensionClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClash.kt")
|
||||
public void testEntriesPropertyImportedClash() throws Exception {
|
||||
@@ -11101,6 +11113,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClashPrioritized.kt")
|
||||
public void testEntriesPropertyImportedClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClash.kt")
|
||||
public void testEntriesPropertyInCompanionClash() throws Exception {
|
||||
@@ -11125,6 +11143,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyWithJvmStaticClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyWithJvmStaticClashPrioritized.kt")
|
||||
public void testEntriesPropertyWithJvmStaticClashPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyWithJvmStaticClashPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesUnsupported.kt")
|
||||
public void testEntriesUnsupported() throws Exception {
|
||||
@@ -11173,6 +11197,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nameShadowingOfExternallyDefinedEntriesPrioritized.kt")
|
||||
public void testNameShadowingOfExternallyDefinedEntriesPrioritized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesPrioritized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsic.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsic() throws Exception {
|
||||
|
||||
@@ -297,6 +297,7 @@ enum class LanguageFeature(
|
||||
|
||||
ReferencesToSyntheticJavaProperties(KOTLIN_2_1), // KT-8575
|
||||
ProhibitImplementingVarByInheritedVal(KOTLIN_2_1, kind = BUG_FIX), // KT-56779
|
||||
PrioritizedEnumEntries(KOTLIN_2_1, kind = UNSTABLE_FEATURE), // KT-xxxxx
|
||||
|
||||
// End of 2.* language features --------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user