diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt index 9b77085ff28..99309422e45 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt @@ -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, diff --git a/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.txt b/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.txt index 30953e1574d..c125ba2ae3b 100644 --- a/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.txt +++ b/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.txt @@ -8,10 +8,10 @@ public const val ui1: kotlin.UInt = 0.toUInt() public const val ui2: kotlin.UInt = 42.toUInt() public const val ul0: kotlin.ULong = 3.toULong() public const val us0: kotlin.UShort = 2.toUShort() -@AnnoUB(ub0 = 1.toUByte(), ub1 = 1.toByte()) public fun f0(): kotlin.Unit -@AnnoUS(us0 = 7.toUShort(), us1 = 2.toShort()) public fun f1(): kotlin.Unit -@AnnoUI(ui0 = -1, ui1 = 0, ui2 = 42, ui3 = 100.toUInt()) public fun f2(): kotlin.Unit -@AnnoUL(ul0 = 3.toLong(), ul1 = 5.toULong()) public fun f3(): kotlin.Unit +@AnnoUB(ub0 = 1.toUByte(), ub1 = 1.toUByte()) public fun f0(): kotlin.Unit +@AnnoUS(us0 = 7.toUShort(), us1 = 2.toUShort()) public fun f1(): kotlin.Unit +@AnnoUI(ui0 = -1.toUInt(), ui1 = 0.toUInt(), ui2 = 42.toUInt(), ui3 = 100.toUInt()) public fun f2(): kotlin.Unit +@AnnoUL(ul0 = 3.toULong(), ul1 = 5.toULong()) public fun f3(): kotlin.Unit public final annotation class AnnoUB : kotlin.Annotation { public constructor AnnoUB(/*0*/ ub0: kotlin.UByte, /*1*/ ub1: kotlin.UByte) diff --git a/compiler/testData/diagnostics/testsWithUnsignedTypes/unsignedLiteralsTypeCheck.txt b/compiler/testData/diagnostics/testsWithUnsignedTypes/unsignedLiteralsTypeCheck.txt index 9bb84503afa..8d7712457ac 100644 --- a/compiler/testData/diagnostics/testsWithUnsignedTypes/unsignedLiteralsTypeCheck.txt +++ b/compiler/testData/diagnostics/testsWithUnsignedTypes/unsignedLiteralsTypeCheck.txt @@ -13,5 +13,5 @@ public val m1: kotlin.UInt public val n0: kotlin.Number = 1.toUInt() public val u0: kotlin.UInt = 1.toUInt() public val u1: kotlin.UInt? = 1.toUInt() -public val u2: kotlin.UInt? = 1 -public val u3: kotlin.UInt? = 1 +public val u2: kotlin.UInt? = 1.toUInt() +public val u3: kotlin.UInt? = 1.toUInt()