mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 00:21:32 +00:00
This commit fixes two issues in the existing implementation of translating primitive array types: * IrType.getArrayElementType throws an exception when the receiver is a primitive array type, because IR expects primitive array types use symbols defined in IrBuiltIns, but fir2ir translation doesn't; * IteratorNext.toCallable assumes all element types are boxed. The first issue is fixed by changing the fir2ir type translation to use symbols in IrBuiltIns for primitive array types, and the second by not unboxing primitive types.
17 lines
360 B
Kotlin
Vendored
17 lines
360 B
Kotlin
Vendored
fun idiv(a: Int, b: Int): Int =
|
|
if (b == 0) throw Exception("Division by zero") else a / b
|
|
|
|
fun foo(): Int {
|
|
var sum = 0
|
|
for (i in -10 .. 10) {
|
|
sum += try { idiv(100, i) } catch (e: Exception) { continue }
|
|
}
|
|
return sum
|
|
}
|
|
|
|
fun box(): String {
|
|
val test = foo()
|
|
if (test != 0) return "Failed, test=$test"
|
|
|
|
return "OK"
|
|
} |