Do not recreate compile time initializer to avoid type info loosing

When we resolve arguments of annotation, expected type of parameters can
 be unknown. Therefore, if we'll try to load constants without expected type,
 info about unsigndness will be lost. For primitives it worked because we
 can differ type by its value
This commit is contained in:
Mikhail Zarechenskiy
2018-07-09 12:35:22 +03:00
parent 0c6757a8b0
commit 9b6e8fa5d1
3 changed files with 7 additions and 11 deletions
@@ -705,11 +705,7 @@ private class ConstantExpressionEvaluatorVisitor(
// TODO: FIXME: see KT-10425
if (callableDescriptor is PropertyDescriptor && callableDescriptor.modality != Modality.FINAL) return null
val variableInitializer = callableDescriptor.compileTimeInitializer ?: return null
return createConstant(
variableInitializer.value,
expectedType,
return callableDescriptor.compileTimeInitializer?.wrap(
CompileTimeConstant.Parameters(
canBeUsedInAnnotation = isPropertyCompileTimeConstant(callableDescriptor),
isPure = false,