Bug 319849 (MONO77042) - [GMCS] type parameter constraint on generic iterator method
Summary: [GMCS] type parameter constraint on generic iterator method
Status: RESOLVED FIXED
Alias: MONO77042
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Major
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-20 11:41 UTC by Peter Sestoft
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:41:50 UTC


---- Reported by sestoft@dina.kvl.dk 2005-12-20 04:41:48 MST ----

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@jones:~/cs$ gmcs https://bugzilla.novell.com/show_bug.cgi?id=MONO17.cs
https://bugzilla.novell.com/show_bug.cgi?id=MONO17.cs(14,17): error CS1502: The best overloaded method match for
`IComparable<T>.CompareTo<>(T)' has some invalid arguments
https://bugzilla.novell.com/show_bug.cgi?id=MONO17.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;
  }
}



---- Additional Comments From martin@ximian.com 2006-01-09 05:48:08 MST ----

Post-GUAM bug-fixing pass; week #2/2006.



---- Additional Comments From martin@ximian.com 2006-01-10 14:10:19 MST ----

*** https://bugzilla.novell.com/show_bug.cgi?id=MONO77158 has been marked as a duplicate of this bug. ***



---- Additional Comments From martin@ximian.com 2006-01-10 14:12:52 MST ----

Fixed in SVN; r55312.


Unknown operating system unknown. Setting to default OS "Other".