Update mcs/class/System.Core/System/TimeZoneInfo.cs
[mono.git] / mcs / tests / gtest-126.cs
1 using System.Collections.Generic;
2
3 // comment this line to see another bug in gmcs (unrelated)
4 interface IB { bool foo (); }
5
6
7 class B : IB { public bool foo () { return true; } }
8
9 interface Filter <T> where T : IB {
10   T Is (IB x);
11
12 }
13
14 struct K : IB {
15   public bool foo () { return false; }
16
17 }
18
19 class MyFilter : Filter <K> {
20   public K Is (IB x) { return new K(); }
21 }
22
23 class MyBFilter : Filter <B> {
24   public B Is (IB x) { return new B(); }
25 }
26
27 class M {
28  
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;
35   }
36  
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);
42   }
43 }