-using System;\r
-\r
-struct Foo\r
-{\r
- public int Value;\r
-\r
- public Foo (int value)\r
- {\r
- this.Value = value;\r
- }\r
-\r
- public static Foo operator - (Foo? f)\r
- {\r
- if (f.HasValue)\r
- return new Foo (-f.Value.Value);\r
-\r
- return new Foo (42);\r
- }\r
-}\r
-\r
-struct Bar\r
-{\r
- public int Value;\r
-\r
- public Bar (int value)\r
- {\r
- this.Value = value;\r
- }\r
-\r
- public static Bar? operator - (Bar? b)\r
- {\r
- if (b.HasValue)\r
- return new Bar (-b.Value.Value);\r
-\r
- return b;\r
- }\r
-}\r
-\r
-class Test\r
-{\r
-\r
- static Foo NegateFoo (Foo f)\r
- {\r
- return -f;\r
- }\r
-\r
- static Foo NegateFooNullable (Foo? f)\r
- {\r
- return -f;\r
- }\r
-\r
- static Bar? NegateBarNullable (Bar? b)\r
- {\r
- return -b;\r
- }\r
-\r
- static Bar? NegateBar (Bar b)\r
- {\r
- return -b;\r
- }\r
-\r
- static int Main ()\r
- {\r
- if (NegateFooNullable (null).Value != 42)\r
- return 1;\r
-\r
- if (NegateFoo (new Foo (2)).Value != -2)\r
- return 2;\r
-\r
- if (NegateBarNullable (null) != null)\r
- return 3;\r
-\r
- if (NegateBar (new Bar (2)).Value.Value != -2)\r
- return 4;\r
-\r
- Console.WriteLine ("OK");\r
- return 0;\r
- }\r
-}\r
+using System;
+
+struct Foo
+{
+ public int Value;
+
+ public Foo (int value)
+ {
+ this.Value = value;
+ }
+
+ public static Foo operator - (Foo? f)
+ {
+ if (f.HasValue)
+ return new Foo (-f.Value.Value);
+
+ return new Foo (42);
+ }
+}
+
+struct Bar
+{
+ public int Value;
+
+ public Bar (int value)
+ {
+ this.Value = value;
+ }
+
+ public static Bar? operator - (Bar? b)
+ {
+ if (b.HasValue)
+ return new Bar (-b.Value.Value);
+
+ return b;
+ }
+}
+
+class Test
+{
+
+ static Foo NegateFoo (Foo f)
+ {
+ return -f;
+ }
+
+ static Foo NegateFooNullable (Foo? f)
+ {
+ return -f;
+ }
+
+ static Bar? NegateBarNullable (Bar? b)
+ {
+ return -b;
+ }
+
+ static Bar? NegateBar (Bar b)
+ {
+ return -b;
+ }
+
+ public static int Main ()
+ {
+ if (NegateFooNullable (null).Value != 42)
+ return 1;
+
+ if (NegateFoo (new Foo (2)).Value != -2)
+ return 2;
+
+ if (NegateBarNullable (null) != null)
+ return 3;
+
+ if (NegateBar (new Bar (2)).Value.Value != -2)
+ return 4;
+
+ Console.WriteLine ("OK");
+ return 0;
+ }
+}