Minor: CompileTimeConstant use utils instead of JetType#equals

This commit is contained in:
Pavel V. Talanov
2015-07-23 18:30:58 +03:00
parent 0bed8bb7d4
commit a1a38e2eba
@@ -63,14 +63,15 @@ public class IntegerValueTypeConstant(
override fun toConstantValue(expectedType: JetType): ConstantValue<Number> { override fun toConstantValue(expectedType: JetType): ConstantValue<Number> {
val factory = ConstantValueFactory(KotlinBuiltIns.getInstance()) val factory = ConstantValueFactory(KotlinBuiltIns.getInstance())
return when (getType(expectedType)) { val type = getType(expectedType)
KotlinBuiltIns.getInstance().getIntType() -> { return when {
KotlinBuiltIns.isInt(type) -> {
factory.createIntValue(value.toInt()) factory.createIntValue(value.toInt())
} }
KotlinBuiltIns.getInstance().getByteType() -> { KotlinBuiltIns.isByte(type) -> {
factory.createByteValue(value.toByte()) factory.createByteValue(value.toByte())
} }
KotlinBuiltIns.getInstance().getShortType() -> { KotlinBuiltIns.isShort(type) -> {
factory.createShortValue(value.toShort()) factory.createShortValue(value.toShort())
} }
else -> { else -> {