--- /dev/null
+//
+// Should report an error, as C is defined twice
+//
+
+class X <T> {
+}
+
+class X {
+}
+
+class Body {
+ static void Main ()
+ {
+ }
+}
--- /dev/null
+//
+// 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 () {}
+}
--- /dev/null
+//
+// 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> {
+}
+
--- /dev/null
+//
+// Two type parameters might not have the same name
+//
+class X <A,A> {
+}
-// 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 ()
- {
- }
-}
+}
-// 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);
}
}
-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