2009-06-19 Gonzalo Paniagua Javier <gonzalo@novell.com>
[mono.git] / mcs / tests / gtest-variance-2.cs
1 // Compiler options: -langversion:future
2
3 interface IFoo<in T>
4 {
5         string Bar (T t);
6 }
7
8 class Foo : IFoo<object>
9 {
10         public string Bar (object t)
11         {
12                 return t.GetType ().FullName;
13         }
14 }
15
16 public class Test
17 {
18         static int Main ()
19         {
20                 IFoo<object> foo = new Foo ();
21                 IFoo<string> foo2 = foo;
22
23                 if (foo2.Bar ("blah") != typeof (string).FullName)
24                         return 1;
25
26                 foo2 = new Foo();
27                 if (foo2.Bar ("blah") != typeof (string).FullName)
28                         return 2;
29                 
30
31                 return 0;
32         }
33 }