Enum entries: add new tests with language feature ON & fix checker
This commit is contained in:
committed by
Space Team
parent
c534c54a1c
commit
41966a745e
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user