}
if (bound.Kind == BoundKind.Exact || cbound.Kind == BoundKind.Exact) {
- if (cbound.Kind != BoundKind.Exact) {
+ if (cbound.Kind == BoundKind.Lower) {
if (!Convert.ImplicitConversionExists (ec, new TypeExpression (cbound.Type, Location.Null), bound.Type)) {
break;
}
continue;
}
+ if (cbound.Kind == BoundKind.Upper) {
+ if (!Convert.ImplicitConversionExists (ec, new TypeExpression (bound.Type, Location.Null), cbound.Type)) {
+ break;
+ }
+
+ continue;
+ }
if (bound.Kind != BoundKind.Exact) {
if (!Convert.ImplicitConversionExists (ec, new TypeExpression (bound.Type, Location.Null), cbound.Type)) {
}
if (bound.Kind == BoundKind.Lower) {
- if (!Convert.ImplicitConversionExists (ec, new TypeExpression (cbound.Type, Location.Null), bound.Type)) {
- break;
+ if (cbound.Kind == BoundKind.Lower) {
+ if (!Convert.ImplicitConversionExists (ec, new TypeExpression (cbound.Type, Location.Null), bound.Type)) {
+ break;
+ }
+ } else {
+ if (!Convert.ImplicitConversionExists (ec, new TypeExpression (bound.Type, Location.Null), cbound.Type)) {
+ break;
+ }
}
- } else {
+
+ continue;
+ }
+
+ if (bound.Kind == BoundKind.Upper) {
if (!Convert.ImplicitConversionExists (ec, new TypeExpression (bound.Type, Location.Null), cbound.Type)) {
break;
}
+ } else {
+ throw new NotImplementedException ("variance conversion");
}
}
--- /dev/null
+using System;
+
+public class C
+{
+ delegate void D<in T> (T t);
+
+ static void M<T> (ref T t, D<T> a)
+ {
+ a (t);
+ }
+
+ static void M2<T> (T t, D<T> a)
+ {
+ a (t);
+ }
+
+ static void MethodArg (object o)
+ {
+ }
+
+ public static int Main ()
+ {
+ D<object> action = l => Console.WriteLine (l);
+ string s = "value";
+
+ M (ref s, action);
+ M2 (s, action);
+ return 0;
+ }
+}