Implement constant folding in the IR backend for JVM
The newly added pass folds the set of constant functions of the current backend, plus IrBuiltIns.
This commit is contained in:
committed by
max-kammerer
parent
7e4d33be24
commit
79fcaae991
@@ -102,6 +102,7 @@ internal val jvmPhases = namedIrFilePhase(
|
|||||||
tailrecPhase then
|
tailrecPhase then
|
||||||
toArrayPhase then
|
toArrayPhase then
|
||||||
jvmTypeOperatorLoweringPhase then
|
jvmTypeOperatorLoweringPhase then
|
||||||
|
foldConstantLoweringPhase then
|
||||||
flattenStringConcatenationPhase then
|
flattenStringConcatenationPhase then
|
||||||
jvmBuiltinOptimizationLoweringPhase then
|
jvmBuiltinOptimizationLoweringPhase then
|
||||||
|
|
||||||
|
|||||||
+211
@@ -0,0 +1,211 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
|
* that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.backend.jvm.lower
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
||||||
|
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||||
|
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||||
|
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.IrConst
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
|
||||||
|
import org.jetbrains.kotlin.ir.types.*
|
||||||
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
||||||
|
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||||
|
import org.jetbrains.kotlin.resolve.constants.evaluate.evaluateBinary
|
||||||
|
import org.jetbrains.kotlin.resolve.constants.evaluate.evaluateUnary
|
||||||
|
|
||||||
|
internal val foldConstantLoweringPhase = makeIrFilePhase(
|
||||||
|
::FoldConstantLowering,
|
||||||
|
name = "FoldConstantLowering",
|
||||||
|
description = "Constant Folding"
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pass to fold constant expressions of most common types.
|
||||||
|
*
|
||||||
|
* For example, the expression "O" + 'K' + (1.toLong() + 2.0) will be folded to "OK3.0" at compile time.
|
||||||
|
*
|
||||||
|
* TODO: constant fields (e.g. Double.NaN)
|
||||||
|
*/
|
||||||
|
class FoldConstantLowering(private val context: JvmBackendContext) : IrElementTransformerVoid(), FileLoweringPass {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of an unary operator / method.
|
||||||
|
*
|
||||||
|
* An unary operator / method can be identified by its operand type (in full qualified name) and its name.
|
||||||
|
*/
|
||||||
|
private data class UnaryOp(
|
||||||
|
val operandType: String,
|
||||||
|
val operatorName: String
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of an binary operator / method.
|
||||||
|
*
|
||||||
|
* An binary operator / method can be identified by its operand types (in full qualified names) and its name.
|
||||||
|
*/
|
||||||
|
private data class BinaryOp(
|
||||||
|
val lhsType: String,
|
||||||
|
val rhsType: String,
|
||||||
|
val operatorName: String
|
||||||
|
)
|
||||||
|
|
||||||
|
private data class PrimitiveType<T>(val name: String)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val BYTE = PrimitiveType<Byte>("Byte")
|
||||||
|
private val SHORT = PrimitiveType<Short>("Short")
|
||||||
|
private val INT = PrimitiveType<Int>("Int")
|
||||||
|
private val LONG = PrimitiveType<Long>("Long")
|
||||||
|
private val DOUBLE = PrimitiveType<Double>("Double")
|
||||||
|
private val FLOAT = PrimitiveType<Float>("Float")
|
||||||
|
private val CHAR = PrimitiveType<Char>("Char")
|
||||||
|
private val BOOLEAN = PrimitiveType<Boolean>("Boolean")
|
||||||
|
private val STRING = PrimitiveType<String>("String")
|
||||||
|
|
||||||
|
private val UNARY_OP_TO_EVALUATOR = HashMap<UnaryOp, Function1<Any?, Any>>()
|
||||||
|
private val BINARY_OP_TO_EVALUATOR = HashMap<BinaryOp, Function2<Any?, Any?, Any>>()
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
private fun <T> registerBuiltinUnaryOp(operandType: PrimitiveType<T>, operatorName: String, f: (T) -> Any) {
|
||||||
|
UNARY_OP_TO_EVALUATOR[UnaryOp(operandType.name, operatorName)] = f as Function1<Any?, Any>
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
private fun <T> registerBuiltinBinaryOp(operandType: PrimitiveType<T>, operatorName: String, f: (T, T) -> Any) {
|
||||||
|
BINARY_OP_TO_EVALUATOR[BinaryOp(operandType.name, operandType.name, operatorName)] = f as Function2<Any?, Any?, Any>
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
// IrBuiltins
|
||||||
|
registerBuiltinUnaryOp(BOOLEAN, IrBuiltIns.OperatorNames.NOT) { !it }
|
||||||
|
|
||||||
|
registerBuiltinBinaryOp(DOUBLE, IrBuiltIns.OperatorNames.LESS) { a, b -> a < b }
|
||||||
|
registerBuiltinBinaryOp(DOUBLE, IrBuiltIns.OperatorNames.LESS_OR_EQUAL) { a, b -> a <= b }
|
||||||
|
registerBuiltinBinaryOp(DOUBLE, IrBuiltIns.OperatorNames.GREATER) { a, b -> a > b }
|
||||||
|
registerBuiltinBinaryOp(DOUBLE, IrBuiltIns.OperatorNames.GREATER_OR_EQUAL) { a, b -> a >= b }
|
||||||
|
registerBuiltinBinaryOp(DOUBLE, IrBuiltIns.OperatorNames.IEEE754_EQUALS) { a, b -> a == b }
|
||||||
|
|
||||||
|
registerBuiltinBinaryOp(FLOAT, IrBuiltIns.OperatorNames.LESS) { a, b -> a < b }
|
||||||
|
registerBuiltinBinaryOp(FLOAT, IrBuiltIns.OperatorNames.LESS_OR_EQUAL) { a, b -> a <= b }
|
||||||
|
registerBuiltinBinaryOp(FLOAT, IrBuiltIns.OperatorNames.GREATER) { a, b -> a > b }
|
||||||
|
registerBuiltinBinaryOp(FLOAT, IrBuiltIns.OperatorNames.GREATER_OR_EQUAL) { a, b -> a >= b }
|
||||||
|
registerBuiltinBinaryOp(FLOAT, IrBuiltIns.OperatorNames.IEEE754_EQUALS) { a, b -> a == b }
|
||||||
|
|
||||||
|
registerBuiltinBinaryOp(INT, IrBuiltIns.OperatorNames.LESS) { a, b -> a < b }
|
||||||
|
registerBuiltinBinaryOp(INT, IrBuiltIns.OperatorNames.LESS_OR_EQUAL) { a, b -> a <= b }
|
||||||
|
registerBuiltinBinaryOp(INT, IrBuiltIns.OperatorNames.GREATER) { a, b -> a > b }
|
||||||
|
registerBuiltinBinaryOp(INT, IrBuiltIns.OperatorNames.GREATER_OR_EQUAL) { a, b -> a >= b }
|
||||||
|
registerBuiltinBinaryOp(INT, IrBuiltIns.OperatorNames.EQEQ) { a, b -> a == b }
|
||||||
|
|
||||||
|
registerBuiltinBinaryOp(LONG, IrBuiltIns.OperatorNames.LESS) { a, b -> a < b }
|
||||||
|
registerBuiltinBinaryOp(LONG, IrBuiltIns.OperatorNames.LESS_OR_EQUAL) { a, b -> a <= b }
|
||||||
|
registerBuiltinBinaryOp(LONG, IrBuiltIns.OperatorNames.GREATER) { a, b -> a > b }
|
||||||
|
registerBuiltinBinaryOp(LONG, IrBuiltIns.OperatorNames.GREATER_OR_EQUAL) { a, b -> a >= b }
|
||||||
|
registerBuiltinBinaryOp(LONG, IrBuiltIns.OperatorNames.EQEQ) { a, b -> a == b }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun buildIrConstant(call: IrCall, v: Any): IrExpression {
|
||||||
|
return when {
|
||||||
|
call.type.isInt() -> IrConstImpl.int(call.startOffset, call.endOffset, call.type, v as Int)
|
||||||
|
call.type.isChar() -> IrConstImpl.char(call.startOffset, call.endOffset, call.type, v as Char)
|
||||||
|
call.type.isBoolean() -> IrConstImpl.boolean(call.startOffset, call.endOffset, call.type, v as Boolean)
|
||||||
|
call.type.isByte() -> IrConstImpl.byte(call.startOffset, call.endOffset, call.type, v as Byte)
|
||||||
|
call.type.isShort() -> IrConstImpl.short(call.startOffset, call.endOffset, call.type, v as Short)
|
||||||
|
call.type.isLong() -> IrConstImpl.long(call.startOffset, call.endOffset, call.type, v as Long)
|
||||||
|
call.type.isDouble() -> IrConstImpl.double(call.startOffset, call.endOffset, call.type, v as Double)
|
||||||
|
call.type.isFloat() -> IrConstImpl.float(call.startOffset, call.endOffset, call.type, v as Float)
|
||||||
|
call.type.isString() -> IrConstImpl.string(call.startOffset, call.endOffset, call.type, v as String)
|
||||||
|
else -> throw IllegalArgumentException("Unexpected IrCall return type")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun tryFoldingUnaryOps(call: IrCall): IrExpression {
|
||||||
|
val operand = call.dispatchReceiver as? IrConst<*> ?: return call
|
||||||
|
val evaluated = evaluateUnary(
|
||||||
|
call.symbol.owner.name.toString(),
|
||||||
|
operand.kind.toString(),
|
||||||
|
operand.value!!
|
||||||
|
) ?: return call
|
||||||
|
return buildIrConstant(call, evaluated)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun tryFoldingBuiltinUnaryOps(call: IrCall): IrExpression {
|
||||||
|
if (call.symbol.owner.origin != IrDeclarationOrigin.IR_BUILTINS_STUB)
|
||||||
|
return call
|
||||||
|
|
||||||
|
val operand = call.getValueArgument(0) as? IrConst<*> ?: return call
|
||||||
|
val evaluator = UNARY_OP_TO_EVALUATOR[UnaryOp(operand.kind.toString(), call.symbol.owner.name.toString())] ?: return call
|
||||||
|
|
||||||
|
return buildIrConstant(call, evaluator(operand.value!!))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun tryFoldingBinaryOps(call: IrCall): IrExpression {
|
||||||
|
val lhs = call.dispatchReceiver as? IrConst<*> ?: return call
|
||||||
|
val rhs = call.getValueArgument(0) as? IrConst<*> ?: return call
|
||||||
|
|
||||||
|
val evaluated = try {
|
||||||
|
fun String.toNonNullable() = if (this.endsWith('?')) this.dropLast(1) else this
|
||||||
|
evaluateBinary(
|
||||||
|
call.symbol.owner.name.toString(),
|
||||||
|
lhs.kind.toString(),
|
||||||
|
lhs.value!!,
|
||||||
|
// 1. Although some operators have nullable parameters, evaluators deals with non-nullable types only.
|
||||||
|
// The passed parameters are guaranteed to be non-null, since they are from IrConst.
|
||||||
|
// 2. The operators are registered with prototype as if virtual member functions. They are identified by
|
||||||
|
// actual_receiver_type.operator_name(parameter_type_in_prototype).
|
||||||
|
call.symbol.owner.valueParameters[0].type.toKotlinType().toString().toNonNullable(),
|
||||||
|
rhs.value!!
|
||||||
|
) ?: return call
|
||||||
|
} catch (e: Exception) {
|
||||||
|
// Don't cast a runtime exception into compile time. E.g., division by zero.
|
||||||
|
return call
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildIrConstant(call, evaluated)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun tryFoldingBuiltinBinaryOps(call: IrCall): IrExpression {
|
||||||
|
// Make sure that this is a IrBuiltIn
|
||||||
|
if (call.symbol.owner.origin != IrDeclarationOrigin.IR_BUILTINS_STUB)
|
||||||
|
return call
|
||||||
|
|
||||||
|
val lhs = call.getValueArgument(0) as? IrConst<*> ?: return call
|
||||||
|
val rhs = call.getValueArgument(1) as? IrConst<*> ?: return call
|
||||||
|
|
||||||
|
val evaluated = try {
|
||||||
|
val evaluator =
|
||||||
|
BINARY_OP_TO_EVALUATOR[BinaryOp(lhs.kind.toString(), rhs.kind.toString(), call.symbol.owner.name.toString())] ?: return call
|
||||||
|
evaluator(lhs.value!!, rhs.value!!)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
return call
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildIrConstant(call, evaluated)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun lower(irFile: IrFile) {
|
||||||
|
irFile.transformChildrenVoid(object : IrElementTransformerVoid() {
|
||||||
|
override fun visitCall(expression: IrCall): IrExpression {
|
||||||
|
expression.transformChildrenVoid(this)
|
||||||
|
|
||||||
|
return when {
|
||||||
|
expression.extensionReceiver != null -> expression
|
||||||
|
expression.dispatchReceiver != null && expression.valueArgumentsCount == 0 -> tryFoldingUnaryOps(expression)
|
||||||
|
expression.dispatchReceiver != null && expression.valueArgumentsCount == 1 -> tryFoldingBinaryOps(expression)
|
||||||
|
expression.dispatchReceiver == null && expression.valueArgumentsCount == 1 -> tryFoldingBuiltinUnaryOps(expression)
|
||||||
|
expression.dispatchReceiver == null && expression.valueArgumentsCount == 2 -> tryFoldingBuiltinBinaryOps(expression)
|
||||||
|
else -> expression
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// IGNORE_BACKEND: JS_IR
|
||||||
|
fun foo(): Array<Boolean> {
|
||||||
|
return arrayOf(
|
||||||
|
0.0 / 0 == 0.0 / 0,
|
||||||
|
0.0F > -0.0F,
|
||||||
|
0.0.equals(-0.0),
|
||||||
|
(0.0 / 0.0).equals(1.0 / 0.0)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (foo().any { it == true })
|
||||||
|
return "fail: ${foo().contentDeepToString()}"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// IGNORE_BACKEND: JS_IR
|
||||||
|
fun foo(): Array<Boolean> {
|
||||||
|
return arrayOf(
|
||||||
|
19 < 20.0,
|
||||||
|
12 > 11,
|
||||||
|
3.0F <= 4.0,
|
||||||
|
4.0F >= 4,
|
||||||
|
0.0 / 0 != 0.0 / 0,
|
||||||
|
0.0 == -0.0,
|
||||||
|
123 == 123,
|
||||||
|
123L == 123L,
|
||||||
|
0.0F == -0.0F,
|
||||||
|
0.0.compareTo(-0.0) > 0,
|
||||||
|
(0.0 / 0.0).compareTo(1.0 / 0.0) > 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (foo().any { it == false })
|
||||||
|
return "fail: ${foo().contentDeepToString()}"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// IGNORE_BACKEND: JS_IR
|
||||||
|
// IGNORE_BACKEND: JS
|
||||||
|
// reason - no error from division by zero in JS
|
||||||
|
|
||||||
|
fun expectArithmeticException(f: () -> Unit): Boolean {
|
||||||
|
try {
|
||||||
|
f()
|
||||||
|
} catch (e: ArithmeticException) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (!expectArithmeticException { 1 / 0 })
|
||||||
|
return "fail: 1 / 0 didn't throw exception"
|
||||||
|
|
||||||
|
if (!expectArithmeticException { 1 * 2 / 0 })
|
||||||
|
return "fail: 1 * 2 / 0 didn't throw exception"
|
||||||
|
|
||||||
|
if (!expectArithmeticException { 1 * (2 / 0) })
|
||||||
|
return "fail: 1 * (2 / 0) didn't throw exception"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
fun box() : String {
|
fun box() : String {
|
||||||
230?.toByte()?.hashCode()
|
230?.toByte()?.hashCode()
|
||||||
9.hashCode()
|
9.hashCode()
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
fun identity(x: Int): Int {
|
||||||
|
return when {
|
||||||
|
x < 0 -> identity(x + 1) - 1
|
||||||
|
x > 0 -> identity(x - 1) + 1
|
||||||
|
else -> 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() : String {
|
||||||
|
// Just hard enough that the test won't get optimized away at compile time.
|
||||||
|
val twoThirty = identity(230)
|
||||||
|
val nine = identity(9)
|
||||||
|
twoThirty?.toByte()?.hashCode()
|
||||||
|
nine.hashCode()
|
||||||
|
|
||||||
|
if(twoThirty.equals(nine.toByte())) {
|
||||||
|
return "fail"
|
||||||
|
}
|
||||||
|
|
||||||
|
if(twoThirty == nine.toByte().toInt()) {
|
||||||
|
return "fail"
|
||||||
|
}
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
val a: Byte = 1 + 10
|
val a: Byte = 1 + 10
|
||||||
|
|
||||||
// 1 BIPUSH 11
|
// 1 BIPUSH 11
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
|
||||||
|
fun foo(): Array<Boolean> {
|
||||||
|
return arrayOf(
|
||||||
|
0.0 / 0 == 0.0 / 0,
|
||||||
|
0.0F > -0.0F,
|
||||||
|
0.0.equals(-0.0),
|
||||||
|
(0.0 / 0.0).equals(1.0 / 0.0)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disabled: current backend doesn't fold them.
|
||||||
|
// 4 INVOKESTATIC
|
||||||
|
// 4 INVOKESTATIC java/lang/Boolean.valueOf
|
||||||
|
// 1 ICONST_1
|
||||||
|
// 5 ICONST_0
|
||||||
|
// 0 IFEQ
|
||||||
|
// 0 IFNE
|
||||||
|
// 0 IFGE
|
||||||
|
// 0 IFGT
|
||||||
|
// 0 IFLE
|
||||||
|
// 0 IFLT
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
|
||||||
|
fun foo(): Array<Boolean> {
|
||||||
|
return arrayOf(
|
||||||
|
19 < 20.0,
|
||||||
|
12 > 11,
|
||||||
|
3.0F <= 4.0,
|
||||||
|
4.0F >= 4,
|
||||||
|
0.0 / 0 != 0.0 / 0,
|
||||||
|
0.0 == -0.0,
|
||||||
|
123 == 123,
|
||||||
|
123L == 123L,
|
||||||
|
0.0F == -0.0F,
|
||||||
|
0.0.compareTo(-0.0) > 0,
|
||||||
|
(0.0 / 0.0).compareTo(1.0 / 0.0) > 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disabled because the current backend doesn't fold them.
|
||||||
|
// 11 INVOKESTATIC
|
||||||
|
// 11 INVOKESTATIC java/lang/Boolean.valueOf
|
||||||
|
// 1 ICONST_0
|
||||||
|
// 12 ICONST_1
|
||||||
|
// 0 IFEQ
|
||||||
|
// 0 IFNE
|
||||||
|
// 0 IFGE
|
||||||
|
// 0 IFGT
|
||||||
|
// 0 IFLE
|
||||||
|
// 0 IFLT
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
val a = 1.0 + 10
|
||||||
|
val b = 2 + 10.0
|
||||||
|
val c = 3.0F + 10
|
||||||
|
val d = 4 + 10.0F
|
||||||
|
val e = 1.0 / 0
|
||||||
|
val f = 1 / 0.0
|
||||||
|
val g = 0.0 / 0
|
||||||
|
val h = 0 / 0.0
|
||||||
|
val i = 0.0 / 0.0
|
||||||
|
|
||||||
|
// 1 LDC 11.0
|
||||||
|
// 1 LDC 12.0
|
||||||
|
// 1 LDC 13.0
|
||||||
|
// 1 LDC 14.0
|
||||||
|
// 2 LDC Infinity
|
||||||
|
// 3 LDC NaN
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = 1;
|
val z = 1;
|
||||||
return "O" + "K".toString() + z
|
return "O" + "K".toString() + z
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
val a: Short = 1 + 255
|
val a: Short = 1 + 255
|
||||||
|
|
||||||
// 1 SIPUSH 256
|
// 1 SIPUSH 256
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return "O" + "K".toString() + 1.toLong()
|
return "O" + "K".toString() + 1.toLong()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
class A
|
class A
|
||||||
|
|
||||||
fun foo(x: Any?) {}
|
fun foo(x: Any?) {}
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
class A
|
||||||
|
|
||||||
|
fun foo(x: Any?) {}
|
||||||
|
|
||||||
|
fun box(u: Int) {
|
||||||
|
val x: Int? = 1
|
||||||
|
x!!
|
||||||
|
|
||||||
|
val z: Int? = if (u == 1) x else null
|
||||||
|
z!!
|
||||||
|
|
||||||
|
foo(1 as java.lang.Integer)
|
||||||
|
|
||||||
|
val y: Any? = if (u == 1) x else A()
|
||||||
|
y!!
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0 IFNULL
|
||||||
|
// 1 IFNONNULL
|
||||||
|
// 1 throwNpe
|
||||||
|
// 0 ATHROW
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
class A
|
class A
|
||||||
fun box() {
|
fun box() {
|
||||||
val x: A? = A()
|
val x: A? = A()
|
||||||
|
|||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
class A
|
||||||
|
fun box(u: Int) {
|
||||||
|
val x: A? = A()
|
||||||
|
val y: A?
|
||||||
|
if (u == 0) {
|
||||||
|
y = x
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
y = null
|
||||||
|
}
|
||||||
|
|
||||||
|
y!!
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0 IFNULL
|
||||||
|
// 1 IFNONNULL
|
||||||
|
// 1 throwNpe
|
||||||
|
// 0 ATHROW
|
||||||
@@ -6,9 +6,9 @@ class A() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun box() : String {
|
fun box(a: String, b: String) : String {
|
||||||
|
|
||||||
val s = "1" + "2" + 3 + 4L + 5.0 + 6F + '7' + A()
|
val s = a + "1" + "2" + 3 + 4L + b + 5.0 + 6F + '7' + A()
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
fun main() {
|
fun main() {
|
||||||
false.toString()
|
false.toString()
|
||||||
1.toByte().toString()
|
1.toByte().toString()
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
fun main(a: Boolean, b:Byte, c: Short, d: Int, e: Long, f: Float, g: Double, h: Char) {
|
||||||
|
a.toString()
|
||||||
|
b.toString()
|
||||||
|
c.toString()
|
||||||
|
d.toString()
|
||||||
|
e.toString()
|
||||||
|
f.toString()
|
||||||
|
g.toString()
|
||||||
|
h.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Check that all "valueOf" are String ones and there is no boxing*/
|
||||||
|
// 8 valueOf
|
||||||
|
// 8 INVOKESTATIC java/lang/String.valueOf
|
||||||
+20
@@ -4379,11 +4379,26 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/constants"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/constants"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonFalse.kt")
|
||||||
|
public void testComparisonFalse() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/comparisonFalse.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonTrue.kt")
|
||||||
|
public void testComparisonTrue() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/comparisonTrue.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("constantsInWhen.kt")
|
@TestMetadata("constantsInWhen.kt")
|
||||||
public void testConstantsInWhen() throws Exception {
|
public void testConstantsInWhen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/constants/constantsInWhen.kt");
|
runTest("compiler/testData/codegen/box/constants/constantsInWhen.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("divisionByZero.kt")
|
||||||
|
public void testDivisionByZero() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/divisionByZero.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("float.kt")
|
@TestMetadata("float.kt")
|
||||||
public void testFloat() throws Exception {
|
public void testFloat() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/constants/float.kt");
|
runTest("compiler/testData/codegen/box/constants/float.kt");
|
||||||
@@ -17176,6 +17191,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269.kt");
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt2269NotOptimizable.kt")
|
||||||
|
public void testKt2269NotOptimizable() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269NotOptimizable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt2275.kt")
|
@TestMetadata("kt2275.kt")
|
||||||
public void testKt2275() throws Exception {
|
public void testKt2275() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/primitiveTypes/kt2275.kt");
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2275.kt");
|
||||||
|
|||||||
@@ -1118,6 +1118,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/constants/byte.kt");
|
runTest("compiler/testData/codegen/bytecodeText/constants/byte.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("floatingPoints.kt")
|
||||||
|
public void testFloatingPoints() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/constants/floatingPoints.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inlineUnsignedIntConstant.kt")
|
@TestMetadata("inlineUnsignedIntConstant.kt")
|
||||||
public void testInlineUnsignedIntConstant() throws Exception {
|
public void testInlineUnsignedIntConstant() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/constants/inlineUnsignedIntConstant.kt");
|
runTest("compiler/testData/codegen/bytecodeText/constants/inlineUnsignedIntConstant.kt");
|
||||||
@@ -1472,6 +1477,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/boxing.kt");
|
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/boxing.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("boxingNotOptimizable.kt")
|
||||||
|
public void testBoxingNotOptimizable() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/boxingNotOptimizable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("emptyVariableRange.kt")
|
@TestMetadata("emptyVariableRange.kt")
|
||||||
public void testEmptyVariableRange() throws Exception {
|
public void testEmptyVariableRange() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/emptyVariableRange.kt");
|
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/emptyVariableRange.kt");
|
||||||
@@ -1501,6 +1511,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
public void testSimpleConstructorNotRedundant() throws Exception {
|
public void testSimpleConstructorNotRedundant() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/simpleConstructorNotRedundant.kt");
|
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/simpleConstructorNotRedundant.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("simpleConstructorNotRedundantNotOptimizable.kt")
|
||||||
|
public void testSimpleConstructorNotRedundantNotOptimizable() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/simpleConstructorNotRedundantNotOptimizable.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/bytecodeText/defaultArguments")
|
@TestMetadata("compiler/testData/codegen/bytecodeText/defaultArguments")
|
||||||
@@ -3377,6 +3392,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitiveToString.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitiveToString.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("primitiveToStringNotOptimizable.kt")
|
||||||
|
public void testPrimitiveToStringNotOptimizable() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitiveToStringNotOptimizable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("primitivesAsStringTemplates.kt")
|
@TestMetadata("primitivesAsStringTemplates.kt")
|
||||||
public void testPrimitivesAsStringTemplates() throws Exception {
|
public void testPrimitivesAsStringTemplates() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitivesAsStringTemplates.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitivesAsStringTemplates.kt");
|
||||||
|
|||||||
+20
@@ -4379,11 +4379,26 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/constants"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/constants"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonFalse.kt")
|
||||||
|
public void testComparisonFalse() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/comparisonFalse.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonTrue.kt")
|
||||||
|
public void testComparisonTrue() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/comparisonTrue.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("constantsInWhen.kt")
|
@TestMetadata("constantsInWhen.kt")
|
||||||
public void testConstantsInWhen() throws Exception {
|
public void testConstantsInWhen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/constants/constantsInWhen.kt");
|
runTest("compiler/testData/codegen/box/constants/constantsInWhen.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("divisionByZero.kt")
|
||||||
|
public void testDivisionByZero() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/divisionByZero.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("float.kt")
|
@TestMetadata("float.kt")
|
||||||
public void testFloat() throws Exception {
|
public void testFloat() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/constants/float.kt");
|
runTest("compiler/testData/codegen/box/constants/float.kt");
|
||||||
@@ -17176,6 +17191,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269.kt");
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt2269NotOptimizable.kt")
|
||||||
|
public void testKt2269NotOptimizable() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269NotOptimizable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt2275.kt")
|
@TestMetadata("kt2275.kt")
|
||||||
public void testKt2275() throws Exception {
|
public void testKt2275() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/primitiveTypes/kt2275.kt");
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2275.kt");
|
||||||
|
|||||||
+20
@@ -4379,11 +4379,26 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/constants"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/constants"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonFalse.kt")
|
||||||
|
public void testComparisonFalse() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/comparisonFalse.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonTrue.kt")
|
||||||
|
public void testComparisonTrue() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/comparisonTrue.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("constantsInWhen.kt")
|
@TestMetadata("constantsInWhen.kt")
|
||||||
public void testConstantsInWhen() throws Exception {
|
public void testConstantsInWhen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/constants/constantsInWhen.kt");
|
runTest("compiler/testData/codegen/box/constants/constantsInWhen.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("divisionByZero.kt")
|
||||||
|
public void testDivisionByZero() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/divisionByZero.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("float.kt")
|
@TestMetadata("float.kt")
|
||||||
public void testFloat() throws Exception {
|
public void testFloat() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/constants/float.kt");
|
runTest("compiler/testData/codegen/box/constants/float.kt");
|
||||||
@@ -17181,6 +17196,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269.kt");
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt2269NotOptimizable.kt")
|
||||||
|
public void testKt2269NotOptimizable() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269NotOptimizable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt2275.kt")
|
@TestMetadata("kt2275.kt")
|
||||||
public void testKt2275() throws Exception {
|
public void testKt2275() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/primitiveTypes/kt2275.kt");
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2275.kt");
|
||||||
|
|||||||
+30
@@ -1118,6 +1118,21 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/constants/byte.kt");
|
runTest("compiler/testData/codegen/bytecodeText/constants/byte.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonFalse.kt")
|
||||||
|
public void testComparisonFalse() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/constants/comparisonFalse.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonTrue.kt")
|
||||||
|
public void testComparisonTrue() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/constants/comparisonTrue.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("floatingPoints.kt")
|
||||||
|
public void testFloatingPoints() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/constants/floatingPoints.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inlineUnsignedIntConstant.kt")
|
@TestMetadata("inlineUnsignedIntConstant.kt")
|
||||||
public void testInlineUnsignedIntConstant() throws Exception {
|
public void testInlineUnsignedIntConstant() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/constants/inlineUnsignedIntConstant.kt");
|
runTest("compiler/testData/codegen/bytecodeText/constants/inlineUnsignedIntConstant.kt");
|
||||||
@@ -1472,6 +1487,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/boxing.kt");
|
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/boxing.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("boxingNotOptimizable.kt")
|
||||||
|
public void testBoxingNotOptimizable() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/boxingNotOptimizable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("emptyVariableRange.kt")
|
@TestMetadata("emptyVariableRange.kt")
|
||||||
public void testEmptyVariableRange() throws Exception {
|
public void testEmptyVariableRange() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/emptyVariableRange.kt");
|
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/emptyVariableRange.kt");
|
||||||
@@ -1501,6 +1521,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
|||||||
public void testSimpleConstructorNotRedundant() throws Exception {
|
public void testSimpleConstructorNotRedundant() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/simpleConstructorNotRedundant.kt");
|
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/simpleConstructorNotRedundant.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("simpleConstructorNotRedundantNotOptimizable.kt")
|
||||||
|
public void testSimpleConstructorNotRedundantNotOptimizable() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/simpleConstructorNotRedundantNotOptimizable.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/bytecodeText/defaultArguments")
|
@TestMetadata("compiler/testData/codegen/bytecodeText/defaultArguments")
|
||||||
@@ -3377,6 +3402,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitiveToString.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitiveToString.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("primitiveToStringNotOptimizable.kt")
|
||||||
|
public void testPrimitiveToStringNotOptimizable() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitiveToStringNotOptimizable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("primitivesAsStringTemplates.kt")
|
@TestMetadata("primitivesAsStringTemplates.kt")
|
||||||
public void testPrimitivesAsStringTemplates() throws Exception {
|
public void testPrimitivesAsStringTemplates() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitivesAsStringTemplates.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitivesAsStringTemplates.kt");
|
||||||
|
|||||||
Generated
+20
@@ -3649,11 +3649,26 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/constants"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/constants"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonFalse.kt")
|
||||||
|
public void testComparisonFalse() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/comparisonFalse.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonTrue.kt")
|
||||||
|
public void testComparisonTrue() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/comparisonTrue.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("constantsInWhen.kt")
|
@TestMetadata("constantsInWhen.kt")
|
||||||
public void testConstantsInWhen() throws Exception {
|
public void testConstantsInWhen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/constants/constantsInWhen.kt");
|
runTest("compiler/testData/codegen/box/constants/constantsInWhen.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("divisionByZero.kt")
|
||||||
|
public void testDivisionByZero() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/divisionByZero.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("float.kt")
|
@TestMetadata("float.kt")
|
||||||
public void testFloat() throws Exception {
|
public void testFloat() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/constants/float.kt");
|
runTest("compiler/testData/codegen/box/constants/float.kt");
|
||||||
@@ -13426,6 +13441,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269.kt");
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt2269NotOptimizable.kt")
|
||||||
|
public void testKt2269NotOptimizable() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269NotOptimizable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt2275.kt")
|
@TestMetadata("kt2275.kt")
|
||||||
public void testKt2275() throws Exception {
|
public void testKt2275() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/primitiveTypes/kt2275.kt");
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2275.kt");
|
||||||
|
|||||||
+20
@@ -3659,11 +3659,26 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/constants"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/constants"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonFalse.kt")
|
||||||
|
public void testComparisonFalse() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/comparisonFalse.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparisonTrue.kt")
|
||||||
|
public void testComparisonTrue() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/comparisonTrue.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("constantsInWhen.kt")
|
@TestMetadata("constantsInWhen.kt")
|
||||||
public void testConstantsInWhen() throws Exception {
|
public void testConstantsInWhen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/constants/constantsInWhen.kt");
|
runTest("compiler/testData/codegen/box/constants/constantsInWhen.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("divisionByZero.kt")
|
||||||
|
public void testDivisionByZero() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/constants/divisionByZero.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("float.kt")
|
@TestMetadata("float.kt")
|
||||||
public void testFloat() throws Exception {
|
public void testFloat() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/constants/float.kt");
|
runTest("compiler/testData/codegen/box/constants/float.kt");
|
||||||
@@ -14526,6 +14541,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269.kt");
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt2269NotOptimizable.kt")
|
||||||
|
public void testKt2269NotOptimizable() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269NotOptimizable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt2275.kt")
|
@TestMetadata("kt2275.kt")
|
||||||
public void testKt2275() throws Exception {
|
public void testKt2275() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/primitiveTypes/kt2275.kt");
|
runTest("compiler/testData/codegen/box/primitiveTypes/kt2275.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user