[Mono-bugs] [Bug 78497][Min] New - using generic with wrong number of types should produce CS0305

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue May 23 18:09:50 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 scottell.lists at gmail.com.


--- shadow/78497	2006-05-23 18:09:50.000000000 -0400
+++ shadow/78497.tmp.23994	2006-05-23 18:09:50.000000000 -0400
@@ -0,0 +1,52 @@
+Bug#: 78497
+Product: Mono: Class Libraries
+Version: 1.1
+OS Details: 
+Status: NEW   
+Priority: Minor
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: scottell.lists at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: using generic with wrong number of types should produce CS0305
+Here is some sample code in which a generic class is referred to with the
+wrong number of types:
+public class MyList<T> {}
+public class MyClass<T> {}
+class MyClass
+   public static void Main()
+   {
+      MyList<MyClass, MyClass> list1 = new MyList<MyClass>();   // CS0305
+      MyList<MyClass> list2 = new MyList<MyClass>();   // OK
+   }
+Running this on MS.NET 2.0 produces:
+C:\Documents and Settings\Scott Ellington\Desktop>csc cs0305.cs
+Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
+for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
+Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
+cs0305.cs(9,7): error CS0305: Using the generic type 'MyList<T>' requires '1'
+        type arguments
+cs0305.cs(2,14): (Location of symbol related to previous error)
+Running on Mono ( ) produces:
+$ gmcs cs0305.cs
+cs0305.cs(9,7): error CS0246: The type or namespace name `MyList`2' could
+not be found. Are you missing a using directive or an assembly reference?
+Compilation failed: 1 error(s), 0 warnings
+I think Mono should give an CS0305 error.

More information about the mono-bugs mailing list