Parameters.VerifyClsCompliance ();
if (!AttributeTester.IsClsCompliant (ReturnType.Type)) {
- Report.Error (3002, Location, "Return type of `{0}' is not CLS-compliant", GetSignatureForError ());
+ Report.Warning (3002, 1, Location, "Return type of `{0}' is not CLS-compliant",
+ GetSignatureForError ());
}
return true;
}
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);
}
/// Returns the method itself if okay and null if not.
/// </summary>
public static MethodBase VerifyMethod (Type container_type, Type delegate_type,
- MethodGroupExpr old_mg, MethodBase mb,
- Location loc)
+ MethodGroupExpr old_mg, MethodBase mb)
{
MethodInfo invoke_mb = GetInvokeMethod (container_type, delegate_type);
if (invoke_mb == null)
return null;
delegate_method = (MethodInfo) method_group;
+ Invocation.IsSpecialMethodInvocation (delegate_method, loc);
+
ExtensionMethodGroupExpr emg = method_group as ExtensionMethodGroupExpr;
if (emg != null) {
delegate_instance_expression = emg.ExtensionExpression;
return null;
foreach (MethodInfo mi in mg.Methods){
- MethodBase mb = Delegate.VerifyMethod (mg.DeclaringType, target_type, mg, mi, Location.Null);
+ MethodBase mb = Delegate.VerifyMethod (mg.DeclaringType, target_type, mg, mi);
if (mb != null)
return mb;
}
return null;
}
+ public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+ {
+ if (delegate_instance_expression != null)
+ delegate_instance_expression.MutateHoistedGenericType (storey);
+
+ delegate_method = storey.MutateGenericMethod (delegate_method);
+ constructor_method = storey.MutateConstructor (constructor_method);
+ }
+
#region IErrorHandler Members
public bool NoExactMatch (EmitContext ec, MethodBase method)
TypeManager.GetFullNameSignature (delegate_method));
}
- if (Invocation.IsMethodExcluded (delegate_method)) {
+ if (Invocation.IsMethodExcluded (delegate_method, loc)) {
Report.SymbolRelatedToPreviousError (delegate_method);
Report.Error (1618, loc, "Cannot create delegate with `{0}' because it has a Conditional attribute",
TypeManager.CSharpSignature (delegate_method));