diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java index e31a379b65a..db23152bf54 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java @@ -500,8 +500,6 @@ public class ExpressionCodegen extends JetVisitor { private void generateMultiVariables(int tmpParameterIndex, List entries) { Type asmElementType = asmType(getElementType()); for (JetMultiDeclarationEntry variableDeclaration : entries) { - v.load(tmpParameterIndex, asmElementType); - final VariableDescriptor componentDescriptor = bindingContext.get(BindingContext.VARIABLE, variableDeclaration); final Type componentAsmType = asmType(componentDescriptor.getReturnType()); diff --git a/compiler/testData/codegen/multiDecl/MultiDeclFor.kt b/compiler/testData/codegen/multiDecl/MultiDeclFor.kt new file mode 100644 index 00000000000..96bb5d56eec --- /dev/null +++ b/compiler/testData/codegen/multiDecl/MultiDeclFor.kt @@ -0,0 +1,21 @@ +class C(val i: Int) { + fun component1() = i + 1 + fun component2() = i + 2 +} + +fun doTest(l : java.util.ArrayList): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = java.util.ArrayList() + l.add(C(0)) + l.add(C(1)) + l.add(C(2)) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/compiler/testData/codegen/multiDecl/MultiDeclForComponentExtensions.kt b/compiler/testData/codegen/multiDecl/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..12f00f6f48c --- /dev/null +++ b/compiler/testData/codegen/multiDecl/MultiDeclForComponentExtensions.kt @@ -0,0 +1,22 @@ +class C(val i: Int) { +} + +fun C.component1() = i + 1 +fun C.component2() = i + 2 + +fun doTest(l : java.util.ArrayList): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = java.util.ArrayList() + l.add(C(0)) + l.add(C(1)) + l.add(C(2)) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/compiler/testData/codegen/multiDecl/MultiDeclForComponentMemberExtensions.kt b/compiler/testData/codegen/multiDecl/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..8b844a17f36 --- /dev/null +++ b/compiler/testData/codegen/multiDecl/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,24 @@ +class C(val i: Int) { +} + +class M { + fun C.component1() = i + 1 + fun C.component2() = i + 2 + + fun doTest(l : java.util.ArrayList): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val l = java.util.ArrayList() + l.add(C(0)) + l.add(C(1)) + l.add(C(2)) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/compiler/testData/codegen/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/compiler/testData/codegen/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..2b1499e2733 --- /dev/null +++ b/compiler/testData/codegen/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,24 @@ +class C(val i: Int) { +} + +class M { + fun C.component1() = i + 1 + fun C.component2() = i + 2 +} + +fun M.doTest(l : java.util.ArrayList): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = java.util.ArrayList() + l.add(C(0)) + l.add(C(1)) + l.add(C(2)) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/compiler/testData/codegen/multiDecl/MultiDeclForValCaptured.kt b/compiler/testData/codegen/multiDecl/MultiDeclForValCaptured.kt new file mode 100644 index 00000000000..d06d092a9a7 --- /dev/null +++ b/compiler/testData/codegen/multiDecl/MultiDeclForValCaptured.kt @@ -0,0 +1,21 @@ +class C(val i: Int) { + fun component1() = i + 1 + fun component2() = i + 2 +} + +fun doTest(l : java.util.ArrayList): String { + var s = "" + for ((a, b) in l) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val l = java.util.ArrayList() + l.add(C(0)) + l.add(C(1)) + l.add(C(2)) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/MultiDeclTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/MultiDeclTestGenerated.java index 4ef26ec56bd..9938984b076 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/MultiDeclTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/MultiDeclTestGenerated.java @@ -37,6 +37,31 @@ public class MultiDeclTestGenerated extends AbstractMultiDeclTestCase { blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/ComplexInitializer.kt"); } + @TestMetadata("MultiDeclFor.kt") + public void testMultiDeclFor() throws Exception { + blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/MultiDeclFor.kt"); + } + + @TestMetadata("MultiDeclForComponentExtensions.kt") + public void testMultiDeclForComponentExtensions() throws Exception { + blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/MultiDeclForComponentExtensions.kt"); + } + + @TestMetadata("MultiDeclForComponentMemberExtensions.kt") + public void testMultiDeclForComponentMemberExtensions() throws Exception { + blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/MultiDeclForComponentMemberExtensions.kt"); + } + + @TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt") + public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception { + blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt"); + } + + @TestMetadata("MultiDeclForValCaptured.kt") + public void testMultiDeclForValCaptured() throws Exception { + blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/MultiDeclForValCaptured.kt"); + } + @TestMetadata("SimpleVals.kt") public void testSimpleVals() throws Exception { blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/SimpleVals.kt");