+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-public delegate R Fun<A1,R>(A1 x);
-
-class MyTest {
- public static void Main(String[] args) {
- foreach (Object d in Map<int,int,String,Object>
- (delegate (int x) { return x.ToString(); },
- FromTo(10,20)))
- Console.WriteLine(d);
- }
-
- // Map with argument/result co/contravariance:
- // Aa=argument, Rr=result, Af=f's argument, Rf=f's result
-
- public static IEnumerable<Rr> Map<Aa,Af,Rf,Rr>(Fun<Af,Rf> f,
- IEnumerable<Aa> xs)
- where Aa : Af
- where Rf : Rr
- {
- foreach (Aa x in xs)
- yield return f(x); // gmcs 1.1.9 bug: cannot convert Aa to Af
- }
-
- // FromTo : int * int -> int stream
-
- public static IEnumerable<int> FromTo(int from, int to) {
- for (int i=from; i<=to; i++)
- yield return i;
- }
-}
-
-
+++ /dev/null
-using System.Collections.Generic;
-
-class TestGoto
-{
- static int x = 2;
-
- public static void Main(string[] args)
- {
- foreach (bool b in test())
- ;
- if (x != 0)
- throw new System.Exception ();
- }
-
- static IEnumerable<bool> setX()
- {
- x = 1;
- try {
- yield return true;
- } finally {
- x = 0;
- }
- }
-
- static IEnumerable<bool> test()
- {
- foreach (bool b in setX()) {
- yield return true;
- // Change "goto label" to "break" to show the correct result.
- goto label;
- }
- label:
- yield break;
- }
-}
--- /dev/null
+using System.Collections.Generic;
+
+class TestGoto
+{
+ static int x = 2;
+
+ public static void Main(string[] args)
+ {
+ foreach (bool b in test())
+ ;
+ if (x != 0)
+ throw new System.Exception ();
+ }
+
+ static IEnumerable<bool> setX()
+ {
+ x = 1;
+ try {
+ yield return true;
+ } finally {
+ x = 0;
+ }
+ }
+
+ static IEnumerable<bool> test()
+ {
+ foreach (bool b in setX()) {
+ yield return true;
+ // Change "goto label" to "break" to show the correct result.
+ goto label;
+ }
+ label:
+ yield break;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+public delegate R Fun<A1,R>(A1 x);
+
+class MyTest {
+ public static void Main(String[] args) {
+ foreach (Object d in Map<int,int,String,Object>
+ (delegate (int x) { return x.ToString(); },
+ FromTo(10,20)))
+ Console.WriteLine(d);
+ }
+
+ // Map with argument/result co/contravariance:
+ // Aa=argument, Rr=result, Af=f's argument, Rf=f's result
+
+ public static IEnumerable<Rr> Map<Aa,Af,Rf,Rr>(Fun<Af,Rf> f,
+ IEnumerable<Aa> xs)
+ where Aa : Af
+ where Rf : Rr
+ {
+ foreach (Aa x in xs)
+ yield return f(x); // gmcs 1.1.9 bug: cannot convert Aa to Af
+ }
+
+ // FromTo : int * int -> int stream
+
+ public static IEnumerable<int> FromTo(int from, int to) {
+ for (int i=from; i<=to; i++)
+ yield return i;
+ }
+}
+
+
--- /dev/null
+using System;
+
+class Program
+{
+ static int Main ()
+ {
+ int foo = 9;
+
+ switch (foo) {
+ case 1:
+ gotoTarget:
+ {
+ return 0;
+ }
+ default:
+ {
+ if (foo != 0) {
+ goto gotoTarget;
+ }
+
+ break;
+ }
+ }
+
+ return 1;
+ }
+}
+