[Mono-bugs] [Bug 77167][Wis] New - [GMCS] Generic method type parameter problem across assemblies

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jan 5 17:57:30 EST 2006


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=77167

--- shadow/77167	2006-01-05 17:57:30.000000000 -0500
+++ shadow/77167.tmp.27742	2006-01-05 17:57:30.000000000 -0500
@@ -0,0 +1,68 @@
+Bug#: 77167
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: sestoft at dina.kvl.dk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] Generic method type parameter problem across assemblies
+
+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 Bug20a.cs
+2. Compile  gmcs /r:Bug20a.dll Bug20b.cs
+3. Observe unexpected error message
+
+Actual Results:
+
+Bug20b.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/Bug20a.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 Bug20a.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 Bug20b.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" });
+  }
+}


More information about the mono-bugs mailing list