Bug 319967 (MONO77167) - [GMCS] Generic method type parameter problem across assemblies
Summary: [GMCS] Generic method type parameter problem across assemblies
Status: RESOLVED FIXED
Alias: MONO77167
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-06 00:57 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:43:36 UTC


---- Reported by sestoft@dina.kvl.dk 2006-01-05 17:57:29 MST ----

Description of Problem:

When compiling the program below in one source file, it compiles fine with
gmcs 1.1.12.1 as it should.  When compiling MyList<T> as a library, the
compilation of MyTest fails.

Steps to reproduce the problem:
1. Compile gmcs /t:library https://bugzilla.novell.com/show_bug.cgi?id=MONO20a.cs
2. Compile  gmcs /r:https://bugzilla.novell.com/show_bug.cgi?id=MONO20a.dll https://bugzilla.novell.com/show_bug.cgi?id=MONO20b.cs
3. Observe unexpected error message

Actual Results:

https://bugzilla.novell.com/show_bug.cgi?id=MONO20b.cs(8,5): error CS0309: The type `string' must be convertible to `T'
inorder to use it as parameter `U' in the generic type or method
`MyList<string>.AddAll<U>(IEnumerable<U>)'
/home/sestoft/cs/https://bugzilla.novell.com/show_bug.cgi?id=MONO20a.dll: `MyList<string>.AddAll<U>(IEnumerable<U>)',
nameof symbol related to previous error
/usr/local/mono-1.1.12.1/lib/mono/2.0/mscorlib.dll: `string', name of
symbol related to previous error
Compilation failed: 1 error(s), 0 warnings


Expected Results:

No compiler error.  Works with csc 2.0.


Additional Information:

// Program https://bugzilla.novell.com/show_bug.cgi?id=MONO20a.cs:
using System.Collections.Generic;

public class MyList<T> : List<T> { 
  public void AddAll<U>(IEnumerable<U> xs) where U : T {
    foreach (T x in xs) 
      Add(x);
  }
}

// Program https://bugzilla.novell.com/show_bug.cgi?id=MONO20b.ca:
using System;

class GettingStarted {
  public static void Main(String[] args) {
    MyList<String> names = new MyList<String>();
    names.AddAll<String>(new String[] { "Hoover", "Roosevelt", 
					"Truman", "Eisenhower", "Kennedy" });
  }
}



---- Additional Comments From martin@ximian.com 2006-01-15 21:09:27 MST ----

Fixed in SVN.


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