diff --git a/src/Compilers/CSharp/Portable/Binder/DecisionDagBuilder.cs b/src/Compilers/CSharp/Portable/Binder/DecisionDagBuilder.cs index 17114636f09c1..f5b4c479959db 100644 --- a/src/Compilers/CSharp/Portable/Binder/DecisionDagBuilder.cs +++ b/src/Compilers/CSharp/Portable/Binder/DecisionDagBuilder.cs @@ -847,6 +847,8 @@ DagState uniqifyState(ImmutableArray cases, ImmutableDictionary().Single(); + var model = (CSharpSemanticModel)comp.GetSemanticModel(tree); + var binder = model.GetEnclosingBinder(@switch.SpanStart); + var boundSwitch = (BoundSwitchStatement)binder.BindStatement(@switch, BindingDiagnosticBag.Discarded); + AssertEx.Equal( +@"[0]: t0 != null ? [1] : [27] +[1]: t1 = t0.Length; [2] +[2]: t1 >= 1 ? [3] : [27] +[3]: t2 = t0[-1]; [4] +[4]: t2 != null ? [5] : [24] +[5]: t3 = t2.Length; [6] +[6]: t3 >= 1 ? [7] : [19] +[7]: t4 = t2[-1]; [8] +[8]: t4 == 42 ? [9] : [10] +[9]: leaf `case [.., [.., 42]]:` +[10]: t1 == 1 ? [11] : [27] +[11]: t5 = t0[0]; [12] +[12]: t5 <-- t2; [13] +[13]: t7 = t5.Length; [14] +[14]: t7 <-- t3; [15] +[15]: t7 == 1 ? [16] : [27] +[16]: t9 = t5[0]; [17] +[17]: t3 <-- t7; [18] +[18]: t9 <-- t4; [27] +[19]: t1 == 1 ? [20] : [27] +[20]: t5 = t0[0]; [21] +[21]: t5 <-- t2; [22] +[22]: t7 = t5.Length; [23] +[23]: t7 <-- t3; [27] +[24]: t1 == 1 ? [25] : [27] +[25]: t5 = t0[0]; [26] +[26]: t5 <-- t2; [27] +[27]: leaf `switch (a) + { + case [.., [.., 42]]: + case [[42]]: + break; + }` +", boundSwitch.DecisionDag.Dump()); } [Fact]