[FIR] Properly prohibit access to enum companion in enum entry initialization section

^KT-57456 Fixed
KT-57608
This commit is contained in:
Dmitriy Novozhilov
2023-03-27 19:43:21 +03:00
committed by Space Team
parent cbfa155333
commit e02194b461
11 changed files with 163 additions and 163 deletions
@@ -9,7 +9,7 @@ enum class B(val x: Int) {
}
enum class C(val x: Int) {
C1(<!UNINITIALIZED_ENUM_COMPANION, UNINITIALIZED_VARIABLE!>SUM<!>),
C1(<!UNINITIALIZED_ENUM_COMPANION!>SUM<!>),
C2(1);
companion object {
@@ -26,8 +26,8 @@ enum class Fruit(personal: Int) {
val common = 20
}
val score = personal + <!UNINITIALIZED_VARIABLE!>common<!>
val score2 = { personal + <!UNINITIALIZED_VARIABLE!>common<!> }()
val score = personal + <!UNINITIALIZED_ENUM_COMPANION!>common<!>
val score2 = { personal + common }()
}
// Another example from KT-11769