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>2013-06-25 14:35:45 +0400
committerMarek Safar <marek.safar@gmail.com>2013-06-25 14:38:05 +0400
commit09ca788b4b0c7c1fc3e84cf96dda1440001a79c3 (patch)
treed3380c17369a295368f5d188314cb79a5fa1f9e4 /mcs/tests/gtest-585.cs
parent4c93595171a30353b167a4c9e6b9ba740b851a65 (diff)
Rewrite lifted binary operators to match C# spec more closely. Fixes #12608 and about 10 other issues.
Diffstat (limited to 'mcs/tests/gtest-585.cs')
-rw-r--r--mcs/tests/gtest-585.cs71
1 files changed, 71 insertions, 0 deletions
diff --git a/mcs/tests/gtest-585.cs b/mcs/tests/gtest-585.cs
new file mode 100644
index 00000000000..ff2a16ca8ca
--- /dev/null
+++ b/mcs/tests/gtest-585.cs
@@ -0,0 +1,71 @@
+using System;
+
+struct S
+{
+ public static implicit operator int (S arg)
+ {
+ throw new ApplicationException ();
+ }
+}
+
+struct S2
+{
+ public static implicit operator int?(S2 arg)
+ {
+ return 10000;
+ }
+
+ public static implicit operator uint?(S2 arg)
+ {
+ throw new ApplicationException ();
+ }
+}
+
+public struct S3
+{
+ public static int counter;
+
+ public static implicit operator string (S3 s3)
+ {
+ counter++;
+ return "";
+ }
+}
+
+class C
+{
+ public static int Main ()
+ {
+ S? s = null;
+ bool res = s > 1;
+ if (res)
+ return 1;
+
+ S2 s2 = new S2 ();
+
+ var b = s2 >> 3;
+ if (b != 1250)
+ return 2;
+
+ var b2 = s2 >> s2;
+ if (b2 != 0)
+ return 3;
+
+ var b3 = s2 + 1;
+ if (b3 != 10001)
+ return 4;
+
+ var s3 = new S3 ();
+ if ((s3 == null) != false)
+ return 5;
+
+ if ((s3 != null) != true)
+ return 6;
+
+ if (S3.counter != 2)
+ return 7;
+
+ Console.WriteLine ("ok");
+ return 0;
+ }
+} \ No newline at end of file