API version calls preprocessing, 1st passing test

This commit is contained in:
Dmitry Petrov
2017-09-22 17:20:45 +03:00
parent 4e7c4c3976
commit fd16035bbd
8 changed files with 208 additions and 4 deletions

View File

@@ -0,0 +1,41 @@
// TARGET_BACKEND: JVM
// FILE: 1.kt
package kotlin.internal
fun apiVersionIsAtLeast(epic: Int, major: Int, minor: Int): Boolean {
return false
}
var properFunctionWasClled = false
fun doSomethingNew() {
properFunctionWasClled = true
}
fun doSomethingOld() {
throw AssertionError("Should not be called")
}
inline fun versionDependentInlineFun() {
if (apiVersionIsAtLeast(1, 1, 0)) {
doSomethingNew()
}
else {
doSomethingOld()
}
}
fun test() {
versionDependentInlineFun()
}
// FILE: 2.kt
import kotlin.internal.*
fun box(): String {
test()
if (!properFunctionWasClled) return "Fail 1"
return "OK"
}