2008-08-08 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / mcs / delegate.cs
index d5a4ad79f041fd550d8343bfb615faa8b12fda59..e0065e2dd7cb548de7776aa8168e08827799693a 100644 (file)
@@ -447,18 +447,22 @@ namespace Mono.CSharp {
                        return (MethodInfo) mg.Methods[0];
                }
 
+               //
+               // 15.2 Delegate compatibility
+               //
                public static bool IsTypeCovariant (Expression a, Type b)
                {
-                       Type a_type = a.Type;
-                       if (a_type == b)
+                       //
+                       // For each value parameter (a parameter with no ref or out modifier), an 
+                       // identity conversion or implicit reference conversion exists from the
+                       // parameter type in D to the corresponding parameter type in M
+                       //
+                       if (a.Type == b)
                                return true;
 
                        if (RootContext.Version == LanguageVersion.ISO_1)
                                return false;
 
-                       if (!TypeManager.IsReferenceType (a_type))
-                               return false;
-
                        return Convert.ImplicitReferenceConversionExists (a, b);
                }