/mcs/tests/gtest-169.cs

https://bitbucket.org/danipen/mono · C# · 20 lines · 18 code · 2 blank · 0 comment · 2 complexity · c0ce8d5bb020b88952283be6474bafa9 MD5 · raw file

  1. class list <A> {
  2. public class Cons <T> : list <T> { }
  3. public class Nil <T> : list <T> { }
  4. }
  5. class C {
  6. public static void Rev<T> (list <T> y) {
  7. if (y is list<object>.Cons<T>)
  8. System.Console.WriteLine ("Cons");
  9. if (y is list<object>.Nil<T>)
  10. System.Console.WriteLine ("Nil");
  11. }
  12. }
  13. class M {
  14. public static void Main () {
  15. C.Rev (new list<object>.Cons <string> ());
  16. C.Rev (new list<object>.Nil <string> ());
  17. }
  18. }