9dd8eda1c9
Library methods such as 'listOf' are resolved to have the package fragments as their parents, but JVM expects their containing file classes as parents. This fix generates those file classes and uses them as parent replacements for such library methods.
20 lines
394 B
Kotlin
Vendored
20 lines
394 B
Kotlin
Vendored
// KJS_WITH_FULL_RUNTIME
|
|
// !LANGUAGE: +VariableDeclarationInWhenSubject
|
|
// WITH_RUNTIME
|
|
|
|
fun sparse(x: Int): Int {
|
|
return when (val xx = (x % 4) * 100) {
|
|
100 -> 1
|
|
200 -> xx / 100
|
|
300 -> 3
|
|
else -> 4
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
var result = (0..3).map(::sparse).joinToString()
|
|
|
|
if (result != "4, 1, 2, 3") return "sparse:" + result
|
|
return "OK"
|
|
}
|