3 /* Test of constrained.callvirt resolution for contravariant interfaces */
6 public interface I
<in T
>
11 public class C
: I
<object>
13 public string F (object t
)
15 return t
.GetType().Name
;
19 /* U should be instantiated by a valuetype because we don't want the generic
21 public class G
<T
, TI
, U
>
29 public string Do (T t
)
31 // we want to get this in IL:
34 // callvirt I`1<!T>::F(!0)
39 private readonly TI _i
;
44 public static int Main ()
47 // instantiate with: T=string because we want to be
48 // contravariant with object; U=int because we need a valuetype
49 // to not end up in the generic sharing codepath.
50 var h
= new G
<string, C
, int>(c
);
52 var expected
= typeof(string).Name
;
56 Console
.Error
.WriteLine ("Got '{0}', expected '{1}'", s
, expected
);