Add a warning for a user-defined entries property call
^KT-53153
This commit is contained in:
committed by
Space Team
parent
695a538529
commit
989fc886e1
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: -EnumEntries
|
||||
|
||||
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
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: -EnumEntries
|
||||
|
||||
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<!>
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
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*/ fun valueOf(/*0*/ value: kotlin.String): pckg.A
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<pckg.A>
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: -EnumEntries
|
||||
|
||||
package foo
|
||||
|
||||
import foo.A.Companion.entries
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.entries
|
||||
|
||||
with(A) {
|
||||
entries
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: -EnumEntries
|
||||
|
||||
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<!>
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
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*/ fun valueOf(/*0*/ value: kotlin.String): foo.A
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<foo.A>
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// !LANGUAGE: -EnumEntries
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.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
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// !LANGUAGE: -EnumEntries
|
||||
|
||||
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<!>
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
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*/ fun valueOf(/*0*/ value: kotlin.String): A
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<A>
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: -EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.<!OPT_IN_USAGE_ERROR!>entries<!>
|
||||
|
||||
with(A) {
|
||||
entries
|
||||
}
|
||||
|
||||
A.Companion.entries
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: -EnumEntries
|
||||
// WITH_STDLIB
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val entries = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.<!DEBUG_INFO_CALL("fqName: A.Companion.entries; typeCall: variable"), DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY!>entries<!>
|
||||
|
||||
with(A) {
|
||||
<!DEBUG_INFO_CALL("fqName: A.Companion.entries; typeCall: variable")!>entries<!>
|
||||
}
|
||||
|
||||
A.Companion.<!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()
|
||||
@kotlin.jvm.JvmStatic 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>
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: -EnumEntries
|
||||
|
||||
package pckg
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object
|
||||
}
|
||||
|
||||
val <T> T.entries: Int get() = 0
|
||||
|
||||
fun test() {
|
||||
A.entries
|
||||
A.Companion.entries
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: -EnumEntries
|
||||
|
||||
package pckg
|
||||
|
||||
enum class A {
|
||||
;
|
||||
|
||||
companion object
|
||||
}
|
||||
|
||||
val <T> T.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<!>
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package
|
||||
|
||||
package pckg {
|
||||
public val </*0*/ T> T.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*/ fun valueOf(/*0*/ value: kotlin.String): pckg.A
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<pckg.A>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user