Files
kotlin-fork/js/js.translator/testData/box/inlineMultiModule/importStdLib.kt
T
Roman Artemev 14b1f0ef6a Fix issue #KT-24475
* count coroutine metadata references during RemoveUnusedImport pass in JsInliner
* add cases to test usage of stdlib symbols in inlined functions
2018-07-26 19:23:06 +03:00

28 lines
552 B
Kotlin
Vendored

// IGNORE_BACKEND: JS_IR
// EXPECTED_REACHABLE_NODES: 1117
// MODULE: lib
// FILE: lib.kt
inline fun foo(i1: Int, i2: Double): Int {
val o = object : Comparable<Int> {
override fun compareTo(other: Int) = i1-other
}
return o.compareTo(i2.toInt())
}
// MODULE: main(lib)
// FILE: main.kt
fun bar(i: Int):Int {
class Cmp2() : Comparable<Int> {
override fun compareTo(other: Int) = -other
}
return Cmp2().compareTo(i)
}
fun box():String {
if (foo(10, 20.0) + bar(-10) != 0) return "FAIL"
return "OK"
}