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:
authorMarek Safar <marek.safar@gmail.com>2017-06-30 20:44:41 +0300
committerMarek Safar <marek.safar@gmail.com>2017-06-30 20:47:06 +0300
commitd2a26c959578e8d721cfe320f6ac1d8ee8633cf3 (patch)
tree7cd550c5949e7044133470707233c7a01fd14cd8 /mcs/tests/test-tuple-03.cs
parentbb99b3ef99e38cdbc8fbcab61d62a2943e216b61 (diff)
[mcs] C# 7 tuple (foundation only).
Still couple of advanced features not implemented and parser cannot deal with unnamed tuple type at type declaration level.
Diffstat (limited to 'mcs/tests/test-tuple-03.cs')
-rw-r--r--mcs/tests/test-tuple-03.cs62
1 files changed, 62 insertions, 0 deletions
diff --git a/mcs/tests/test-tuple-03.cs b/mcs/tests/test-tuple-03.cs
new file mode 100644
index 00000000000..7eb45a893ca
--- /dev/null
+++ b/mcs/tests/test-tuple-03.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Linq.Expressions;
+
+class TupleDeconstruct
+{
+ public static int Main ()
+ {
+// var (xx, yy) = (1, 2);
+// if (xx != 1)
+// return 1;
+
+// if (yy != 2)
+// return 2;
+
+ int x, y;
+ (x, y) = (1, 2);
+ if (x != 1)
+ return 1;
+
+ if (y != 2)
+ return 2;
+
+// var (l1, l2) = ('a', 'b');
+
+// var cwd = new ClassWithDeconstruct ();
+// var (m1, m2) = cwd;
+
+// (string, string) ss = cwd; // Error
+
+ return 0;
+ }
+
+ static void Test2 ()
+ {
+ var c = new C ();
+ (c.Prop1, c.Prop2) = (1, 2);
+ }
+
+ static void var1 (object o1, object o2)
+ {
+ }
+
+ static void TestCustom ()
+ {
+ return;
+ }
+}
+
+class ClassWithDeconstruct
+{
+ public void Deconstruct (out string f, out string s)
+ {
+ f = "a";
+ s = "z";
+ }
+}
+
+class C
+{
+ public int Prop1 { get; set; }
+ public int Prop2 { get; set; }
+} \ No newline at end of file