[Mono-bugs] [Bug 82292][Wis] New - CS0310 not reported : generic types constraints not checked when generic types imbrication

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Aug 2 11:34:09 EDT 2007


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 ericbesombes at gmail.com.

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

--- shadow/82292	2007-08-02 11:34:09.000000000 -0400
+++ shadow/82292.tmp.31473	2007-08-02 11:34:09.000000000 -0400
@@ -0,0 +1,59 @@
+Bug#: 82292
+Product: Mono: Compilers
+Version: 1.2
+OS: unknown
+OS Details: Independant on the OS while this concerns Mcs (IL binary)
+Status: NEW   
+Resolution: 
+Severity: 040 One week
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: ericbesombes at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CS0310 not reported : generic types constraints not checked when generic types imbrication
+
+Mcs does not report error CS0310 when generic types are imbricated whitout 
+respecting type arguments contraints.
+
+Code:
+
+  public class Class1
+    {
+	public Class1 (int i) {}
+    }
+
+  public class Class2 <T>
+    {}
+
+  public class Class3 <T>
+    where T : new()
+    {}
+
+Error CS0310 is reported if we compile the following code:
+
+   public class Class4 : Class3 <Class1>
+    {}
+
+This is normal since Class1 doesn't respect the constraint 'where T :
+new()' of generic class Class3.
+Now, let's compile this:
+
+  public class Class5 : Class2 <Class3 <Class1>>
+    {}
+
+Compilation with Mcs succeeds while error CS0310 should be returned.
+
+In the same way :
+
+  public class Class7 <T> : Class2 <Class3 <T>>
+    {}
+
+Error CS0310 should be reported by Mcs since no constraint is defined for
+'T' in Class7, whereas one constraint is defined for 'T' in Class3.
+
+Note: This bug doesn't depend on the constraint : it can be 'where T :
+new()' or 'where T : class' or any other.


More information about the mono-bugs mailing list