[JVM_IR] Do not compile-time evaluate apiVersionIsAtLeast in stdlib
Function `apiVersionIsAtLeast` was introduced to be able to have different inline function content inlined to user code call sites depending on their api version settings. Thus, it should not be compile-time evaluated when being called in the body of inline stdlib function. ^KT-59452: Fixed
This commit is contained in:
committed by
Space Team
parent
adab552928
commit
e4f1c10bc1
+24
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// Wrong function resolution after package renaming
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
// FILE: A.kt
|
||||
|
||||
package kotlin.internal
|
||||
fun apiVersionIsAtLeast(epic: Int, major: Int, minor: Int): Boolean {
|
||||
return false
|
||||
}
|
||||
inline fun versionDependentInlineFun() = if (apiVersionIsAtLeast(1, 1, 0)) "Fail" else "OK"
|
||||
inline fun test() = versionDependentInlineFun()
|
||||
|
||||
// FILE: B.kt
|
||||
import kotlin.internal.*
|
||||
|
||||
fun box(): String {
|
||||
val clazz = Class.forName("kotlin.internal.AKt")
|
||||
val func = clazz.methods.single { it.name == "test" }
|
||||
return func.invoke(null) as String
|
||||
}
|
||||
Reference in New Issue
Block a user