FIR: report ENUM_ENTRY_AS_TYPE and IS_ENUM_TYPE

These two diagnostics are similar: both are reported on type references
to enum entries. But `IS_ENUM_TYPE` is reported if the type ref is an
operand of `is` operator. To pass along this contextual information, a
boolean is added to FirSpecificTypeResolverTransformer.
This commit is contained in:
Tianyu Geng
2021-06-08 15:14:41 -07:00
committed by Mikhail Glukhikh
parent 6dc75c2e51
commit c648356887
18 changed files with 157 additions and 45 deletions
@@ -3,4 +3,4 @@ enum class MyEnum {
SECOND
}
fun foo(me: MyEnum): Boolean = if (me is <!UNRESOLVED_REFERENCE!>MyEnum.FIRST<!>) true else false
fun foo(me: MyEnum): Boolean = if (me is <!IS_ENUM_ENTRY!>MyEnum.FIRST<!>) true else false
@@ -2,4 +2,4 @@ enum class E {
ENTRY
}
class A : <!UNRESOLVED_REFERENCE!>E.ENTRY<!>
class A : <!ENUM_ENTRY_AS_TYPE!>E.ENTRY<!>
@@ -3,4 +3,4 @@ enum class MyEnum {
SECOND
}
fun foo(me: MyEnum): Boolean = me is <!UNRESOLVED_REFERENCE!>MyEnum.FIRST<!>
fun foo(me: MyEnum): Boolean = me is <!IS_ENUM_ENTRY!>MyEnum.FIRST<!>