Author: marek
Date: 2006-10-31 15:12:25 -0500 (Tue, 31 Oct 2006)
New Revision: 67185

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/report.cs
   trunk/mcs/mcs/statement.cs
   trunk/mcs/mcs/typemanager.cs
Log:
2006-10-31  Marek Safar  <[EMAIL PROTECTED]>

        A fix for bug #67689
        statement.cs.cs (CollectionForeach.TryType): Issue a warning when
        GetEnumerator is ambiguous.

        * report.cs: Add new warning.


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2006-10-31 19:05:59 UTC (rev 67184)
+++ trunk/mcs/mcs/ChangeLog     2006-10-31 20:12:25 UTC (rev 67185)
@@ -1,3 +1,11 @@
+2006-10-31  Marek Safar  <[EMAIL PROTECTED]>
+
+       A fix for bug #67689
+       statement.cs.cs (CollectionForeach.TryType): Issue a warning when
+       GetEnumerator is ambiguous.
+
+       * report.cs: Add new warning.
+
 2006-10-29  Marek Safar  <[EMAIL PROTECTED]>
 
        A fix for bug #78602

Modified: trunk/mcs/mcs/report.cs
===================================================================
--- trunk/mcs/mcs/report.cs     2006-10-31 19:05:59 UTC (rev 67184)
+++ trunk/mcs/mcs/report.cs     2006-10-31 20:12:25 UTC (rev 67185)
@@ -75,7 +75,7 @@
                public static readonly int[] AllWarnings = new int[] {
                        28, 67, 78,
                        105, 108, 109, 114, 162, 164, 168, 169, 183, 184, 197,
-                       219, 251, 252, 253, 282,
+                       219, 251, 252, 253, 278, 282,
                        419, 420, 429, 436, 440, 465, 467, 469,
                        612, 618, 626, 628, 642, 649, 652, 658, 659, 660, 661, 
665, 672, 675,
                        1030, 1058,

Modified: trunk/mcs/mcs/statement.cs
===================================================================
--- trunk/mcs/mcs/statement.cs  2006-10-31 19:05:59 UTC (rev 67184)
+++ trunk/mcs/mcs/statement.cs  2006-10-31 20:12:25 UTC (rev 67185)
@@ -4920,6 +4920,12 @@
                                        if (!GetEnumeratorFilter (ec, mi))
                                                continue;
 
+                                       if (result != null) {
+                                               
Report.SymbolRelatedToPreviousError (result);
+                                               
Report.SymbolRelatedToPreviousError (mi);
+                                               Report.Warning (278, 2, loc, 
"`{0}' contains ambiguous implementation of `{1}' pattern. Method `{2}' is 
ambiguous with method `{3}'",
+                                                       TypeManager.CSharpName 
(t), "enumerable", TypeManager.CSharpSignature (result), 
TypeManager.CSharpSignature (mi));
+                                       }
                                        result = mi;
                                        tmp_move_next = move_next;
                                        tmp_get_cur = get_current;

Modified: trunk/mcs/mcs/typemanager.cs
===================================================================
--- trunk/mcs/mcs/typemanager.cs        2006-10-31 19:05:59 UTC (rev 67184)
+++ trunk/mcs/mcs/typemanager.cs        2006-10-31 20:12:25 UTC (rev 67185)
@@ -31,7 +31,7 @@
 
 namespace Mono.CSharp {
 
-public partial class TypeManager {
+public /*partial*/ class TypeManager {
        //
        // A list of core types that the compiler requires or uses
        //
@@ -437,6 +437,11 @@
 
        public static MemberCache LookupMemberCache (Type t)
        {
+#if GMCS_SOURCE && MS_COMPATIBLE
+        if (t.IsGenericType && !t.IsGenericTypeDefinition)
+            t = t.GetGenericTypeDefinition ();
+#endif
+
                if (t is TypeBuilder) {
                        IMemberContainer container = builder_to_declspace [t] 
as IMemberContainer;
                        if (container != null)
@@ -1340,7 +1345,7 @@
                                              MemberFilter filter, object 
criteria)
        {
 #if MS_COMPATIBLE && GMCS_SOURCE
-               if (t.IsGenericType)
+               if (t.IsGenericType && !t.IsGenericTypeDefinition)
                        t = t.GetGenericTypeDefinition ();
 #endif
 
@@ -1430,6 +1435,11 @@
        {
                MemberCache cache;
 
+#if GMCS_SOURCE && MS_COMPATIBLE
+        if (t.IsGenericType && !t.IsGenericTypeDefinition)
+            t = t.GetGenericTypeDefinition();
+#endif
+
                //
                // If this is a dynamic type, it's always in the 
`builder_to_declspace' hash table
                // and we can ask the DeclSpace for the MemberCache.
@@ -1465,7 +1475,7 @@
                // a TypeBuilder array will return a Type, not a TypeBuilder,
                // and we can not call FindMembers on this type.
                //
-               if (t == TypeManager.array_type || t.IsSubclassOf 
(TypeManager.array_type)) {
+               if (t.IsArray) { //  == TypeManager.array_type || 
t.IsSubclassOf (TypeManager.array_type)) {
                        used_cache = true;
                        return TypeHandle.ArrayType.MemberCache.FindMembers (
                                mt, bf, name, FilterWithClosure_delegate, null);
@@ -1552,7 +1562,7 @@
                        return true;
 
 #if MS_COMPATIBLE && GMCS_SOURCE
-               if (t.IsGenericParameter)
+               if (t.IsGenericParameter || t.IsGenericType)
                        return false;
 #endif
                return t.IsEnum;
@@ -2790,6 +2800,10 @@
                BindingFlags bf = BindingFlags.Public | BindingFlags.NonPublic |
                        BindingFlags.Static | BindingFlags.Instance | 
BindingFlags.DeclaredOnly;
 
+#if MS_COMPATIBLE
+        return m;
+#endif
+
                if (m is ConstructorInfo) {
                        foreach (ConstructorInfo c in t.GetConstructors (bf))
                                if (c.MetadataToken == m.MetadataToken)

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

Reply via email to