Author: martin
Date: 2007-04-03 13:27:04 -0400 (Tue, 03 Apr 2007)
New Revision: 75351
Added:
trunk/mcs/tests/gtest-326-lib.cs
trunk/mcs/tests/gtest-326.cs
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/statement.cs
Log:
2007-04-03 Martin Baulig <[EMAIL PROTECTED]>
Fix #80632.
* statement.cs (Foreach.CollectionForeach.TryType): Use a custom
version of TypeManager.IsOverride() which also works with generic
types.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2007-04-03 17:23:07 UTC (rev 75350)
+++ trunk/mcs/mcs/ChangeLog 2007-04-03 17:27:04 UTC (rev 75351)
@@ -1,5 +1,13 @@
2007-04-03 Martin Baulig <[EMAIL PROTECTED]>
+ Fix #80632.
+
+ * statement.cs (Foreach.CollectionForeach.TryType): Use a custom
+ version of TypeManager.IsOverride() which also works with generic
+ types.
+
+2007-04-03 Martin Baulig <[EMAIL PROTECTED]>
+
Fix #81044.
* convert.cs
Modified: trunk/mcs/mcs/statement.cs
===================================================================
--- trunk/mcs/mcs/statement.cs 2007-04-03 17:23:07 UTC (rev 75350)
+++ trunk/mcs/mcs/statement.cs 2007-04-03 17:27:04 UTC (rev 75351)
@@ -5191,6 +5191,19 @@
TypeManager.CSharpName (expr.Type));
}
+ bool IsOverride (MethodInfo m)
+ {
+ m = (MethodInfo)
TypeManager.DropGenericMethodArguments (m);
+
+ if (!m.IsVirtual || ((m.Attributes &
MethodAttributes.NewSlot) != 0))
+ return false;
+ if (m is MethodBuilder)
+ return true;
+
+ MethodInfo base_method = m.GetBaseDefinition ();
+ return base_method != m;
+ }
+
bool TryType (EmitContext ec, Type t)
{
MethodGroupExpr mg = Expression.MemberLookup (
@@ -5211,7 +5224,7 @@
if ((mi.Attributes &
MethodAttributes.Public) != MethodAttributes.Public)
continue;
- if (TypeManager.IsOverride (mi))
+ if (IsOverride (mi))
continue;
enumerator_found = true;
Added: trunk/mcs/tests/gtest-326-lib.cs
===================================================================
--- trunk/mcs/tests/gtest-326-lib.cs 2007-04-03 17:23:07 UTC (rev 75350)
+++ trunk/mcs/tests/gtest-326-lib.cs 2007-04-03 17:27:04 UTC (rev 75351)
@@ -0,0 +1,32 @@
+// Compiler options: /t:library
+using System;
+using SCG = System.Collections.Generic;
+
+namespace C5
+{
+ public abstract class EnumerableBase<T> : SCG.IEnumerable<T>
+ {
+ public abstract SCG.IEnumerator<T> GetEnumerator ();
+
+ System.Collections.IEnumerator
System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
+
+ public class ArrayBase<T> : EnumerableBase<T>
+ {
+ public override SCG.IEnumerator<T> GetEnumerator ()
+ {
+ yield break;
+ }
+ }
+
+ public class ArrayList<T> : ArrayBase<T>
+ {
+ public override SCG.IEnumerator<T> GetEnumerator ()
+ {
+ return base.GetEnumerator ();
+ }
+ }
+}
Property changes on: trunk/mcs/tests/gtest-326-lib.cs
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/mcs/tests/gtest-326.cs
===================================================================
--- trunk/mcs/tests/gtest-326.cs 2007-04-03 17:23:07 UTC (rev 75350)
+++ trunk/mcs/tests/gtest-326.cs 2007-04-03 17:27:04 UTC (rev 75351)
@@ -0,0 +1,15 @@
+// Compiler options: /r:gtest-326-lib.dll
+using System;
+
+public class A : C5.ArrayList<int>
+{ }
+
+class X
+{
+ static void Main ()
+ {
+ A x = new A ();
+ foreach (int i in x) {
+ }
+ }
+}
Property changes on: trunk/mcs/tests/gtest-326.cs
___________________________________________________________________
Name: svn:executable
+ *
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches