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.
35 lines
578 B
Kotlin
Vendored
35 lines
578 B
Kotlin
Vendored
// WITH_RUNTIME
|
|
import kotlin.test.*
|
|
|
|
var log = ""
|
|
var result = 20
|
|
var doubleResult = 40.0
|
|
|
|
fun <T> id(value: T) = value
|
|
|
|
fun box(): String {
|
|
result += if (id("true") == "true") {
|
|
result += 10
|
|
log += "true chosen;"
|
|
3
|
|
}
|
|
else {
|
|
4
|
|
}
|
|
|
|
assertEquals(23, result)
|
|
|
|
doubleResult += if (id("true") == "true") {
|
|
doubleResult += 100
|
|
log += "true chosen;"
|
|
2
|
|
}
|
|
else {
|
|
5
|
|
}
|
|
|
|
assertEquals(42, (doubleResult + 0.1).toInt())
|
|
assertEquals("true chosen;true chosen;", log)
|
|
|
|
return "OK"
|
|
} |