[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
@@ -201,16 +201,7 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
|
||||
protected abstract fun generateAssertField()
|
||||
|
||||
private fun isInlinedToInlineFunInKotlinRuntime(): Boolean {
|
||||
val codegen = this.codegen as? ExpressionCodegen ?: return false
|
||||
val caller = codegen.context.functionDescriptor
|
||||
if (!caller.isInline) return false
|
||||
val callerPackage = DescriptorUtils.getParentOfType(caller, PackageFragmentDescriptor::class.java) ?: return false
|
||||
return callerPackage.fqName.asString().let {
|
||||
// package either equals to 'kotlin' or starts with 'kotlin.'
|
||||
it.startsWith("kotlin") && (it.length <= 6 || it[6] == '.')
|
||||
}
|
||||
}
|
||||
protected abstract fun isInlinedToInlineFunInKotlinRuntime(): Boolean
|
||||
|
||||
protected fun rememberClosure(parameterType: Type, index: Int, lambdaInfo: LambdaInfo) {
|
||||
invocationParamBuilder.addNextValueParameter(parameterType, true, null, index).functionalArgument = lambdaInfo
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isAncestor
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.calls.util.getResolvedCallWithAssert
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil
|
||||
@@ -185,6 +186,14 @@ class PsiInlineCodegen(
|
||||
putCapturedToLocalVal(stackValue, activeLambda!!.capturedVars[paramIndex], stackValue.kotlinType)
|
||||
|
||||
override fun reorderArgumentsIfNeeded(actualArgsWithDeclIndex: List<ArgumentAndDeclIndex>, valueParameterTypes: List<Type>) = Unit
|
||||
|
||||
override fun isInlinedToInlineFunInKotlinRuntime(): Boolean {
|
||||
val codegen = this.codegen as? ExpressionCodegen ?: return false
|
||||
val caller = codegen.context.functionDescriptor
|
||||
if (!caller.isInline) return false
|
||||
val callerPackage = DescriptorUtils.getParentOfType(caller, PackageFragmentDescriptor::class.java) ?: return false
|
||||
return callerPackage.fqName.asString().startsWith("kotlin.")
|
||||
}
|
||||
}
|
||||
|
||||
private val FunctionDescriptor.explicitParameters
|
||||
|
||||
Reference in New Issue
Block a user