eol
[mcs.git] / tests / gtest-126.cs
blob9a38f032eabd1d025d6433967167b9221c9c9716
1 using System.Collections.Generic;
3 // comment this line to see another bug in gmcs (unrelated)
4 interface IB { bool foo (); }
7 class B : IB { public bool foo () { return true; } }
9 interface Filter <T> where T : IB {
10 T Is (IB x);
14 struct K : IB {
15 public bool foo () { return false; }
19 class MyFilter : Filter <K> {
20 public K Is (IB x) { return new K(); }
23 class MyBFilter : Filter <B> {
24 public B Is (IB x) { return new B(); }
27 class M {
29 static List<T> foo1 <T> (Filter <T> x) where T : IB {
30 List <T> result = new List <T>();
31 T maybe = x.Is (new B());
32 if (maybe != null)
33 result.Add (maybe);
34 return result;
37 static void Main () {
38 MyFilter m = new MyFilter ();
39 System.Console.WriteLine (foo1 <K> (m).Count);
40 MyBFilter mb = new MyBFilter ();
41 System.Console.WriteLine (foo1 <B> (mb).Count);