diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_DeconstructionAssignmentOperator.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_DeconstructionAssignmentOperator.cs index fdd0f29560675..11ad47cb715f4 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_DeconstructionAssignmentOperator.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_DeconstructionAssignmentOperator.cs @@ -47,6 +47,7 @@ private BoundExpression RewriteDeconstruction(BoundTupleExpression left, Convers var last = effects.PopLast(); if (last is null) { + // Deconstructions with no effects lower to nothing. For example, `(_, _) = (1, 2);` result = null; } else diff --git a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs index 0f6a5d3aa61b4..a5cf7864c599b 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs @@ -8311,7 +8311,7 @@ .maxstack 2 diff2.VerifyIL("C.G", @" { - // Code size 63 (0x3f) + // Code size 61 (0x3d) .maxstack 2 .locals init ([unchanged] V_0, [int] V_1, @@ -8331,32 +8331,30 @@ .maxstack 2 IL_0007: stloc.s V_9 IL_0009: ldc.i4.0 IL_000a: stloc.s V_10 - IL_000c: br.s IL_0036 + IL_000c: br.s IL_0034 IL_000e: ldloc.s V_9 IL_0010: ldloc.s V_10 IL_0012: ldelem ""System.ValueTuple"" IL_0017: dup IL_0018: ldfld ""int System.ValueTuple.Item1"" IL_001d: stloc.2 - IL_001e: dup - IL_001f: ldfld ""(bool, double) System.ValueTuple.Item2"" - IL_0024: stloc.s V_11 - IL_0026: pop - IL_0027: nop - IL_0028: ldloc.2 - IL_0029: call ""void System.Console.WriteLine(int)"" - IL_002e: nop - IL_002f: nop - IL_0030: ldloc.s V_10 - IL_0032: ldc.i4.1 - IL_0033: add - IL_0034: stloc.s V_10 - IL_0036: ldloc.s V_10 - IL_0038: ldloc.s V_9 - IL_003a: ldlen - IL_003b: conv.i4 - IL_003c: blt.s IL_000e - IL_003e: ret + IL_001e: ldfld ""(bool, double) System.ValueTuple.Item2"" + IL_0023: stloc.s V_11 + IL_0025: nop + IL_0026: ldloc.2 + IL_0027: call ""void System.Console.WriteLine(int)"" + IL_002c: nop + IL_002d: nop + IL_002e: ldloc.s V_10 + IL_0030: ldc.i4.1 + IL_0031: add + IL_0032: stloc.s V_10 + IL_0034: ldloc.s V_10 + IL_0036: ldloc.s V_9 + IL_0038: ldlen + IL_0039: conv.i4 + IL_003a: blt.s IL_000e + IL_003c: ret } "); } diff --git a/src/Compilers/CSharp/Test/Emit/PDB/PDBTupleTests.cs b/src/Compilers/CSharp/Test/Emit/PDB/PDBTupleTests.cs index 772f776ff5384..219f1803a6fbf 100644 --- a/src/Compilers/CSharp/Test/Emit/PDB/PDBTupleTests.cs +++ b/src/Compilers/CSharp/Test/Emit/PDB/PDBTupleTests.cs @@ -246,17 +246,17 @@ static void F(System.Collections.Generic.IEnumerable<(int a, int b)> ie)