Archive these files from my generics tree
authorMiguel de Icaza <miguel@gnome.org>
Tue, 22 Apr 2003 21:30:45 +0000 (21:30 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 22 Apr 2003 21:30:45 +0000 (21:30 -0000)
svn path=/trunk/mcs/; revision=13905

mcs/errors/cs8201.cs [new file with mode: 0644]
mcs/errors/cs8202.cs [new file with mode: 0644]
mcs/errors/cs8203.cs [new file with mode: 0644]
mcs/errors/cs8204.cs [new file with mode: 0644]
mcs/errors/cs8205.cs
mcs/errors/cs8206.cs
mcs/errors/errors.txt

diff --git a/mcs/errors/cs8201.cs b/mcs/errors/cs8201.cs
new file mode 100644 (file)
index 0000000..ce204a3
--- /dev/null
@@ -0,0 +1,15 @@
+// 
+// Should report an error, as C is defined twice
+//
+
+class X <T> {
+}
+
+class X {
+}
+
+class Body {
+       static void Main ()
+       {
+       }
+}
diff --git a/mcs/errors/cs8202.cs b/mcs/errors/cs8202.cs
new file mode 100644 (file)
index 0000000..c4afd39
--- /dev/null
@@ -0,0 +1,18 @@
+//
+// The type parameters introduce the names into the class namespace, so it is
+// not possible to have members with the same name as a parameter
+//
+
+// First error.
+class X <T> {
+       int T;
+}
+
+// Second error: type parameter is the same name as the class
+
+class Y <Y> {
+}
+
+class W {
+       static void Main () {}
+}
diff --git a/mcs/errors/cs8203.cs b/mcs/errors/cs8203.cs
new file mode 100644 (file)
index 0000000..b113719
--- /dev/null
@@ -0,0 +1,11 @@
+//
+// The type parameters introduce the names into the class namespace, so it is
+// not possible to have members with the same name as a parameter
+//
+
+
+// type parameter is the same name as the class
+
+class Y <Y> {
+}
+
diff --git a/mcs/errors/cs8204.cs b/mcs/errors/cs8204.cs
new file mode 100644 (file)
index 0000000..1dd56c7
--- /dev/null
@@ -0,0 +1,5 @@
+// 
+// Two type parameters might not have the same name
+//
+class X <A,A> {
+}
index 47aa0ee17c1298499b9dc9bcc750e8eab8441088..d1fba3017cc2535bbfd41a13411ee2b77dfa4198 100644 (file)
@@ -1,14 +1,8 @@
-// cs8205.cs: A method that contains a yield statement does have an incorrect return type
-// Line: 
-using System;
-using System.Collections;
-class X {
-       int Iterator ()
+//
+// This should report: the class containing main can not be generic
+//
+class X<Y> {
+       static void Main  ()
        {
-               yield 1;
        }
-
-       static void Main ()
-       {
-       }
-}      
+}
index c4b9155ecb1f4e981e422e01f8c1791a66afe497..6cb2f9c80098909f72d70e9b6337e075d275c808 100644 (file)
@@ -1,17 +1,13 @@
-// cs8206.cs: Return not allowed in iterator method
-// Line:
-using System.Collections;
+//
+// Generic type parameters
+//
+class X <Y> {
+}
 
-class X {
-       IEnumerator MyEnumerator (int a)
-       {
-               if (a == 0)
-                       yield 1;
-               else
-                       return 2;
-       }
+unsafe class A {
 
        static void Main ()
        {
+               int size = sizeof (X);
        }
 }
index d9a7a74f5b36a1892de569fa42be4e0ce7dba1e1..12bf0433193e29e245faaf4581595dc6221bc22e 100755 (executable)
@@ -94,3 +94,13 @@ the Microsoft C# compiler:
 
 -204   yield statement in something which is not a method-body,
        accessor-body or operator-body
+
+-205    A method containing a yield statement is not IEnumerator.
+
+-206    Return statement not allowed inside iterators.
+
+-207    A parameter in an enumerator method contains out or ref
+
+-208    Yield statement appears inside finally clause
+
+-209    Yield statment appears in anonymous method.
\ No newline at end of file