1 // Compiler options: -langversion:future
5 interface IContravariant<in T>
9 interface ICovariant<out T>
15 public static bool Contra<T> (IContravariant<T> e1, IContravariant<T> e2)
17 Console.WriteLine (typeof (T));
18 return typeof (T) == typeof (string);
21 public static bool Covariant<T> (ICovariant<T> e1, ICovariant<T> e2)
23 Console.WriteLine (typeof (T));
24 return typeof (T) == typeof (object);
27 public static int Main ()
29 ICovariant<object> a = null;
30 ICovariant<string> b = null;
31 if (!Covariant (a, b))
34 IContravariant<string> a_1 = null;
35 IContravariant<object> b_1 = null;
36 if (!Contra (a_1, b_1))