Hi everybody! I start to write a custom Detekt rules. But run across some difficulties.
Could someone help me recognize if it is an enum or not? I tried to use
isEnum
, but it returned null.
override fun visitDotQualifiedExpression(expression: KtDotQualifiedExpression) {
super.visitDotQualifiedExpression(expression)
val receiverKotlinTypeInfo: KotlinTypeInfo? = bindingContext[BindingContext.EXPRESSION_TYPE_INFO, expression]
// but receiverKotlinTypeInfo is null, so
val receiverKotlinType: KotlinType? = receiverKotlinTypeInfo?.type
// is also null: receiverKotlinType == null
}
bindingContext[BindingContext.EXPRESSION_TYPE_INFO, expression]
is null, but the expression is correct.
In the logs, I got this:
receiverExpression.text = TestEnum.TEST2
- and it is my test enum with a child.