Fix several tests. (#234)
This commit is contained in:
+3
-3
@@ -37,15 +37,15 @@ internal class KonanLower(val context: Context) {
|
||||
phaser.phase(KonanPhase.LOWER_BUILTIN_OPERATORS) {
|
||||
BuiltinOperatorLowering(context).runOnFilePostfix(irFile)
|
||||
}
|
||||
phaser.phase(KonanPhase.LOWER_TYPE_OPERATORS) {
|
||||
TypeOperatorLowering(context).runOnFilePostfix(irFile)
|
||||
}
|
||||
phaser.phase(KonanPhase.LOWER_SHARED_VARIABLES) {
|
||||
SharedVariablesLowering(context).runOnFilePostfix(irFile)
|
||||
}
|
||||
phaser.phase(KonanPhase.LOWER_INITIALIZERS) {
|
||||
InitializersLowering(context).runOnFilePostfix(irFile)
|
||||
}
|
||||
phaser.phase(KonanPhase.LOWER_TYPE_OPERATORS) {
|
||||
TypeOperatorLowering(context).runOnFilePostfix(irFile)
|
||||
}
|
||||
phaser.phase(KonanPhase.LOWER_LOCAL_FUNCTIONS) {
|
||||
LocalDeclarationsLowering(context).runOnFilePostfix(irFile)
|
||||
}
|
||||
|
||||
+2
-1
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.types.typeUtil.isNothing
|
||||
import org.jetbrains.kotlin.types.typeUtil.isTypeParameter
|
||||
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonList
|
||||
|
||||
@@ -1170,7 +1171,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid
|
||||
context.log("evaluateCast : ${ir2string(value)}")
|
||||
val type = value.typeOperand
|
||||
assert(!KotlinBuiltIns.isPrimitiveType(type) && !KotlinBuiltIns.isPrimitiveType(value.argument.type))
|
||||
|
||||
assert(!type.isTypeParameter())
|
||||
val dstDescriptor = TypeUtils.getClassDescriptor(type) // Get class descriptor for dst type.
|
||||
val dstTypeInfo = codegen.typeInfoValue(dstDescriptor!!) // Get TypeInfo for dst type.
|
||||
val srcArg = evaluateExpression(value.argument) // Evaluate src expression.
|
||||
|
||||
@@ -330,15 +330,122 @@ public fun Long.coerceIn(range: ClosedRange<Long>): Long {
|
||||
/**
|
||||
* Returns a progression that goes over the same range in the opposite direction with the same step.
|
||||
*/
|
||||
public fun IntProgression.reversed(): IntProgression {
|
||||
return IntProgression.fromClosedRange(last, first, -step)
|
||||
}
|
||||
public fun IntProgression.reversed() = IntProgression.fromClosedRange(last, first, -step)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Int.downTo(to: Int): IntProgression {
|
||||
return IntProgression.fromClosedRange(this, to, -1)
|
||||
}
|
||||
public infix fun Int.downTo(to: Byte) = IntProgression.fromClosedRange(this, to.toInt(), -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Long.downTo(to: Byte) = LongProgression.fromClosedRange(this, to.toLong(), -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Byte.downTo(to: Byte): IntProgression =
|
||||
IntProgression.fromClosedRange(this.toInt(), to.toInt(), -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Short.downTo(to: Byte) =
|
||||
IntProgression.fromClosedRange(this.toInt(), to.toInt(), -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Char.downTo(to: Char): CharProgression = CharProgression.fromClosedRange(this, to, -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Int.downTo(to: Int) = IntProgression.fromClosedRange(this, to, -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Long.downTo(to: Int) = LongProgression.fromClosedRange(this, to.toLong(), -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Byte.downTo(to: Int): IntProgression =
|
||||
IntProgression.fromClosedRange(this.toInt(), to, -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Short.downTo(to: Int) = IntProgression.fromClosedRange(this.toInt(), to, -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Int.downTo(to: Long) = LongProgression.fromClosedRange(this.toLong(), to, -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Long.downTo(to: Long) = LongProgression.fromClosedRange(this, to, -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Byte.downTo(to: Long): LongProgression =
|
||||
LongProgression.fromClosedRange(this.toLong(), to, -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Int.downTo(to: Short) = IntProgression.fromClosedRange(this, to.toInt(), -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Long.downTo(to: Short) = LongProgression.fromClosedRange(this, to.toLong(), -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Byte.downTo(to: Short): IntProgression =
|
||||
IntProgression.fromClosedRange(this.toInt(), to.toInt(), -1)
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Short.downTo(to: Short): IntProgression =
|
||||
IntProgression.fromClosedRange(this.toInt(), to.toInt(), -1)
|
||||
|
||||
Reference in New Issue
Block a user