Deprecate ambiguous cases in FE 1.0: companion property vs enum entry
^KT-37591 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
24bb9a4e14
commit
46b297477c
@@ -0,0 +1,40 @@
|
||||
// !CHECK_TYPE
|
||||
// SKIP_TXT
|
||||
|
||||
// FILE: test.kt
|
||||
package test
|
||||
enum class E {
|
||||
Entry;
|
||||
companion object {
|
||||
val Entry = ""
|
||||
val NotEntry = ""
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
import test.E.Entry
|
||||
import test.E.Companion as W
|
||||
import test.E as U
|
||||
import test.E
|
||||
|
||||
fun foo() {
|
||||
E.Entry checkType { _<E>() }
|
||||
E.Entry checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
|
||||
E.Companion.Entry checkType { _<String>() }
|
||||
E.NotEntry checkType { _<String>() }
|
||||
Entry checkType { _<E>() }
|
||||
|
||||
W.Entry checkType { _<String>() }
|
||||
}
|
||||
|
||||
// FILE: Aliased.kt
|
||||
|
||||
import test.E as U
|
||||
|
||||
fun bar() {
|
||||
U.Entry checkType { <!INAPPLICABLE_CANDIDATE!>_<!><<!UNRESOLVED_REFERENCE!>E<!>>() }
|
||||
U.Entry checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
|
||||
U.Companion.Entry checkType { _<String>() }
|
||||
U.NotEntry checkType { _<String>() }
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// !CHECK_TYPE
|
||||
// SKIP_TXT
|
||||
|
||||
// FILE: test.kt
|
||||
package test
|
||||
enum class E {
|
||||
Entry;
|
||||
companion object {
|
||||
val Entry = ""
|
||||
val NotEntry = ""
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
import test.E.Entry
|
||||
import test.E.Companion as W
|
||||
import test.E as U
|
||||
import test.E
|
||||
|
||||
fun foo() {
|
||||
E.<!DEPRECATED_ACCESS_TO_ENUM_COMPANION_PROPERTY!>Entry<!> checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><E>() }
|
||||
E.<!DEPRECATED_ACCESS_TO_ENUM_COMPANION_PROPERTY!>Entry<!> checkType { _<String>() }
|
||||
E.Companion.Entry checkType { _<String>() }
|
||||
E.NotEntry checkType { _<String>() }
|
||||
Entry checkType { _<E>() }
|
||||
|
||||
W.Entry checkType { _<String>() }
|
||||
}
|
||||
|
||||
// FILE: Aliased.kt
|
||||
|
||||
import test.E as U
|
||||
|
||||
fun bar() {
|
||||
U.<!DEPRECATED_ACCESS_TO_ENUM_COMPANION_PROPERTY!>Entry<!> checkType { _<<!UNRESOLVED_REFERENCE!>E<!>>() }
|
||||
U.<!DEPRECATED_ACCESS_TO_ENUM_COMPANION_PROPERTY!>Entry<!> checkType { _<String>() }
|
||||
U.Companion.Entry checkType { _<String>() }
|
||||
U.NotEntry checkType { _<String>() }
|
||||
}
|
||||
Reference in New Issue
Block a user