[Mono-bugs] [Bug 75427][Maj] New - Iterators cannot be defined in one accessor only

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jun 30 09:23:50 EDT 2005


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 marek.safar at seznam.cz.

http://bugzilla.ximian.com/show_bug.cgi?id=75427

--- shadow/75427	2005-06-30 09:23:50.000000000 -0400
+++ shadow/75427.tmp.22941	2005-06-30 09:23:50.000000000 -0400
@@ -0,0 +1,97 @@
+Bug#: 75427
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: marek.safar at seznam.cz               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Iterators cannot be defined in one accessor only
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. 
+
+using System;
+using System.Collections;
+
+class X {
+	static IEnumerator GetIt
+	{
+	    get {
+		yield return 1;
+		yield return 2;
+		yield return 3;
+	    }
+	    set
+	    {
+	    }	    
+	}
+	
+	IEnumerable this [int i]
+	{
+	    get {
+		yield return 1*i;
+		yield return 2*i;
+		yield return 3*i;
+	    }
+	    set
+	    {
+	    }
+	}
+
+	static int Main ()
+	{
+		IEnumerator e = GetIt;
+		int total = 0;
+		
+		while (e.MoveNext ()){
+			Console.WriteLine ("Value=" + e.Current);
+			total += (int) e.Current;
+		}
+
+		if (total != 6)
+			return 1;
+
+		total = 0;
+		X x = new X ();
+		foreach (int i in x [2]){
+			Console.WriteLine ("Value=" + i);
+			total += i;
+		}
+		if (total != 12)
+			return 2;
+		
+		return 0;
+	}
+}
+
+
+Actual Results:
+
+error CS1624: The body of `X.GetIt.set' cannot be an iterato
+r block because `void' is not an iterator interface type
+error CS1624: The body of `X.this[int].set' cannot be an ite
+rator block because `void' is not an iterator interface type
+
+
+Expected Results:
+
+No errors
+
+How often does this happen? 
+
+
+Additional Information:


More information about the mono-bugs mailing list