Browse Source

Deconstruction: Correctness test where same variable is assigned twice.

pull/2119/head
Daniel Grunwald 5 years ago
parent
commit
1f9f9c3b24
  1. 22
      ICSharpCode.Decompiler.Tests/TestCases/Correctness/DeconstructionTests.cs

22
ICSharpCode.Decompiler.Tests/TestCases/Correctness/DeconstructionTests.cs

@ -135,6 +135,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -135,6 +135,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
NullReferenceException_Field_Deconstruction(out _);
NullReferenceException_RefLocalReferencesField_Deconstruction(out _);
NullReferenceException_RefLocalReferencesArrayElement_Deconstruction(out _, null);
DeconstructTupleSameVar(("a", "b"));
DeconstructTupleListForEachSameVar(new List<(string, string)> { ("a", "b") });
}
public void Property_NoDeconstruction_SwappedAssignments()
@ -223,5 +225,25 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -223,5 +225,25 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
Console.WriteLine(ex.GetType().FullName);
}
}
public void DeconstructTupleSameVar((string, string) tuple)
{
Console.WriteLine("DeconstructTupleSameVar:");
string a;
a = tuple.Item1;
a = tuple.Item2;
Console.WriteLine(a);
}
public void DeconstructTupleListForEachSameVar(List<(string, string)> tuples)
{
Console.WriteLine("DeconstructTupleListForEachSameVar:");
foreach (var tuple in tuples) {
string a;
a = tuple.Item1;
a = tuple.Item2;
Console.WriteLine(a);
}
}
}
}

Loading…
Cancel
Save