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
@@ -51,6 +51,7 @@ abstract class AbstractIrGeneratorTestCase : CodegenTestCase() {
val javacOptions = ArrayList<String>(0)
var addRuntime = false
var addReflect = false
var addUnsigned = false
for (file in files) {
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_RUNTIME")) {
addRuntime = true
@@ -58,6 +59,9 @@ abstract class AbstractIrGeneratorTestCase : CodegenTestCase() {
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_REFLECT")) {
addReflect = true
}
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_UNSIGNED")) {
addUnsigned = true
}
javacOptions.addAll(InTextDirectivesUtils.findListWithPrefixes(file.content, "// JAVAC_OPTIONS:"))
}
@@ -65,6 +69,7 @@ abstract class AbstractIrGeneratorTestCase : CodegenTestCase() {
val configurationKind = when {
addReflect -> ConfigurationKind.ALL
addRuntime -> ConfigurationKind.NO_KOTLIN_REFLECT
addUnsigned -> ConfigurationKind.WITH_UNSIGNED_TYPES
else -> ConfigurationKind.JDK_ONLY
}