Author: marek
Date: 2006-09-24 12:09:21 -0400 (Sun, 24 Sep 2006)
New Revision: 65862

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/class.cs
   trunk/mcs/gmcs/generic.cs
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/decl.cs
   trunk/mcs/mcs/generic.cs
   trunk/mcs/mcs/report.cs
Log:
2006-09-24  Marek Safar  <[EMAIL PROTECTED]>

        * decl.cs (DeclSpace.VerifyClsCompliance): When type has type parameters
        verify them as well.

        * report.cs: New warning.

GMCS:

2006-09-24  Marek Safar  <[EMAIL PROTECTED]>

        * class.cs (MemberBase.VerifyClsCompliance): When method has type
        parameters verify them as well.

        * generic.cs (Constraints.VerifyClsCompliance): Verify CLS-Compliance of
        the type parameter constraints.
        (Generics.VerifyClsCompliance): Ditto.


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2006-09-24 15:44:58 UTC (rev 65861)
+++ trunk/mcs/gmcs/ChangeLog    2006-09-24 16:09:21 UTC (rev 65862)
@@ -1,5 +1,14 @@
 2006-09-24  Marek Safar  <[EMAIL PROTECTED]>
 
+       * class.cs (MemberBase.VerifyClsCompliance): When method has type
+       parameters verify them as well.
+
+       * generic.cs (Constraints.VerifyClsCompliance): Verify CLS-Compliance of
+       the type parameter constraints.
+       (Generics.VerifyClsCompliance): Ditto.
+
+2006-09-24  Marek Safar  <[EMAIL PROTECTED]>
+
        * anonymous.cs (AnonymousMethod.Compatible): Cannot generate arguments
        for anonymous block with out argument.
 

Modified: trunk/mcs/gmcs/class.cs
===================================================================
--- trunk/mcs/gmcs/class.cs     2006-09-24 15:44:58 UTC (rev 65861)
+++ trunk/mcs/gmcs/class.cs     2006-09-24 16:09:21 UTC (rev 65862)
@@ -5335,6 +5335,9 @@
                protected override bool VerifyClsCompliance()
                {
                        if (base.VerifyClsCompliance ()) {
+                               if (GenericMethod != null)
+                                       GenericMethod.VerifyClsCompliance ();
+
                                return true;
                        }
 
@@ -6802,7 +6805,6 @@
                
                public void SetUsed ()
                {
-                       Console.WriteLine (this.Name + " assigned");
                        if (my_event != null) {
                                my_event.SetAssigned ();
                                my_event.SetMemberIsUsed ();

Modified: trunk/mcs/gmcs/generic.cs
===================================================================
--- trunk/mcs/gmcs/generic.cs   2006-09-24 15:44:58 UTC (rev 65861)
+++ trunk/mcs/gmcs/generic.cs   2006-09-24 16:09:21 UTC (rev 65862)
@@ -562,6 +562,27 @@
 
                        return true;
                }
+
+               public void VerifyClsCompliance ()
+               {
+                       if (class_constraint_type != null && 
!AttributeTester.IsClsCompliant (class_constraint_type))
+                               Warning_ConstrainIsNotClsCompliant 
(class_constraint_type, class_constraint.Location);
+
+                       if (iface_constraint_types != null) {
+                               for (int i = 0; i < 
iface_constraint_types.Length; ++i) {
+                                       if (!AttributeTester.IsClsCompliant 
(iface_constraint_types [i]))
+                                               
Warning_ConstrainIsNotClsCompliant (iface_constraint_types [i],
+                                                       
((TypeExpr)iface_constraints [i]).Location);
+                               }
+                       }
+               }
+
+               void Warning_ConstrainIsNotClsCompliant (Type t, Location loc)
+               {
+                       Report.SymbolRelatedToPreviousError (t);
+                       Report.Warning (3024, 1, loc, "Constraint type `{0}' is 
not CLS-compliant",
+                               TypeManager.CSharpName (t));
+               }
        }
 
        /// <summary>
@@ -1896,6 +1917,16 @@
                public override string DocCommentHeader {
                        get { return "M:"; }
                }
+
+               public new void VerifyClsCompliance ()
+               {
+                       foreach (TypeParameter tp in TypeParameters) {
+                               if (tp.Constraints == null)
+                                       continue;
+
+                               tp.Constraints.VerifyClsCompliance ();
+                       }
+               }
        }
 
        public class DefaultValueExpression : Expression

Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2006-09-24 15:44:58 UTC (rev 65861)
+++ trunk/mcs/mcs/ChangeLog     2006-09-24 16:09:21 UTC (rev 65862)
@@ -1,5 +1,12 @@
 2006-09-24  Marek Safar  <[EMAIL PROTECTED]>
 
+       * decl.cs (DeclSpace.VerifyClsCompliance): When type has type parameters
+       verify them as well.
+
+       * report.cs: New warning.
+
+2006-09-24  Marek Safar  <[EMAIL PROTECTED]>
+
        * anonymous.cs (AnonymousMethod.Compatible): Cannot generate arguments
        for anonymous block with out argument.
 

Modified: trunk/mcs/mcs/decl.cs
===================================================================
--- trunk/mcs/mcs/decl.cs       2006-09-24 15:44:58 UTC (rev 65861)
+++ trunk/mcs/mcs/decl.cs       2006-09-24 16:09:21 UTC (rev 65862)
@@ -1295,6 +1295,15 @@
                                return false;
                        }
 
+                       if (type_params != null) {
+                               foreach (TypeParameter tp in type_params) {
+                                       if (tp.Constraints == null)
+                                               continue;
+
+                                       tp.Constraints.VerifyClsCompliance ();
+                               }
+                       }
+
                        IDictionary cache = TypeManager.AllClsTopLevelTypes;
                        string lcase = Name.ToLower 
(System.Globalization.CultureInfo.InvariantCulture);
                        if (!cache.Contains (lcase)) {

Modified: trunk/mcs/mcs/generic.cs
===================================================================
--- trunk/mcs/mcs/generic.cs    2006-09-24 15:44:58 UTC (rev 65861)
+++ trunk/mcs/mcs/generic.cs    2006-09-24 16:09:21 UTC (rev 65862)
@@ -29,6 +29,8 @@
                public abstract Location Location {
                        get;
                }
+
+               public abstract void VerifyClsCompliance ();
        }
 
        public class TypeParameter : MemberCore, IMemberContainer
@@ -70,6 +72,12 @@
                        }
                }
 
+               public Constraints Constraints {
+                       get {
+                               return null;
+                       }
+               }
+
                public override string DocCommentHeader {
                        get { throw new NotImplementedException (); }
                }

Modified: trunk/mcs/mcs/report.cs
===================================================================
--- trunk/mcs/mcs/report.cs     2006-09-24 15:44:58 UTC (rev 65861)
+++ trunk/mcs/mcs/report.cs     2006-09-24 16:09:21 UTC (rev 65862)
@@ -86,7 +86,7 @@
                        2002, 2023,
                        3005, 3012, 3019, 3021, 3022, 3023, 3026, 3027,
 #if GMCS_SOURCE
-                       402, 414, 693, 1700
+                       402, 414, 693, 1700, 3024
 #endif
                };
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to