[Mono-bugs] [Bug 75334][Blo] New - [GMCS] refuses to compile generic method invocation from different instantiation of its generic type

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Jun 20 17:38:07 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 nazgul at omega.pl.

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

--- shadow/75334	2005-06-20 17:38:07.000000000 -0400
+++ shadow/75334.tmp.19700	2005-06-20 17:38:07.000000000 -0400
@@ -0,0 +1,82 @@
+Bug#: 75334
+Product: Mono: Compilers
+Version: 1.0
+OS: 
+OS Details: mono svn 20.06.2005
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: nazgul at omega.pl               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] refuses to compile generic method invocation from different instantiation of its generic type
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+This is both a gmcs and runtime bug
+
+Steps to reproduce the problem:
+1. Try to compile code:
+
+class List <t> {
+  public void foo <b> (List <t> x) {
+    System.Console.WriteLine ("{0} - {1}", typeof (t), x.GetType ());
+  }
+}
+
+class C {}
+class D {}
+
+
+class M {
+  static void Main () {
+    List <D> x = new List<D> ();
+    x.foo <C> (x);
+    List <string> y = new List<string> ();
+    y.foo <C> (y);
+  }
+}
+
+
+2. Try to run attached binary
+
+Actual Results:
+t.cs(16) error CS1502: The best overloaded match for method 'List`1[[D, t,
+Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].foo(List`1[[D, t,
+Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]])' has some invalid
+arguments
+t.cs(16) error CS1503: Argument 1: Cannot convert from
+'List`1[[System.String, mscorlib, Version=2.0.3600.0, Culture=neutral,
+PublicKeyToken=b77a5c561934e089]]' to 'List`1[[D, t, Version=0.0.0.0,
+Culture=neutral, PublicKeyToken=null]]'
+t.cs(16) error CS1501: No overload for method `foo' takes `1' arguments
+Compilation failed: 3 error(s), 0 warnings
+
+from gmcs
+and
+
+D - List[D]
+D - List[System.String]
+
+from runtime (when running out.exe compiled by nemerle)
+
+Expected Results:
+D - List`1[D]
+System.String - List`1[System.String]
+
+
+How often does this happen? 
+Always
+
+Additional Information:
+I'm marking it as runtime bug and a blocker, since it is very common code
+pattern in our compiler and it fails with incorrect instanciations applied. 
+The related gmcs bug is probably a different issue and should be given its
+own bugreport, but if you compile it with csc it will give the same problem
+as with nemerle.


More information about the mono-bugs mailing list