JVM_IR pass reified type parameters in indy SAM conversion proxy

This commit is contained in:
Dmitry Petrov
2021-10-07 12:37:08 +03:00
committed by teamcityserver
parent 40fe67880b
commit 005d3b1f6f
15 changed files with 221 additions and 7 deletions
@@ -332,7 +332,7 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext)
}
val proxyFun = context.irFactory.buildFun {
name = Name.identifier("\$proxy")
name = Name.identifier("${targetFun.name.asString()}__proxy")
returnType = targetFun.returnType
visibility = DescriptorVisibilities.LOCAL
modality = Modality.FINAL
@@ -395,6 +395,10 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext)
)
}
for (typeParameterIndex in targetFun.typeParameters.indices) {
targetCall.putTypeArgument(typeParameterIndex, reference.getTypeArgument(typeParameterIndex))
}
val proxyFunBody = IrBlockBodyImpl(startOffset, endOffset).also { proxyFun.body = it }
when {
targetFun.isArrayOf() -> {
@@ -132,8 +132,7 @@ internal class LambdaMetafactoryArgumentsBuilder(
val implFun = reference.symbol.owner
if (implFun.typeParameters.any { it.isReified }) {
// TODO support reified type parameters in proxy wrappers somehow?
abiHazard = true
functionHazard = true
}
// Don't generate references to intrinsic functions as invokedynamic (no such method exists at run-time).