Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mcs/mcs/tuples.cs15
-rw-r--r--mcs/tests/test-tuple-10.cs9
-rw-r--r--mcs/tests/ver-il-net_4_x.xml13
3 files changed, 37 insertions, 0 deletions
diff --git a/mcs/mcs/tuples.cs b/mcs/mcs/tuples.cs
index 15a2ca5b0d3..5226b9843ec 100644
--- a/mcs/mcs/tuples.cs
+++ b/mcs/mcs/tuples.cs
@@ -267,6 +267,11 @@ namespace Mono.CSharp
this.Location = expr.Location;
}
+ public TupleLiteralElement Clone (CloneContext clonectx)
+ {
+ return new TupleLiteralElement (Name, Expr.Clone (clonectx), Location);
+ }
+
public string Name { get; private set; }
public Expression Expr { get; set; }
public Location Location { get; private set; }
@@ -288,6 +293,16 @@ namespace Mono.CSharp
}
}
+ protected override void CloneTo (CloneContext clonectx, Expression t)
+ {
+ var clone = new List<TupleLiteralElement> (elements.Count);
+ foreach (var te in elements)
+ clone.Add (te.Clone (clonectx));
+
+ TupleLiteral target = (TupleLiteral)t;
+ target.elements = clone;
+ }
+
public static bool ContainsNoTypeElement (TypeSpec type)
{
var ta = type.TypeArguments;
diff --git a/mcs/tests/test-tuple-10.cs b/mcs/tests/test-tuple-10.cs
new file mode 100644
index 00000000000..82f4e01ec1f
--- /dev/null
+++ b/mcs/tests/test-tuple-10.cs
@@ -0,0 +1,9 @@
+using System.Linq;
+
+class Program {
+ public static int Main ()
+ {
+ var l = (from f in (typeof (Program)).GetFields() select (name: f.Name, offset: 0)).ToList();
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/mcs/tests/ver-il-net_4_x.xml b/mcs/tests/ver-il-net_4_x.xml
index 87571cea7bb..64279ec3a9c 100644
--- a/mcs/tests/ver-il-net_4_x.xml
+++ b/mcs/tests/ver-il-net_4_x.xml
@@ -73792,6 +73792,19 @@
</method>
</type>
</test>
+ <test name="test-tuple-10.cs">
+ <type name="Program">
+ <method name="Int32 Main()" attrs="150">
+ <size>65</size>
+ </method>
+ <method name="System.ValueTuple`2[System.String,System.Int32] &lt;Main&gt;m__0(System.Reflection.FieldInfo)" attrs="145">
+ <size>21</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-var-01.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">