dlr bug
[mcs.git] / tests / gtest-variance-1.cs
blob04fac5216fd4c563a926fcf0b9d13f9d29ef9439
1 // Compiler options: -langversion:future
3 interface IFoo<out T>
5 T Bar { get; }
8 class Foo : IFoo<string>
10 readonly string bar;
11 public Foo (string bar)
13 this.bar = bar;
15 public string Bar { get { return bar; } }
18 public class Test
20 static int Main ()
22 string bar = "Who is John Galt?";
23 IFoo<string> foo = new Foo(bar);
24 IFoo<object> foo2 = foo;
25 if (!foo2.Bar.Equals (bar))
26 return 1;
28 foo2 = new Foo(bar);
29 if (foo2.Bar != bar)
30 return 2;
32 return 0;