[Mono-bugs] [Bug 77042][Maj] New - type parameter constraint on generic iterator method

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Dec 20 04:41:48 EST 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 sestoft at dina.kvl.dk.

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

--- shadow/77042	2005-12-20 04:41:48.000000000 -0500
+++ shadow/77042.tmp.30816	2005-12-20 04:41:48.000000000 -0500
@@ -0,0 +1,57 @@
+Bug#: 77042
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: sestoft at dina.kvl.dk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: type parameter constraint on generic iterator method
+
+Description of Problem:
+
+The constraint on a type parameter T of a generic iterator (yield) method
+seems to be forgotten, or only partially taken into account, in the class
+generated by gmcs for the iterator method.
+
+Steps to reproduce the problem:
+1. Compile the program below
+
+Actual Results:
+
+sestoft at jones:~/cs$ gmcs Bug17.cs
+Bug17.cs(14,17): error CS1502: The best overloaded method match for
+`IComparable<T>.CompareTo<>(T)' has some invalid arguments
+Bug17.cs(14,17): error CS1503: Argument 1: Cannot convert from `T' to `T'
+Compilation failed: 2 error(s), 0 warnings
+
+Expected Results:
+
+Compiles OK.
+
+
+Additional Information:
+
+Test case:
+
+using System;
+using System.Collections.Generic;
+
+public class H {
+  public static void Main(String[] args) { }
+
+  public static IEnumerable<T> Merge<T>(IEnumerator<T> xEtor) 
+    where T : IComparable<T>
+  {
+    int order = xEtor.Current.CompareTo(xEtor.Current);
+    yield return xEtor.Current;
+  }
+}


More information about the mono-bugs mailing list