2004-01-19 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / gmcs / class.cs
old mode 100755 (executable)
new mode 100644 (file)
index f7d37d8..e9b82d9
@@ -2,7 +2,7 @@
 // class.cs: Class and Struct handlers
 //
 // Authors: Miguel de Icaza (miguel@gnu.org)
-//          Martin Baulig (martin@gnome.org)
+//          Martin Baulig (martin@ximian.com)
 //          Marek Safar (marek.safar@seznam.cz)
 //
 // Licensed under the terms of the GNU GPL
@@ -1145,7 +1145,8 @@ namespace Mono.CSharp {
                                        if (iface == t)
                                                continue;
 
-                                       if (!TypeManager.MayBecomeEqualGenericInstances (iface, t))
+                                       Type[] infered = new Type [CountTypeParameters];
+                                       if (!TypeManager.MayBecomeEqualGenericInstances (iface, t, infered, null))
                                                continue;
 
                                        Report.Error (
@@ -2414,6 +2415,12 @@ namespace Mono.CSharp {
 
                        VerifyClsName ();
 
+                       if (IsGeneric) {
+                               Report.Error (3024, Location, "'{0}': type parameters are not CLS-compliant",
+                                             GetSignatureForError ());
+                               return false;
+                       }
+
                        Type base_type = TypeBuilder.BaseType;
                        if (base_type != null && !AttributeTester.IsClsCompliant (base_type)) {
                                Report.Error (3009, Location, "'{0}': base type '{1}' is not CLS-compliant", GetSignatureForError (), TypeManager.CSharpName (base_type));
@@ -3486,7 +3493,12 @@ namespace Mono.CSharp {
                        }
 
                        if (!AttributeTester.IsClsCompliant (MemberType)) {
-                               Report.Error (3002, Location, "Return type of '{0}' is not CLS-compliant", GetSignatureForError ());
+                               if ((this is Property) || (this is Indexer))
+                                       Report.Error (3003, Location, "Type of `{0}' is not CLS-compliant",
+                                                     GetSignatureForError ());
+                               else
+                                       Report.Error (3002, Location, "Return type of '{0}' is not CLS-compliant",
+                                                     GetSignatureForError ());
                        }
 
                        AttributeTester.AreParametersCompliant (Parameters.FixedParameters, Location);
@@ -3518,7 +3530,7 @@ namespace Mono.CSharp {
                        else
                                method_infered = null;
 
-                       return Invocation.InferTypeArguments (
+                       return TypeManager.MayBecomeEqualGenericInstances (
                                first.ParameterTypes, second.ParameterTypes, class_infered, method_infered);
                }
 
@@ -3546,7 +3558,7 @@ namespace Mono.CSharp {
                        // TODO: make operator compatible with MethodCore to avoid this
                        if (this is Operator && method is Operator) {
                                if (MemberType != method.MemberType)
-                                       equal = false;
+                                       equal = may_unify = false;
                        }
 
                        if (equal) {