[Mono-bugs] [Bug 42521][Maj] Changed - mcs 0.24 compile exception relating to foreach loop
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Fri, 9 May 2003 14:22:13 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by bryan@alphora.com.
http://bugzilla.ximian.com/show_bug.cgi?id=42521
--- shadow/42521 Fri May 9 14:10:47 2003
+++ shadow/42521.tmp.12848 Fri May 9 14:22:13 2003
@@ -1,12 +1,12 @@
Bug#: 42521
Product: Mono/MCS
Version: unspecified
OS: unknown
OS Details:
-Status: NEEDINFO
+Status: REOPENED
Resolution:
Severity: Unknown
Priority: Major
Component: Misc
AssignedTo: mono-bugs@ximian.com
ReportedBy: bryan@alphora.com
@@ -103,6 +103,74 @@
sample I tried to make lacked enough bits to be useful.
------- Additional Comments From miguel@ximian.com 2003-05-09 14:10 -------
I am switching to NEEDINFO
+
+------- Additional Comments From bryan@alphora.com 2003-05-09 14:22 -------
+Looks like you can't try to iterate over any interface defined in the
+same source file.
+
+*********************
+The following should compile:
+
+using System.Collections;
+
+ public delegate void ListEventHandler(object ASender, object
+AItem);
+
+ /// <summary> Specifies a list who can notify of item changes
+</summary>
+ public interface INotifyList : IList
+ {
+ event ListEventHandler OnAdding;
+ event ListEventHandler OnRemoving;
+ event ListEventHandler OnValidate;
+ event ListEventHandler OnChanged;
+ }
+
+ /// <remarks>Provides the child interface for a parent/child
+relationship.</remarks>
+ /// <seealso cref="IParent"/>
+ public interface IChild
+ {
+ string Name { get; set; }
+ }
+
+public interface IChildList : INotifyList
+{
+ new IChild this[int AIndex]{ get; set; }
+ IChild this[string AIndex]{ get; set; }
+ int IndexOf(string AName);
+ bool Contains(string AName);
+}
+
+
+class TestForeachCompilerError
+{
+ public void Test(IChildList AChildList)
+ {
+ foreach (object X in AChildList)
+ {
+ }
+ }
+}
+
+
+
+******************
+Here is the simplest case to cause the exception:
+
+public interface IChildList
+{
+}
+
+class TestForeachCompilerError
+{
+ public void Test(IChildList AChildList)
+ {
+ foreach (object X in AChildList)
+ {
+ }
+ }
+}