JVM IR: coerce call result to expected expression type

The boundWithSerializableReceiver.kt test is muted since property
references are not yet supported in the JVM IR backend. Previously it
passed by accident
This commit is contained in:
Alexander Udalov
2019-02-06 18:35:34 +01:00
committed by Alexander Udalov
parent 8b395589be
commit 1c143310ac
2 changed files with 4 additions and 4 deletions
@@ -376,13 +376,12 @@ class ExpressionCodegen(
if (returnType != null && KotlinBuiltIns.isNothing(returnType)) {
mv.aconst(null)
mv.athrow()
} else if (expression.descriptor !is ConstructorDescriptor) {
return returnType?.run { coerceNotToUnit(callable.returnType, returnType, this) } ?: onStack(callable.returnType, returnType)
} else {
return expression.onStack
} else if (expression.descriptor is ConstructorDescriptor) {
return none()
}
return expression.onStack
return coerceNotToUnit(callable.returnType, returnType, expression.type.toKotlinType())
}
override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall, data: BlockInfo): StackValue {
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
// WITH_REFLECT
import java.io.*