FIR IDE: make constant evaluator robust to arithmetic exception

This commit is contained in:
Jinseong Jeon
2021-10-28 00:10:20 -07:00
committed by Ilya Kirillov
parent e5bff514b6
commit c3c79b874d
10 changed files with 35 additions and 8 deletions
@@ -31,4 +31,4 @@ internal class KtFe10CompileTimeConstantProvider(override val analysisSession: K
val bindingTrace = DelegatingBindingTrace(bindingContext, "Binding trace for constant expression evaluation")
return evaluator.evaluateToConstantValue(expression, bindingTrace, TypeUtils.NO_EXPECTED_TYPE)?.toKtConstantValue()
}
}
}
@@ -229,6 +229,7 @@ internal fun ConstantValue<*>.toKtConstantValue(): KtConstantValue {
val arguments = value.allValueArguments.map { (name, v) -> KtNamedConstantValue(name.asString(), v.toKtConstantValue()) }
KtAnnotationConstantValue(value.annotationClass?.classId, arguments, null)
}
is ErrorValue -> KtErrorValue(this.toString())
else -> KtUnsupportedConstantValue
}
}
@@ -296,4 +297,4 @@ internal fun DeclarationDescriptor.render(analysisSession: KtFe10AnalysisSession
internal fun CallableMemberDescriptor.getSymbolPointerSignature(analysisSession: KtFe10AnalysisSession): String {
return render(analysisSession, KtDeclarationRendererOptions.DEFAULT)
}
}