JVM IR: Minor fix for nullable SAM wrappers

This commit is contained in:
Steven Schäfer
2019-09-14 00:11:00 +02:00
committed by Alexander Udalov
parent 4d43c13fb1
commit f2e0c1a930
2 changed files with 10 additions and 3 deletions
@@ -92,7 +92,7 @@ class SingleAbstractMethodLowering(val context: CommonBackendContext) : FileLowe
val instance = irCall(implementation.constructors.single()).apply { val instance = irCall(implementation.constructors.single()).apply {
putValueArgument(0, irGet(invokableVariable)) putValueArgument(0, irGet(invokableVariable))
} }
irIfNull(superType, irGet(invokableVariable), irNull(), instance) +irIfNull(superType, irGet(invokableVariable), irNull(), instance)
} }
} else { } else {
irCall(implementation.constructors.single()).apply { putValueArgument(0, invokable) } irCall(implementation.constructors.single()).apply { putValueArgument(0, invokable) }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// FILE: JFoo.java // FILE: JFoo.java
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -17,8 +16,16 @@ fun test() {
JFoo.foo2({}, runnable()) JFoo.foo2({}, runnable())
} }
// @TestKt.class:
// 2 NEW // 2 NEW
// JVM_TEMPLATES
// @TestKt.class:
// 0 IFNONNULL // 0 IFNONNULL
// 1 IFNULL // 1 IFNULL
// 1 ACONST_NULL // 1 ACONST_NULL
// JVM_IR_TEMPLATES
// @TestKt.class
// 1 IFNONNULL
// 0 IFNULL
// 2 ACONST_NULL