[FIR] Treat unsigned numbers as primitives in constant checker

This commit is contained in:
Andrey Zinovyev
2021-05-11 17:53:53 +03:00
parent 9cadd1c8a7
commit 07e47140a6
3 changed files with 3 additions and 3 deletions
@@ -134,7 +134,7 @@ internal fun checkConstantArguments(
if (calleeReference.name == OperatorNameConventions.PLUS
&& expClassId != receiverClassId
&& (expClassId !in StandardClassIds.primitiveTypesAndString || receiverClassId !in StandardClassIds.primitiveTypesAndString)
&& (expClassId !in StandardClassIds.constantAllowedTypes || receiverClassId !in StandardClassIds.constantAllowedTypes)
) {
return ConstantArgumentKind.NOT_CONST
}
@@ -1,5 +1,4 @@
// WITH_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
const val a = "INT " + 0x8fffffffU
const val b = "BYTE " + 0x8ffU
@@ -68,7 +68,6 @@ object StandardClassIds {
Byte, Short, Int, Long,
Float, Double
)
val primitiveTypesAndString = primitiveTypes + String
val primitiveArrayTypeByElementType = primitiveTypes.associate { id -> id to id.shortClassName.primitiveArrayId() }
val elementTypeByPrimitiveArrayType = primitiveArrayTypeByElementType.inverseMap()
@@ -77,6 +76,8 @@ object StandardClassIds {
val unsignedArrayTypeByElementType = unsignedTypes.associate { id -> id to id.shortClassName.primitiveArrayId() }
val elementTypeByUnsignedArrayType = unsignedArrayTypeByElementType.inverseMap()
val constantAllowedTypes = primitiveTypes + unsignedTypes + String
val Continuation =
ClassId(StandardNames.COROUTINES_PACKAGE_FQ_NAME_RELEASE, StandardNames.CONTINUATION_INTERFACE_FQ_NAME_RELEASE.shortName())