translator: fix name resolving in extension functions, add casts for all primitive types, add test on returning class instance
This commit is contained in:
@@ -33,6 +33,13 @@ class FunctionCodegen(override val state: TranslationState,
|
||||
LLVMInstanceOfStandardType(it.name.toString(), it.type)
|
||||
})
|
||||
|
||||
if (isExtensionDeclaration) {
|
||||
val receiverType = descriptor.extensionReceiverParameter!!.type
|
||||
val translatorType = LLVMMapStandardType(receiverType)
|
||||
functionNamePrefix += translatorType.toString() + "."
|
||||
}
|
||||
|
||||
|
||||
returnType = LLVMInstanceOfStandardType("instance", descriptor.returnType!!)
|
||||
external = isExternal()
|
||||
name = "${function.fqName}${if (args.size > 0 && !external) "_${args.joinToString(separator = "_", transform = { it.type.mangle() })}" else ""}"
|
||||
@@ -98,7 +105,6 @@ class FunctionCodegen(override val state: TranslationState,
|
||||
val classVal = LLVMVariable("classvariable.this", translatorType, pointer = 0)
|
||||
variableManager.addVariable("this", classVal, 0)
|
||||
actualArgs.add(classVal)
|
||||
functionNamePrefix += translatorType.toString() + "."
|
||||
}
|
||||
|
||||
if (this_type != null) {
|
||||
|
||||
@@ -18,9 +18,9 @@ class ProjectTranslator(val files: List<KtFile>, val state: TranslationState) {
|
||||
is KtNamedFunction -> {
|
||||
val function = FunctionCodegen(state, VariableManager(state.globalVariableCollection), declaration, codeBuilder)
|
||||
if (function.external) {
|
||||
state.externalFunctions.put(function.name, function)
|
||||
state.externalFunctions.put(function.fullName, function)
|
||||
} else {
|
||||
state.functions.put(function.name, function)
|
||||
state.functions.put(function.fullName, function)
|
||||
}
|
||||
}
|
||||
is KtClass -> {
|
||||
|
||||
@@ -38,3 +38,4 @@ class ByteArray(var size: Int) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
external fun kotlinclib_byteToChar(value: Byte): Char
|
||||
external fun kotlinclib_byteToShort(value: Byte): Short
|
||||
external fun kotlinclib_byteToInt(value: Byte): Int
|
||||
external fun kotlinclib_byteToLong(value: Byte): Long
|
||||
external fun kotlinclib_byteToFloat(value: Byte): Float
|
||||
external fun kotlinclib_byteToDouble(value: Byte): Double
|
||||
|
||||
|
||||
fun Byte.toByte(): Byte {
|
||||
return this
|
||||
}
|
||||
|
||||
fun Byte.toInt(): Int {
|
||||
return kotlinclib_byteToInt(this)
|
||||
}
|
||||
|
||||
fun Byte.toChar(): Char {
|
||||
return kotlinclib_byteToChar(this)
|
||||
}
|
||||
|
||||
fun Byte.toShort(): Short {
|
||||
return kotlinclib_byteToShort(this)
|
||||
}
|
||||
|
||||
fun Byte.toLong(): Long {
|
||||
return kotlinclib_byteToLong(this)
|
||||
}
|
||||
|
||||
fun Byte.toFloat(): Float {
|
||||
return kotlinclib_byteToFloat(this)
|
||||
}
|
||||
|
||||
fun Byte.toDouble(): Double {
|
||||
return kotlinclib_byteToDouble(this)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
external fun kotlinclib_charToByte(value: Char): Byte
|
||||
external fun kotlinclib_charToShort(value: Char): Short
|
||||
external fun kotlinclib_charToInt(value: Char): Int
|
||||
external fun kotlinclib_charToLong(value: Char): Long
|
||||
external fun kotlinclib_charToFloat(value: Char): Float
|
||||
external fun kotlinclib_charToDouble(value: Char): Double
|
||||
|
||||
|
||||
fun Char.toByte(): Byte {
|
||||
return kotlinclib_charToByte(this)
|
||||
}
|
||||
|
||||
fun Char.toInt(): Int {
|
||||
return kotlinclib_charToInt(this)
|
||||
}
|
||||
|
||||
fun Char.toChar(): Char {
|
||||
return this
|
||||
}
|
||||
|
||||
fun Char.toShort(): Short {
|
||||
return kotlinclib_charToShort(this)
|
||||
}
|
||||
|
||||
fun Char.toLong(): Long {
|
||||
return kotlinclib_charToLong(this)
|
||||
}
|
||||
|
||||
fun Char.toFloat(): Float {
|
||||
return kotlinclib_charToFloat(this)
|
||||
}
|
||||
|
||||
fun Char.toDouble(): Double {
|
||||
return kotlinclib_charToDouble(this)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
external fun kotlinclib_doubleToByte(value: Double): Byte
|
||||
external fun kotlinclib_doubleToChar(value: Double): Char
|
||||
external fun kotlinclib_doubleToShort(value: Double): Short
|
||||
external fun kotlinclib_doubleToInt(value: Double): Int
|
||||
external fun kotlinclib_doubleToLong(value: Double): Long
|
||||
external fun kotlinclib_doubleToFloat(value: Double): Float
|
||||
|
||||
fun Double.toByte(): Byte {
|
||||
return kotlinclib_doubleToByte(this)
|
||||
}
|
||||
|
||||
fun Double.toChar(): Char {
|
||||
return kotlinclib_doubleToChar(this)
|
||||
}
|
||||
|
||||
fun Double.toShort(): Short {
|
||||
return kotlinclib_doubleToShort(this)
|
||||
}
|
||||
|
||||
fun Double.toInt(): Int {
|
||||
return kotlinclib_doubleToInt(this)
|
||||
}
|
||||
|
||||
fun Double.toLong(): Long {
|
||||
return kotlinclib_doubleToLong(this)
|
||||
}
|
||||
|
||||
fun Double.toFloat(): Float {
|
||||
return kotlinclib_doubleToFloat(this)
|
||||
}
|
||||
|
||||
fun Double.toDouble(): Double {
|
||||
return this
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
external fun kotlinclib_floatToByte(value: Float): Byte
|
||||
external fun kotlinclib_floatToChar(value: Float): Char
|
||||
external fun kotlinclib_floatToShort(value: Float): Short
|
||||
external fun kotlinclib_floatToInt(value: Float): Int
|
||||
external fun kotlinclib_floatToLong(value: Float): Long
|
||||
external fun kotlinclib_floatToDouble(value: Float): Double
|
||||
|
||||
fun Float.toByte(): Byte {
|
||||
return kotlinclib_floatToByte(this)
|
||||
}
|
||||
|
||||
fun Float.toChar(): Char {
|
||||
return kotlinclib_floatToChar(this)
|
||||
}
|
||||
|
||||
fun Float.toShort(): Short {
|
||||
return kotlinclib_floatToShort(this)
|
||||
}
|
||||
|
||||
fun Float.toInt(): Int {
|
||||
return kotlinclib_floatToInt(this)
|
||||
}
|
||||
|
||||
fun Float.toLong(): Long {
|
||||
return kotlinclib_floatToLong(this)
|
||||
}
|
||||
|
||||
fun Float.toFloat(): Float {
|
||||
return this
|
||||
}
|
||||
|
||||
fun Float.toDouble(): Double {
|
||||
return kotlinclib_floatToDouble(this)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
external fun kotlinclib_longToByte(value: Long): Byte
|
||||
external fun kotlinclib_longToChar(value: Long): Char
|
||||
external fun kotlinclib_longToShort(value: Long): Short
|
||||
external fun kotlinclib_longToInt(value: Long): Int
|
||||
external fun kotlinclib_longToFloat(value: Long): Float
|
||||
external fun kotlinclib_longToDouble(value: Long): Double
|
||||
|
||||
fun Long.toByte(): Byte {
|
||||
return kotlinclib_longToByte(this)
|
||||
}
|
||||
|
||||
fun Long.toLong(): Long {
|
||||
return this
|
||||
}
|
||||
|
||||
fun Long.toChar(): Char {
|
||||
return kotlinclib_longToChar(this)
|
||||
}
|
||||
|
||||
fun Long.toShort(): Short {
|
||||
return kotlinclib_longToShort(this)
|
||||
}
|
||||
|
||||
fun Long.toInt(): Int {
|
||||
return kotlinclib_longToInt(this)
|
||||
}
|
||||
|
||||
fun Long.toFloat(): Float {
|
||||
return kotlinclib_longToFloat(this)
|
||||
}
|
||||
|
||||
fun Long.toDouble(): Double {
|
||||
return kotlinclib_longToDouble(this)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
external fun kotlinclib_shortToByte(value: Short): Byte
|
||||
external fun kotlinclib_shortToChar(value: Short): Char
|
||||
external fun kotlinclib_shortToInt(value: Short): Int
|
||||
external fun kotlinclib_shortToLong(value: Short): Long
|
||||
external fun kotlinclib_shortToFloat(value: Short): Float
|
||||
external fun kotlinclib_shortToDouble(value: Short): Double
|
||||
|
||||
|
||||
fun Short.toByte(): Byte {
|
||||
return kotlinclib_shortToByte(this)
|
||||
}
|
||||
|
||||
fun Short.toInt(): Int {
|
||||
return kotlinclib_shortToInt(this)
|
||||
}
|
||||
|
||||
fun Short.toChar(): Char {
|
||||
return kotlinclib_shortToChar(this)
|
||||
}
|
||||
|
||||
fun Short.toShort(): Short {
|
||||
return this
|
||||
}
|
||||
|
||||
fun Short.toLong(): Long {
|
||||
return kotlinclib_shortToLong(this)
|
||||
}
|
||||
|
||||
fun Short.toFloat(): Float {
|
||||
return kotlinclib_shortToFloat(this)
|
||||
}
|
||||
|
||||
fun Short.toDouble(): Double {
|
||||
return kotlinclib_shortToDouble(this)
|
||||
}
|
||||
@@ -56,4 +56,326 @@ define double @kotlinclib_intToDouble(i32 %value) #0 {
|
||||
ret double %3
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlinclib_byteToChar(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
ret i8 %2
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i16 @kotlinclib_byteToShort(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlinclib_byteToInt(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i64 @kotlinclib_byteToLong(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i64
|
||||
ret i64 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define float @kotlinclib_byteToFloat(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sitofp i8 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define double @kotlinclib_byteToDouble(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sitofp i8 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlinclib_charToByte(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
ret i8 %2
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i16 @kotlinclib_charToShort(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlinclib_charToInt(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i64 @kotlinclib_charToLong(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i64
|
||||
ret i64 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define float @kotlinclib_charToFloat(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sitofp i8 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define double @kotlinclib_charToDouble(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sitofp i8 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlinclib_shortToByte(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = trunc i16 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlinclib_shortToChar(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = trunc i16 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlinclib_shortToInt(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sext i16 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i64 @kotlinclib_shortToLong(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sext i16 %2 to i64
|
||||
ret i64 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define float @kotlinclib_shortToFloat(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sitofp i16 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define double @kotlinclib_shortToDouble(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sitofp i16 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlinclib_longToByte(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = trunc i64 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlinclib_longToChar(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = trunc i64 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i16 @kotlinclib_longToShort(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = trunc i64 %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlinclib_longToInt(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = trunc i64 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define float @kotlinclib_longToFloat(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = sitofp i64 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define double @kotlinclib_longToDouble(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = sitofp i64 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlinclib_floatToByte(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlinclib_floatToChar(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i16 @kotlinclib_floatToShort(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlinclib_floatToInt(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i64 @kotlinclib_floatToLong(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i64
|
||||
ret i64 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define double @kotlinclib_floatToDouble(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fpext float %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlinclib_doubleToByte(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlinclib_doubleToChar(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i16 @kotlinclib_doubleToShort(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlinclib_doubleToInt(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i64 @kotlinclib_doubleToLong(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i64
|
||||
ret i64 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define float @kotlinclib_doubleToFloat(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptrunc double %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
@@ -2,3 +2,5 @@ testCastToInt_Int(32) == 0
|
||||
testCastToInt_Int(34) == 1
|
||||
testCastToByte_Byte(32) == 0
|
||||
testCastToByte_Byte(34) == 1
|
||||
testCastToShort_Short(32) == 0
|
||||
testCastToShort_Short(34) == 1
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
fun bytearray_1(x: Byte): Byte {
|
||||
val z = ByteArray(10)
|
||||
z.set(1, x)
|
||||
return z.get(1)
|
||||
val r = z.clone()
|
||||
return r.get(1)
|
||||
}
|
||||
@@ -5,3 +5,7 @@ fun testCastToByte(X : Byte): Boolean{
|
||||
fun testCastToInt(X : Int): Boolean{
|
||||
return 34.toInt() == X
|
||||
}
|
||||
|
||||
fun testCastToShort(X : Short): Boolean{
|
||||
return 34.toShort() == X
|
||||
}
|
||||
Reference in New Issue
Block a user