Fix exception from UAST: don't use constant of error type
#EA-121947 Fixed
This commit is contained in:
@@ -19,6 +19,7 @@ package org.jetbrains.uast.kotlin
|
||||
import com.intellij.psi.PsiType
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.constants.UnsignedErrorValueTypeConstant
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.uast.UExpression
|
||||
|
||||
@@ -35,6 +36,8 @@ interface KotlinEvaluatableUElement : UExpression {
|
||||
val ktElement = psi as? KtExpression ?: return null
|
||||
|
||||
val compileTimeConst = ktElement.analyze()[BindingContext.COMPILE_TIME_VALUE, ktElement]
|
||||
if (compileTimeConst is UnsignedErrorValueTypeConstant) return null
|
||||
|
||||
return compileTimeConst?.getValue(TypeUtils.NO_EXPECTED_TYPE)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user