JVM_IR KT-48987 handle star projection arguments in smart casts

This commit is contained in:
Xin Wang
2021-11-29 19:27:48 +08:00
committed by Alexander Udalov
parent 944fa7e2f8
commit c74453d8d2
4 changed files with 30 additions and 1 deletions
@@ -532,7 +532,12 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext)
else irFunctionReference.getArgumentsWithIr().singleOrNull()
// The type of the reference is KFunction<in A1, ..., in An, out R>
private val parameterTypes = (irFunctionReference.type as IrSimpleType).arguments.map { (it as IrTypeProjection).type }
private val parameterTypes = (irFunctionReference.type as IrSimpleType).arguments.map {
when (it) {
is IrTypeProjection -> it.type
else -> context.irBuiltIns.anyNType
}
}
private val argumentTypes = parameterTypes.dropLast(1)
private val referenceReturnType = parameterTypes.last()