psi2ir: support unsigned integer literals

NB in FE unsigned integer constants are now represented using signed
integer types (e.g., UInt constant actually holds an Int value).
So, in IR so far we also represent unsigned constant literals as
constant values of corresponding signed types, but with corresponding
unsigned type:
0xFFFF_FFFFu becomes 'CONST Int type=kotlin.UInt value=-1'
This commit is contained in:
Dmitry Petrov
2018-06-20 17:51:29 +03:00
parent c444db90fb
commit 8999e5bfe6
5 changed files with 132 additions and 0 deletions
@@ -0,0 +1,23 @@
// !LANGUAGE: +InlineClasses
// !SKIP_METADATA_VERSION_CHECK
// WITH_UNSIGNED
val testSimpleUIntLiteral = 1u
val testSimpleUIntLiteralWithOverflow = 0xFFFF_FFFFu
val testUByteWithExpectedType: UByte = 1u
val testUShortWithExpectedType: UShort = 1u
val testUIntWithExpectedType: UInt = 1u
val testULongWithExpectedType: ULong = 1u
val testToUByte = 1.toUByte()
val testToUShort = 1.toUShort()
val testToUInt = 1.toUInt()
val testToULong = 1.toULong()