diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index ab2b0515803..9f766cc5a22 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -3457,10 +3457,6 @@ public class ExpressionCodegen extends KtVisitor impleme initializeDestructuringDeclarationVariables(multiDeclaration, initializerAsReceiver, local, asProperty); - if (initializerAsmType.getSort() == Type.OBJECT || initializerAsmType.getSort() == Type.ARRAY) { - v.aconst(null); - v.store(tempVarIndex, initializerAsmType); - } myFrameMap.leaveTemp(initializerAsmType); return StackValue.none(); diff --git a/compiler/testData/codegen/bytecodeText/doNotStoreNullForTmpInDestructuring.kt b/compiler/testData/codegen/bytecodeText/doNotStoreNullForTmpInDestructuring.kt new file mode 100644 index 00000000000..0976851b5b1 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/doNotStoreNullForTmpInDestructuring.kt @@ -0,0 +1,5 @@ +fun test(p: Pair) { + val (x, y) = p +} + +// 0 ACONST_NULL diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index c37a8d1df9c..9e7f364a4cd 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -132,6 +132,12 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { doTest(fileName); } + @TestMetadata("doNotStoreNullForTmpInDestructuring.kt") + public void testDoNotStoreNullForTmpInDestructuring() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/doNotStoreNullForTmpInDestructuring.kt"); + doTest(fileName); + } + @TestMetadata("doNotStoreNullsForCapturedVars.kt") public void testDoNotStoreNullsForCapturedVars() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/doNotStoreNullsForCapturedVars.kt");