blob: e195bca198484ec89e6fa6230d733b7622fad513 [file]
// FILE: lib.kt
package foo
inline fun <T> buzz(x: T): T {
log("buzz($x)")
return x
}
// CHECK_NOT_CALLED: buzz
private var LOG = ""
fun log(string: String) {
LOG += "$string;"
}
fun pullLog(): String {
val string = LOG
LOG = ""
return string
}
// FILE: main.kt
package foo
import kotlin.test.*
fun <T> fizz(x: T): T {
log("fizz($x)")
return x
}
fun test(x: Boolean?): Boolean = buzz(x) ?: fizz(true)
fun box(): String {
assertEquals(true, test(null))
assertEquals("buzz(null);fizz(true);", pullLog())
assertEquals(false, test(false))
assertEquals("buzz(false);", pullLog())
assertEquals(true, test(true))
assertEquals("buzz(true);", pullLog())
return "OK"
}