Enum entries: add new tests with language feature ON & fix checker
This commit is contained in:
committed by
Space Team
parent
c534c54a1c
commit
41966a745e
+30
@@ -10391,18 +10391,36 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClashOn.kt")
|
||||
public void testEntriesPropertyAsExtensionClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClash.kt")
|
||||
public void testEntriesPropertyImportedClash() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClashOn.kt")
|
||||
public void testEntriesPropertyImportedClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClash.kt")
|
||||
public void testEntriesPropertyInCompanionClash() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClashOn.kt")
|
||||
public void testEntriesPropertyInCompanionClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyWithJvmStaticClash.kt")
|
||||
public void testEntriesPropertyWithJvmStaticClash() throws Exception {
|
||||
@@ -10439,11 +10457,23 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntries.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nameShadowingOfExternallyDefinedEntriesOn.kt")
|
||||
public void testNameShadowingOfExternallyDefinedEntriesOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsic.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/redeclarationOfEnumEntriesNameWithIntrinsic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsicOn.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsicOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/redeclarationOfEnumEntriesNameWithIntrinsicOn.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+30
@@ -10397,18 +10397,36 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClashOn.kt")
|
||||
public void testEntriesPropertyAsExtensionClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClash.kt")
|
||||
public void testEntriesPropertyImportedClash() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClashOn.kt")
|
||||
public void testEntriesPropertyImportedClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClash.kt")
|
||||
public void testEntriesPropertyInCompanionClash() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClashOn.kt")
|
||||
public void testEntriesPropertyInCompanionClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyWithJvmStaticClash.kt")
|
||||
public void testEntriesPropertyWithJvmStaticClash() throws Exception {
|
||||
@@ -10445,11 +10463,23 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntries.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nameShadowingOfExternallyDefinedEntriesOn.kt")
|
||||
public void testNameShadowingOfExternallyDefinedEntriesOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsic.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/redeclarationOfEnumEntriesNameWithIntrinsic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsicOn.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsicOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/redeclarationOfEnumEntriesNameWithIntrinsicOn.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+30
@@ -10391,18 +10391,36 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClashOn.kt")
|
||||
public void testEntriesPropertyAsExtensionClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClash.kt")
|
||||
public void testEntriesPropertyImportedClash() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClashOn.kt")
|
||||
public void testEntriesPropertyImportedClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClash.kt")
|
||||
public void testEntriesPropertyInCompanionClash() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClashOn.kt")
|
||||
public void testEntriesPropertyInCompanionClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyWithJvmStaticClash.kt")
|
||||
public void testEntriesPropertyWithJvmStaticClash() throws Exception {
|
||||
@@ -10439,11 +10457,23 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntries.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nameShadowingOfExternallyDefinedEntriesOn.kt")
|
||||
public void testNameShadowingOfExternallyDefinedEntriesOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsic.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/redeclarationOfEnumEntriesNameWithIntrinsic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsicOn.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsicOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/redeclarationOfEnumEntriesNameWithIntrinsicOn.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+8
-2
@@ -32,7 +32,12 @@ object CustomEnumEntriesMigrationCallChecker : CallChecker {
|
||||
) {
|
||||
context.trace.report(Errors.DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY.on(reportOn))
|
||||
} else if (descriptor.isCallToExternalEntriesInsideEnum(reportOn)) {
|
||||
context.trace.report(Errors.DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM.on(reportOn))
|
||||
if (context.trace.bindingContext.diagnostics.forElement(reportOn).none {
|
||||
it.factory == Errors.DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM
|
||||
}
|
||||
) {
|
||||
context.trace.report(Errors.DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM.on(reportOn))
|
||||
}
|
||||
} else if (descriptor.isReferenceToMemberEntriesWithoutExpectedFunctionalType(reportOn, context)) {
|
||||
context.trace.report(Errors.DEPRECATED_ACCESS_TO_ENUM_ENTRY_PROPERTY_AS_REFERENCE.on(reportOn))
|
||||
}
|
||||
@@ -54,8 +59,9 @@ object CustomEnumEntriesMigrationCallChecker : CallChecker {
|
||||
}
|
||||
|
||||
private fun PropertyDescriptor.isCallToExternalEntriesInsideEnum(contextExpression: PsiElement): Boolean {
|
||||
val parent = contextExpression.parent
|
||||
return !DescriptorUtils.isEnumClass(this.containingDeclaration) &&
|
||||
contextExpression.parent !is KtDotQualifiedExpression &&
|
||||
(parent !is KtDotQualifiedExpression || parent.receiverExpression === contextExpression) &&
|
||||
contextExpression.parentsWithSelf.any { it is KtClass && it.isEnum() }
|
||||
}
|
||||
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
package pckg
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object
|
||||
}
|
||||
|
||||
val A.Companion.entries: Int get() = 0
|
||||
|
||||
fun test() {
|
||||
A.<!OPT_IN_USAGE_ERROR!>entries<!>
|
||||
A.Companion.entries
|
||||
|
||||
with(A) {
|
||||
this.entries
|
||||
entries
|
||||
}
|
||||
|
||||
with(A.Companion) {
|
||||
entries
|
||||
}
|
||||
|
||||
val aCompanion = A.Companion
|
||||
aCompanion.entries
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
package pckg
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object
|
||||
}
|
||||
|
||||
val A.Companion.entries: Int get() = 0
|
||||
|
||||
fun test() {
|
||||
A.<!DEBUG_INFO_CALL("fqName: pckg.entries; typeCall: variable"), DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY!>entries<!>
|
||||
A.Companion.<!DEBUG_INFO_CALL("fqName: pckg.entries; typeCall: variable")!>entries<!>
|
||||
|
||||
with(A) {
|
||||
this.entries
|
||||
<!DEBUG_INFO_CALL("fqName: pckg.entries; typeCall: variable")!>entries<!>
|
||||
}
|
||||
|
||||
with(A.Companion) {
|
||||
<!DEBUG_INFO_CALL("fqName: pckg.entries; typeCall: variable")!>entries<!>
|
||||
}
|
||||
|
||||
val aCompanion = A.Companion
|
||||
aCompanion.<!DEBUG_INFO_CALL("fqName: pckg.entries; typeCall: variable")!>entries<!>
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package
|
||||
|
||||
package pckg {
|
||||
public val pckg.A.Companion.entries: kotlin.Int
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public final enum class A : kotlin.Enum<pckg.A> {
|
||||
private constructor A()
|
||||
@kotlin.internal.IntrinsicConstEvaluation public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: pckg.A): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<pckg.A!>!
|
||||
public final 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 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
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ val entries: kotlin.enums.EnumEntries<pckg.A>
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): pckg.A
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<pckg.A>
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
package foo
|
||||
|
||||
import foo.A.Companion.entries
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.<!OPT_IN_USAGE_ERROR!>entries<!>
|
||||
|
||||
with(A) {
|
||||
entries
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
package foo
|
||||
|
||||
import foo.A.Companion.entries
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.<!DEBUG_INFO_CALL("fqName: foo.A.Companion.entries; typeCall: variable"), DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY!>entries<!>
|
||||
|
||||
with(A) {
|
||||
<!DEBUG_INFO_CALL("fqName: foo.A.Companion.entries; typeCall: variable")!>entries<!>
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package
|
||||
|
||||
package foo {
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public final enum class A : kotlin.Enum<foo.A> {
|
||||
private constructor A()
|
||||
@kotlin.internal.IntrinsicConstEvaluation public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: foo.A): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<foo.A!>!
|
||||
public final 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 entries: kotlin.Int = 0
|
||||
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
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ val entries: kotlin.enums.EnumEntries<foo.A>
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): foo.A
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<foo.A>
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.<!OPT_IN_USAGE_ERROR!>entries<!>
|
||||
A.Companion.entries
|
||||
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(A) {
|
||||
entries
|
||||
this.entries
|
||||
<!UNRESOLVED_REFERENCE!>values<!>() // to be sure that we don't resolve into synthetic 'values'
|
||||
}
|
||||
|
||||
with(A.Companion) {
|
||||
entries
|
||||
}
|
||||
|
||||
val aCompanion = A.Companion
|
||||
aCompanion.entries
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.<!DEBUG_INFO_CALL("fqName: A.Companion.entries; typeCall: variable"), DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY!>entries<!>
|
||||
A.Companion.<!DEBUG_INFO_CALL("fqName: A.Companion.entries; typeCall: variable")!>entries<!>
|
||||
|
||||
with(A) {
|
||||
<!DEBUG_INFO_CALL("fqName: A.Companion.entries; typeCall: variable")!>entries<!>
|
||||
this.entries
|
||||
<!UNRESOLVED_REFERENCE!>values<!>() // to be sure that we don't resolve into synthetic 'values'
|
||||
}
|
||||
|
||||
with(A.Companion) {
|
||||
<!DEBUG_INFO_CALL("fqName: A.Companion.entries; typeCall: variable")!>entries<!>
|
||||
}
|
||||
|
||||
val aCompanion = A.Companion
|
||||
aCompanion.<!DEBUG_INFO_CALL("fqName: A.Companion.entries; typeCall: variable")!>entries<!>
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public final enum class A : kotlin.Enum<A> {
|
||||
private constructor A()
|
||||
@kotlin.internal.IntrinsicConstEvaluation public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: A): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<A!>!
|
||||
public final 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 entries: kotlin.Int = 0
|
||||
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
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ val entries: kotlin.enums.EnumEntries<A>
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): A
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<A>
|
||||
}
|
||||
+1
-1
@@ -6,4 +6,4 @@ enum class Ambiguous {
|
||||
first, entries;
|
||||
}
|
||||
|
||||
val e = Ambiguous.entries
|
||||
val e = Ambiguous.entries.ordinal
|
||||
|
||||
+2
-2
@@ -16,5 +16,5 @@ FILE: enumEntriesAmbiguity.fir.kt
|
||||
public get(): R|kotlin/enums/EnumEntries<Ambiguous>|
|
||||
|
||||
}
|
||||
public final val e: R|Ambiguous| = Q|Ambiguous|.R|/Ambiguous.entries|
|
||||
public get(): R|Ambiguous|
|
||||
public final val e: R|kotlin/Int| = Q|Ambiguous|.R|/Ambiguous.entries|.R|SubstitutionOverride</Ambiguous.ordinal: R|kotlin/Int|>|
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
@@ -6,4 +6,4 @@ enum class Ambiguous {
|
||||
first, <!DEPRECATED_DECLARATION_OF_ENUM_ENTRY!>entries;<!>
|
||||
}
|
||||
|
||||
val e = Ambiguous.entries
|
||||
val e = Ambiguous.entries.ordinal
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
public val e: Ambiguous
|
||||
public val e: kotlin.Int
|
||||
|
||||
public final enum class Ambiguous : kotlin.Enum<Ambiguous> {
|
||||
enum entry first
|
||||
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
package pckg
|
||||
|
||||
val entries = "E"
|
||||
|
||||
enum class E {
|
||||
;
|
||||
|
||||
fun foo() {
|
||||
<!OPT_IN_USAGE_ERROR!>entries<!>.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
pckg.entries.length
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
enum class E {
|
||||
;
|
||||
|
||||
class B {
|
||||
fun foo() {
|
||||
<!OPT_IN_USAGE_ERROR!>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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
package
|
||||
|
||||
package pckg {
|
||||
public val entries: kotlin.String = "E"
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
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 enum class E : kotlin.Enum<pckg.A.E> {
|
||||
private constructor E()
|
||||
@kotlin.internal.IntrinsicConstEvaluation public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: pckg.A.E): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<pckg.A.E!>!
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class B {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class C {
|
||||
public constructor C()
|
||||
public final val entries: kotlin.Int = 0
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ val entries: kotlin.enums.EnumEntries<pckg.A.E>
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): pckg.A.E
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<pckg.A.E>
|
||||
}
|
||||
}
|
||||
|
||||
public final enum class E : kotlin.Enum<pckg.E> {
|
||||
private constructor E()
|
||||
@kotlin.internal.IntrinsicConstEvaluation public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: pckg.E): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final fun foo(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<pckg.E!>!
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ val entries: kotlin.enums.EnumEntries<pckg.E>
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): pckg.E
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<pckg.E>
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
enum class E {
|
||||
entries, Entries;
|
||||
|
||||
fun foo() {
|
||||
entries.ordinal
|
||||
E.entries.ordinal
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// !LANGUAGE: +EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
enum class E {
|
||||
<!DEPRECATED_DECLARATION_OF_ENUM_ENTRY!>entries,<!> Entries;
|
||||
|
||||
fun foo() {
|
||||
entries.ordinal
|
||||
E.entries.ordinal
|
||||
}
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
package
|
||||
|
||||
public final enum class E : kotlin.Enum<E> {
|
||||
enum entry entries
|
||||
|
||||
enum entry Entries
|
||||
|
||||
private constructor E()
|
||||
@kotlin.internal.IntrinsicConstEvaluation public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: E): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final fun foo(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<E!>!
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ val entries: kotlin.enums.EnumEntries<E>
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): E
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<E>
|
||||
}
|
||||
Generated
+30
@@ -10397,18 +10397,36 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyAsExtensionClashOn.kt")
|
||||
public void testEntriesPropertyAsExtensionClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClash.kt")
|
||||
public void testEntriesPropertyImportedClash() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyImportedClashOn.kt")
|
||||
public void testEntriesPropertyImportedClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImportedClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClash.kt")
|
||||
public void testEntriesPropertyInCompanionClash() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyInCompanionClashOn.kt")
|
||||
public void testEntriesPropertyInCompanionClashOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClashOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("entriesPropertyWithJvmStaticClash.kt")
|
||||
public void testEntriesPropertyWithJvmStaticClash() throws Exception {
|
||||
@@ -10445,11 +10463,23 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntries.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nameShadowingOfExternallyDefinedEntriesOn.kt")
|
||||
public void testNameShadowingOfExternallyDefinedEntriesOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/nameShadowingOfExternallyDefinedEntriesOn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsic.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/redeclarationOfEnumEntriesNameWithIntrinsic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redeclarationOfEnumEntriesNameWithIntrinsicOn.kt")
|
||||
public void testRedeclarationOfEnumEntriesNameWithIntrinsicOn() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/entries/redeclarationOfEnumEntriesNameWithIntrinsicOn.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
Reference in New Issue
Block a user