[Mono-bugs] [Bug 78380][Wis] New - Mutually recursive Generics with inheritance

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri May 12 12:29:32 EDT 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 karl at waclawek.net.

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

--- shadow/78380	2006-05-12 12:29:32.000000000 -0400
+++ shadow/78380.tmp.25094	2006-05-12 12:29:32.000000000 -0400
@@ -0,0 +1,91 @@
+Bug#: 78380
+Product: Mono: Compilers
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: Fedora Core 4
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: karl at waclawek.net               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mutually recursive Generics with inheritance
+
+Description of Problem:
+
+I have a source file with mutually recursive generics that compiles under
+MS csc (.NET 2.0, VS 2005), but not under gmcs (Mono 1.1.15 Beta 2).
+Below is a simplified version of this file:
+
+=== begin source file test.cs === 
+using System;
+
+namespace Test
+{
+  public class ThisBaseClass<A, B, C> 
+    where A: ThisBaseClass<A, B, C>
+    where B: ThatBaseClass<B, A, C>, new()
+    where C: class
+  {
+
+  }
+
+  public class ThatBaseClass<B, A, C>
+    where B: ThatBaseClass<B, A, C>, new()
+    where A: ThisBaseClass<A, B, C>
+    where C: class
+  {
+    public ThatBaseClass() {}
+  }
+
+  public class ThisClass<A, B, C>: ThisBaseClass<A, B, C>
+    where A: ThisClass<A, B, C>
+    where B: ThatClass<B, A, C>, new()
+    where C: class
+  {
+
+  }
+
+  public class ThatClass<B, A, C>: ThatBaseClass<B, A, C>
+    where B: ThatClass<B, A, C>, new()
+    where A: ThisClass<A, B, C>
+    where C: class
+  {
+
+  }
+
+  public class ThisClass: ThisClass<ThisClass, ThatClass, object>
+  {
+
+  }
+
+  public class ThatClass: ThatClass<ThatClass, ThisClass, object>
+  {
+    public ThatClass() {}
+  }
+
+}
+
+=== end source file ===
+
+The error message generated by gmcs is:
+
+[kwaclaw at newdev SAXExpat]$ gmcs /t:library test.cs
+test.cs(42,27): error CS0309: The type `Test.ThatClass' must be convertible
+to `Test.ThatClass<Test.ThatClass,Test.ThisClass,object>' in order to use
+it as parameter `B' in the generic type or method `Test.ThatClass<B,A,C>'
+test.cs(29,16):: `Test.ThatClass<B,A,C>', name of symbol related to
+previous error
+test.cs(42,16):: `Test.ThatClass', name of symbol related to previous error
+test.cs(37,27): error CS0309: The type `Test.ThisClass' must be convertible
+to `Test.ThisClass<Test.ThisClass,Test.ThatClass,object>' in order to use
+it as parameter `A' in the generic type or method `Test.ThisClass<A,B,C>'
+test.cs(21,16):: `Test.ThisClass<A,B,C>', name of symbol related to
+previous error
+test.cs(37,16):: `Test.ThisClass', name of symbol related to previous error
+Compilation failed: 2 error(s), 0 warnings


More information about the mono-bugs mailing list