+++ /dev/null
----// Compiler options: -langversion:default
----
----using System;
----using System.Collections;
----
----class X {
---- static IEnumerator GetIt ()
---- {
---- yield return 1;
---- yield return 2;
---- yield return 3;
---- }
----
---- static IEnumerable GetIt2 ()
---- {
---- yield return 1;
---- yield return 2;
---- yield return 3;
---- }
----
---- static int Main ()
---- {
---- IEnumerator e = GetIt ();
---- int total = 0;
----
---- while (e.MoveNext ()){
---- Console.WriteLine ("Value=" + e.Current);
---- total += (int) e.Current;
---- }
----
---- if (total != 6)
---- return 1;
----
---- total = 0;
---- foreach (int i in GetIt2 ()){
---- Console.WriteLine ("Value=" + i);
---- total += i;
---- }
---- if (total != 6)
---- return 2;
----
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----namespace Foo
----{
---- public class Hello
---- {
---- public static int World = 8;
---- }
----}
----
----namespace Bar
----{
---- public class Hello
---- {
---- public static int World = 9;
---- }
----}
----
----namespace X
----{
---- using Foo;
----
---- public partial class Test
---- {
---- public static int FooWorld ()
---- {
---- return Hello.World;
---- }
---- }
----}
----
----namespace X
----{
---- using Bar;
----
---- public partial class Test
---- {
---- public static int BarWorld ()
---- {
---- return Hello.World;
---- }
---- }
----}
----
----class Y
----{
---- static int Main ()
---- {
---- if (X.Test.FooWorld () != 8)
---- return 1;
---- if (X.Test.BarWorld () != 9)
---- return 2;
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----namespace Test1
----{
---- public class Base
---- { }
----
---- public partial class Foo : Base
---- { }
----
---- public partial class Foo : Base
---- { }
----}
----
----namespace Test2
----{
---- public interface Base
---- { }
----
---- public partial class Foo : Base
---- { }
----
---- public partial class Foo : Base
---- { }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----public partial class Test
----{
---- public readonly Foo TheFoo;
----
---- public Test ()
---- {
---- this.TheFoo = new Foo ();
---- }
----
---- public partial interface IFoo
---- {
---- int Hello (Test foo);
---- }
----
---- public int TestFoo ()
---- {
---- return TheFoo.Hello (this);
---- }
----}
----
----public partial class Test
----{
---- public partial class Foo : IFoo
---- {
---- int IFoo.Hello (Test test)
---- {
---- return 2;
---- }
----
---- public int Hello (Test test)
---- {
---- return 1;
---- }
---- }
----
---- public int TestIFoo (IFoo foo)
---- {
---- return foo.Hello (this);
---- }
----}
----
----class X
----{
---- static int Main ()
---- {
---- Test test = new Test ();
---- if (test.TestFoo () != 1)
---- return 1;
---- if (test.TestIFoo (test.TheFoo) != 2)
---- return 2;
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----namespace A
----{
---- interface IFoo
---- {
---- void Hello (IFoo foo);
---- }
----}
----
----namespace B
----{
---- partial class Test
---- { }
----}
----
----namespace B
----{
---- using A;
----
---- partial class Test : IFoo
---- {
---- void IFoo.Hello (IFoo foo)
---- { }
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----class B {
----}
----
----interface iface {
----}
----
----partial class A : B {
----}
----
----partial class A : iface {
----}
----
----class D { static void Main () {} }
+++ /dev/null
----// Compiler options: -langversion:default
----
----partial class Foo
----{
---- ~Foo ()
---- { }
----}
----
----partial class Foo
----{ }
----
----class B { static void Main () {} }
----
+++ /dev/null
----using System;
----using System.Collections;
----
----public class Tester
----{
---- string[] ABC = { "A", "B", "C" };
---- // D
---- string [,] EFGH = { { "E", "F" }, { "G", "H"}};
---- // I
---- ArrayList al = new ArrayList ();
----
---- public Tester ()
---- {
---- al.Add ("J");
---- al.Add ("K");
---- }
----
---- public System.Collections.IEnumerator GetEnumerator()
---- {
---- foreach (string s in ABC){
---- if (s == null)
---- throw new Exception ();
---- else
---- yield return s;
---- }
----
---- yield return "D";
---- foreach (string s in EFGH){
---- if(s == null)
---- throw new Exception ();
---- else
---- yield return s;
---- }
----
---- yield return "I";
---- foreach (string s in al){
---- if (s == null)
---- throw new Exception ();
---- else
---- yield return s;
---- }
----
---- yield return "L";
---- }
----}
----
----
----class Test
----{
---- public static int Main()
---- {
---- Tester tester = new Tester();
---- string [] list = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L" };
---- int top = 0;
----
---- foreach (string s in tester){
---- if (s != list [top]){
---- Console.WriteLine ("Failure, got {0} expected {1}", s, list [top]);
---- return 1;
---- }
---- top++;
---- }
---- if (top != list.Length){
---- Console.WriteLine ("Failure, expected {0} got {1}", list.Length, top);
---- }
---- Console.WriteLine ("Success");
---- return 0;
---- }
----}
+++ /dev/null
----using System;
----using System.Runtime.InteropServices;
----
----[Obsolete]
----public partial class Test
----{ }
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----public class Foo {
---- delegate Inner foo_fn(string s);
---- public static void Main()
---- {
---- foo_fn f = delegate (string s) {
---- return new Inner(s + s);
---- };
---- f ("Test");
---- }
----
---- class Inner
---- {
---- public Inner (string s)
---- { }
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----using System;
----using System.Collections;
----
----class X {
---- static int start, end;
---- static int i;
----
---- static IEnumerator GetRange ()
---- {
---- yield return 1;
---- for (i = start; i < end; i++)
---- yield return i;
---- yield return 100;
---- }
----
---- static int Main ()
---- {
---- start = 10;
---- end = 30;
----
---- int total = 0;
----
---- IEnumerator e = GetRange ();
---- while (e.MoveNext ()){
---- Console.WriteLine ("Value=" + e.Current);
---- total += (int) e.Current;
---- }
----
---- if (total != 491)
---- return 1;
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----//
----// Use
----
----using System;
----using System.Collections;
----
----class X {
---- static IEnumerable GetIt (int [] args)
---- {
---- foreach (int a in args)
---- yield return a;
---- }
----
---- static IEnumerable GetMulti (int [,] args)
---- {
---- foreach (int a in args)
---- yield return a;
---- }
----
---- static int Main ()
---- {
---- int total = 0;
---- foreach (int i in GetIt (new int [] { 1, 2, 3})){
---- Console.WriteLine ("Got: " + i);
---- total += i;
---- }
----
---- if (total != 6)
---- return 1;
----
---- total = 0;
---- foreach (int i in GetMulti (new int [,] { { 10, 20 }, { 30, 40}})){
---- Console.WriteLine ("Got: " + i);
---- total += i;
---- }
---- if (total != 100)
---- return 2;
----
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----using System;
----using System.Collections;
----
----class X {
---- static IEnumerable GetRange (int start, int end)
---- {
---- for (int i = start; i < end; i++)
---- yield return i;
---- }
----
---- static void Main ()
---- {
---- Console.WriteLine ("GetRange 10..20");
----
---- foreach (int i in GetRange (10, 20)){
---- Console.WriteLine ("i=" + i);
---- }
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----//
----// Anonymous method group conversions
----//
----
----class X {
---- delegate void T ();
---- static event T Click;
----
---- static void Method ()
---- {
---- }
----
---- static void Main ()
---- {
---- T t;
----
---- // Method group assignment
---- t = Method;
----
---- Click += Method;
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----//
----// Use
----
----using System;
----using System.Collections;
----
----class X {
---- static IEnumerable GetIt ()
---- {
---- List l = new List (3);
---- l.Add (1);
---- l.Add (2);
---- l.Add (3);
----
---- foreach (int i in l)
---- yield return i;
---- }
----
---- static int Main ()
---- {
---- int total = 0;
---- foreach (int i in GetIt ()) {
---- Console.WriteLine ("Got: " + i);
---- total += i;
---- }
----
---- return total == 6 ? 0 : 1;
---- }
----}
----
----public class List : IEnumerable {
----
---- int pos = 0;
---- int [] items;
----
---- public List (int i)
---- {
---- items = new int [i];
---- }
----
---- public void Add (int value)
---- {
---- items [pos ++] = value;
---- }
----
---- public MyEnumerator GetEnumerator ()
---- {
---- return new MyEnumerator(this);
---- }
----
---- IEnumerator IEnumerable.GetEnumerator ()
---- {
---- return GetEnumerator ();
---- }
----
---- public struct MyEnumerator : IEnumerator {
----
---- List l;
---- int p;
----
---- public MyEnumerator (List l)
---- {
---- this.l = l;
---- p = -1;
---- }
----
---- public object Current {
---- get {
---- return l.items [p];
---- }
---- }
----
---- public bool MoveNext()
---- {
---- return ++p < l.pos;
---- }
----
---- public void Reset()
---- {
---- p = 0;
---- }
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----using System;
----using System.Collections;
----
----struct S {
---- int j;
----
---- public IEnumerable Get (int a)
---- {
---- Console.WriteLine ("Sending: " + a);
---- yield return a;
---- j = 10;
---- Console.WriteLine ("Sending: " + j);
---- yield return j;
---- }
----
---- public static IEnumerable GetS (int a)
---- {
---- yield return 100;
---- yield return a;
---- yield return 1000;
---- }
----}
----
----class X {
---- IEnumerable Get (int a)
---- {
---- yield return 1;
---- yield return 2;
---- yield return a;
---- }
----
---- static IEnumerable GetS (int a)
---- {
---- yield return a;
---- yield return a;
---- yield return 1;
---- }
----
---- static int Main ()
---- {
---- X y = new X ();
----
---- int total = 0;
---- foreach (int x in y.Get (5)){
---- total += x;
---- }
---- if (total != 8)
---- return 1;
----
---- total = 0;
---- foreach (int x in GetS (3)){
---- total += x;
---- }
---- if (total != 7)
---- return 2;
----
---- S s = new S();
---- total = 0;
---- foreach (int x in s.Get (100)){
---- Console.WriteLine ("Got: " + x);
---- total += x;
---- }
---- if (total != 110)
---- return 3;
----
---- total = 0;
---- foreach (int x in S.GetS (1)){
---- total += x;
---- }
---- if (total != 1101)
---- return 4;
----
---- Console.WriteLine ("OK");
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----using System;
----using System.Collections;
----
----public class Test
----{
---- public IEnumerable Foo (int a)
---- {
---- try {
---- try {
---- yield return a;
---- } finally {
---- Console.WriteLine ("Hello World");
---- }
----
---- Console.WriteLine ("Next block");
----
---- try {
---- yield return a * a;
---- } finally {
---- Console.WriteLine ("Boston");
---- }
---- } finally {
---- Console.WriteLine ("Outer finally");
---- }
----
---- Console.WriteLine ("Outer block");
---- yield break;
---- }
----}
----
----class X
----{
---- static int Main ()
---- {
---- Test test = new Test ();
----
---- ArrayList list = new ArrayList ();
---- foreach (object o in test.Foo (5))
---- list.Add (o);
----
---- if (list.Count != 2)
---- return 1;
---- if ((int) list [0] != 5)
---- return 2;
---- if ((int) list [1] != 25)
---- return 3;
----
---- IEnumerable a = test.Foo (5);
----
---- IEnumerator b = a as IEnumerator;
---- if (b != null) {
---- if (b.MoveNext ())
---- return 4;
---- }
----
---- IEnumerator c = a.GetEnumerator ();
---- if (!c.MoveNext ())
---- return 5;
---- if ((int) c.Current != 5)
---- return 6;
---- if (!c.MoveNext ())
---- return 7;
---- if ((int) c.Current != 25)
---- return 8;
----
---- IEnumerator d = a.GetEnumerator ();
----
---- if ((int) c.Current != 25)
---- return 9;
---- if (!d.MoveNext ())
---- return 10;
---- if ((int) c.Current != 25)
---- return 11;
---- if ((int) d.Current != 5)
---- return 12;
----
---- if (c.MoveNext ())
---- return 13;
----
---- ((IDisposable) a).Dispose ();
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----
----using System;
----using System.Collections;
----
----public class Foo : IDisposable
----{
---- public readonly int Data;
----
---- public Foo (int data)
---- {
---- this.Data = data;
---- }
----
---- public bool disposed;
----
---- public void Dispose ()
---- {
---- disposed = true;
---- }
----}
----
----class X
----{
---- public static IEnumerable Test (int a, int b)
---- {
---- Foo foo3, foo4;
----
---- using (Foo foo1 = new Foo (a), foo2 = new Foo (b)) {
---- yield return foo1.Data;
---- yield return foo2.Data;
----
---- foo3 = foo1;
---- foo4 = foo2;
---- }
----
---- yield return foo3.disposed;
---- yield return foo4.disposed;
---- }
----
---- static int Main ()
---- {
---- ArrayList list = new ArrayList ();
---- foreach (object data in Test (3, 5))
---- list.Add (data);
----
---- if (list.Count != 4)
---- return 1;
---- if ((int) list [0] != 3)
---- return 2;
---- if ((int) list [1] != 5)
---- return 3;
---- if (!(bool) list [2])
---- return 4;
---- if (!(bool) list [3])
---- return 5;
----
---- return 0;
---- }
----}
+++ /dev/null
----//
----// Parameter and return value compilation tests for anonymous methods
----//
----delegate void D (int x);
----delegate void E (out int x);
----
----class X {
---- static int Main ()
---- {
---- // This should create an AnonymousMethod with the implicit argument
---- D d1 = delegate {};
---- D d2 = delegate (int a) {};
----
---- return 0;
---- }
----}
+++ /dev/null
----using System;
----
----delegate int D ();
----
----class X {
----
---- static void Main ()
---- {
---- D x = T (1);
----
---- Console.WriteLine ("Should be 2={0}", x ());
---- }
----
---- static D T (int a)
---- {
---- D d = delegate {
---- a = a + 1;
---- return a;
---- };
----
---- return d;
---- }
----}
+++ /dev/null
----delegate void S ();
----
----class X {
----
---- //
---- // DO NOT ADD ANYTHING ELSE TO THIS TEST
---- //
---- static int Main ()
---- {
---- int a;
----
---- S b = delegate {
---- a = 2;
---- };
----
---- return 0;
---- }
----}
+++ /dev/null
----delegate void S ();
----using System;
----
----class X {
---- static int Main ()
---- {
---- int a = 1;
---- Console.WriteLine ("A is = " + a);
---- int c = a;
---- Console.WriteLine (c);
---- if (a != 1){
---- return 1;
---- }
----
---- S b = delegate {
---- if (a != 1)
---- Environment.Exit (1);
---- Console.WriteLine ("in Delegate");
---- a = 2;
---- if (a != 2)
---- Environment.Exit (2);
---- Console.WriteLine ("Inside = " + a);
---- a = 3;
---- Console.WriteLine ("After = " + a);
---- };
---- if (a != 1)
---- return 3;
---- b ();
---- if (a != 3)
---- return 4;
---- Console.WriteLine ("Back, got " + a);
----
---- return 0;
---- }
----}
+++ /dev/null
----delegate void S ();
----using System;
----
----class X {
---- static void Main ()
---- {
---- int a = 1;
---- S b = delegate {
---- a = 2;
---- };
---- b ();
---- Console.WriteLine ("Back, got " + a);
---- }
----}
+++ /dev/null
----delegate void S ();
----using System;
----
----class X {
---- static void Main ()
---- {
---- int a = 1;
---- S b = delegate {
---- float f = 1;
---- Console.WriteLine (a);
---- if (f == 2)
---- return;
---- };
---- b ();
---- Console.WriteLine ("Back, got " + a);
---- }
----}
+++ /dev/null
----//
----// Tests capturing of double nested variables
----//
----delegate void S ();
----using System;
----
----class X {
---- static int Main ()
---- {
---- int i;
---- S b = null;
----
---- for (i = 0; i < 10; i++){
---- int j = 0;
---- b = delegate {
---- Console.WriteLine ("i={0} j={1}", i, j);
---- i = i + 1;
---- j = j + 1;
---- };
---- }
---- b ();
---- Console.WriteLine ("i = {0}", i);
---- if (!t (i, 11))
---- return 1;
---- b ();
---- if (!t (i, 12))
---- return 2;
---- Console.WriteLine ("i = {0}", i);
---- return 0;
---- }
----
---- static bool t (int a, int b)
---- {
---- return a == b;
---- }
----}
+++ /dev/null
----//
----// Tests capturing of variables
----//
----delegate void S ();
----using System;
----
----class X {
---- static int Main ()
---- {
---- int a = 1;
---- if (a != 1)
---- return 1;
----
---- Console.WriteLine ("A is = " + a);
---- S b= delegate {
---- Console.WriteLine ("on delegate");
---- a = 2;
---- };
---- if (a != 1)
---- return 2;
---- b();
---- if (a != 2)
---- return 3;
---- Console.WriteLine ("OK");
---- return 0;
---- }
----}
----
+++ /dev/null
----//
----// Tests havign more than one anonymous method that captures the same variable
----//
----using System;
----
----delegate void D ();
----
----class X {
---- static int Main ()
---- {
---- int a = 0;
---- D d1 = delegate {
---- Console.WriteLine ("First");
---- a = 1;
---- };
----
---- D d2 = delegate {
---- Console.WriteLine ("Second");
---- a = 2;
---- };
---- if (!t (a, 0))
---- return 1;
---- d1 ();
---- if (!t (a, 1))
---- return 2;
---- d2 ();
---- if (!t (a, 2))
---- return 3;
---- Console.WriteLine ("Test passes OK");
---- return 0;
---- }
----
---- static bool t (int a, int b)
---- {
---- return a == b;
---- }
----}
+++ /dev/null
----//
----// Tests capturing of double nested variables
----//
----delegate void S ();
----using System;
----
----class X {
---- static int Main ()
---- {
---- int i;
---- int a = 0;
---- S b = null;
----
---- for (i = 0; i < 10; i++){
---- int j = 0;
---- b = delegate {
---- Console.WriteLine ("i={0} j={1}", i, j);
---- i = i + 1;
---- j = j + 1;
---- a = j;
---- };
---- }
---- b ();
---- Console.WriteLine ("i = {0}", i);
---- if (!t (i, 11))
---- return 1;
---- b ();
---- if (!t (i, 12))
---- return 2;
---- Console.WriteLine ("i = {0}", i);
---- Console.WriteLine ("a = {0}", a);
---- if (!t (a, 2))
---- return 3;
----
---- return 0;
---- }
----
---- static bool t (int a, int b)
---- {
---- return a == b;
---- }
----}
++++2005-06-14 Marek Safar <marek.safar@seznam.cz>
++++
++++ * gen-*.cs: Renamed to gtest-*.cs.
++++ * 2test-20: Renamed to gtest-163.cs.
++++ * 2test-21: Renamed to gtest-164.cs.
++++ * 2test-22: Renamed to gtest-165.cs.
++++ * 2test-*.cs: Renamed to test-*.cs
++++ * xml-*.cs: Renamed to test-xml*.cs.
++++
++++ * Makefile: Switch to compiler-tester.
++++
+ +2005-06-08 Raja R Harinath <rharinath@novell.com>
+ +
+ + * test-388.cs, test-389.cs: New tests from #75160. They're
+ + actually interdependent. #75160 is a file-ordering bug, and we
+ + use the two testcases to drive the two different orderings.
+ + * Makefile (TEST_HARNESS_EXTRAS): Add test-388.cs and test-389.cs.
+ +
2005-06-03 Raja R Harinath <rharinath@novell.com>
* Makefile (TEST_SOURCES_common): Re-enable test-183: the runtime
gen-121 gen-122 gen-123 gen-124 gen-125 gen-127 gen-128 gen-129 gen-130 \
gen-131 gen-132 gen-133 gen-134 gen-135 gen-136 gen-137 gen-138 gen-139 gen-140 \
gen-141 gen-142 gen-143 gen-144 gen-145 gen-146 gen-147 gen-148 gen-149 gen-150 \
- - gen-151 gen-152 gen-153 gen-154 gen-155 gen-157 gen-158 \
- cond-attr fixed-buffer-dll fixed-buffer-exe
+ + gen-151 gen-152 gen-153 gen-154 gen-155 gen-157 gen-158 gen-159 gen-160 \
+ + gen-162 \
+ cond-attr fixed-buffer-dll fixed-buffer-exe \
- 2test-19
+ + 2test-19 2test-20 2test-21 2test-22
TEST_EXCLUDES_net_2_0 = $(NEW_TEST_SOURCES_common)
test-casts: boot-casts.out mcs-casts.out
cmp $^
----test-local: xmldocdiff.exe casts-boot.exe
++++test-local: casts-boot.exe
----run-test-local: ilasm test-harness test-casts
++++ifeq (net_2_0, $(PROFILE))
++++COMPILER_NAME = gmcs
++++COMPILER = $(topdir)/gmcs/gmcs.exe
++++TEST_PATTERN = '*test-*.cs'
++++else
++++COMPILER_NAME = mcs
++++COMPILER = $(topdir)/class/lib/$(PROFILE)/mcs.exe
++++TEST_PATTERN = 'test-*.cs'
++++endif
++++
++++run-test-local: ilasm
++++ MONO_RUNTIME=mono $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/compiler-tester.exe positive $(TEST_PATTERN) $(COMPILER) known-issues-$(COMPILER_NAME) $(COMPILER_NAME).log
# do nothing for this target
run-test-ondotnet-local:
clean-local:
-rm -fr dir-*
---- -rm -f *.exe *.dll *.netmodule *.out *.pdb casts.cs
++++ -rm -f *.exe *.dll *.netmodule *.out *.pdb casts.cs *.log
++++ -rm -f xml-*.xml
dist-local: dist-default
rm -f $(distdir)/casts.cs
endif
.PHONY: test-harness test-harness-run
----test-harness: xmldocdiff.exe
++++test-harness:
@$(MAKE) -s test-harness-run
exe_tests := $(filter %-exe, $(TEST_SOURCES))
xml-doc-tests := $(filter xml-%, $(TEST_SOURCES))
----xmldocdiff.exe:
---- $(CSCOMPILE) xmldocdiff.cs
----
%-il.dll: %-il.il
$(ILASM) /dll $<
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library\r
++++
++++using System;
++++
++++public struct Result {
++++ public int res;
++++ // big enough that it won't be returned in registers
++++ double duh;
++++ long bah;
++++
++++ public Result (int val) {
++++ res = val;
++++ bah = val;
++++ duh = val;
++++ }
++++}
++++
++++public class Vararg
++++{
++++ public static int AddABunchOfInts (__arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return result;
++++ }
++++
++++ public static int AddASecondBunchOfInts (int a, __arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return result;
++++ }
++++
++++ public static Result VtAddABunchOfInts (__arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return new Result (result);
++++ }
++++
++++ public static Result VtAddASecondBunchOfInts (int a, __arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return new Result (result);
++++ }
++++
++++ public int InstAddABunchOfInts (__arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return result;
++++ }
++++
++++ public int InstAddASecondBunchOfInts (int a, __arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return result;
++++ }
++++
++++ public Result InstVtAddABunchOfInts (__arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return new Result (result);
++++ }
++++
++++ public Result InstVtAddASecondBunchOfInts (int a, __arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return new Result (result);
++++ }
++++}
+++ /dev/null
----using System;
----
----delegate void D ();
----
----class X {
---- static void Main ()
---- {
---- X x = new X (1);
---- X y = new X (100);
---- D a = x.T ();
---- D b = y.T ();
----
---- a ();
---- b ();
---- }
----
---- X (int start)
---- {
---- ins = start;
---- }
----
---- int ins;
----
---- D T ()
---- {
---- D d = delegate () {
---- Console.WriteLine ("My state is: " + CALL ());
---- };
----
---- return d;
---- }
---- string CALL ()
---- {
---- return "GOOD";
---- }
----
----}
+++ /dev/null
----delegate void S ();
----
----class X {
----
---- //
---- // DO NOT ADD ANYTHING ELSE TO THIS TEST
---- //
---- static int Main ()
---- {
---- int a;
----
---- S b = delegate {
---- a = 2;
---- };
----
---- return 0;
---- }
----}
+++ /dev/null
----//
----// This test exercises the access to a field instance from an instance
----// method that has an anonymous method.
----//
----using System;
----
----class S {
---- delegate void T ();
----
---- T t;
----
---- int f;
----
---- public void Test ()
---- {
---- // The loop just forces the creation of a helper class, so
---- // that the anonymous method is not placed side-by-side this
---- // method.
---- int a = 1;
---- for (int i = a; i < 10; i++){
---- int j = i;
---- t = delegate {
---- Console.WriteLine ("Before: {0} {1} {2}", f, i, j);
---- f = i;
---- };
---- }
---- }
----
---- static int Main ()
---- {
---- S s = new S ();
---- s.Test ();
---- s.t ();
---- if (s.f == 10)
---- return 0;
---- Console.WriteLine ("Failed:" + s.f);
---- return 1;
---- }
----}
----
----
+++ /dev/null
----//
----// This test checks various uses of captured local variables
----//
----using System;
----
----delegate void S ();
----
----class X {
---- static int Main ()
---- {
---- int a = 1;
---- Console.WriteLine ("A is = " + a);
---- int c = a;
---- Console.WriteLine (c);
---- if (a != 1){
---- return 1;
---- }
----
---- S b = delegate {
---- if (a != 1)
---- Environment.Exit (1);
---- Console.WriteLine ("in Delegate");
---- a = 2;
---- if (a != 2)
---- Environment.Exit (2);
---- Console.WriteLine ("Inside = " + a);
---- a = 3;
---- Console.WriteLine ("After = " + a);
---- };
---- if (a != 1)
---- return 3;
---- b ();
---- if (a != 3)
---- return 4;
---- Console.WriteLine ("Back, got " + a);
---- Console.WriteLine ("Test is ok");
---- return 0;
---- }
----}
+++ /dev/null
----//
----// Simple variable capturing
----//
----using System;
----
----delegate void S ();
----
----class X {
---- static void Main ()
---- {
---- int a = 1;
---- S b = delegate {
---- a = 2;
---- };
---- b ();
---- Console.WriteLine ("Back, got " + a);
---- }
----}
+++ /dev/null
----//
----// Capturing test.
----//
----using System;
----
----delegate void S ();
----
----class X {
---- static void Main ()
---- {
---- int a = 1;
---- S b = delegate {
---- float f = 1;
---- Console.WriteLine (a);
---- if (f == 2)
---- return;
---- };
---- b ();
---- Console.WriteLine ("Back, got " + a);
---- }
----}
+++ /dev/null
----//
----// Tests capturing of double nested variables
----//
----using System;
----delegate void S ();
----
----class X {
---- static int Main ()
---- {
---- int i;
---- S b = null;
----
---- for (i = 0; i < 10; i++){
---- int j = 0;
---- b = delegate {
---- Console.WriteLine ("i={0} j={1}", i, j);
---- i = i + 1;
---- j = j + 1;
---- };
---- }
---- Console.WriteLine ("i = {0}", i);
---- b ();
---- Console.WriteLine ("i = {0}", i);
---- if (!t (i, 11))
---- return 1;
---- b ();
---- if (!t (i, 12))
---- return 2;
---- Console.WriteLine ("i = {0}", i);
---- Console.WriteLine ("Test is OK");
---- return 0;
---- }
----
---- static bool t (int a, int b)
---- {
---- return a == b;
---- }
----}
+++ /dev/null
----//
----// Tests capturing of variables
----//
----using System;
----
----delegate void S ();
----
----class X {
---- static int Main ()
---- {
---- int a = 1;
---- if (a != 1)
---- return 1;
----
---- Console.WriteLine ("A is = " + a);
---- S b= delegate {
---- Console.WriteLine ("on delegate");
---- a = 2;
---- };
---- if (a != 1)
---- return 2;
---- b();
---- if (a != 2)
---- return 3;
---- Console.WriteLine ("OK");
---- return 0;
---- }
----}
----
+++ /dev/null
----//
----// Tests havign more than one anonymous method that captures the same variable
----//
----using System;
----
----delegate void D ();
----
----class X {
---- static int Main ()
---- {
---- int a = 0;
---- D d1 = delegate {
---- Console.WriteLine ("First");
---- a = 1;
---- };
----
---- D d2 = delegate {
---- Console.WriteLine ("Second");
---- a = 2;
---- };
---- if (!t (a, 0))
---- return 1;
---- d1 ();
---- if (!t (a, 1))
---- return 2;
---- d2 ();
---- if (!t (a, 2))
---- return 3;
---- Console.WriteLine ("Test passes OK");
---- return 0;
---- }
----
---- static bool t (int a, int b)
---- {
---- return a == b;
---- }
----}
+++ /dev/null
----//
----// Tests assignment of a captured variable to another
----// Do not add anything else to this test.
----//
----delegate void S ();
----
----class X {
----
---- //
---- // DO NOT ADD ANYTHING ELSE TO THIS TEST
---- //
---- static int Main ()
---- {
---- int a = 2;
---- int b = 1;
---- S d = delegate {
---- a = b;
---- };
----
---- return 0;
---- }
----}
+++ /dev/null
----//
----// Tests unary mutator operators on captured variables
----//
----using System;
----
----class X {
---- delegate void D ();
----
---- static int gt, gj;
----
---- static int Main ()
---- {
---- int times = 0;
----
---- D d = delegate {
---- int t = times++;
---- int j = ++times;
----
---- gt = t;
---- gj = j;
---- };
---- d ();
----
---- if (gt != 0)
---- return 1;
---- if (gj != 2)
---- return 2;
----
---- return 0;
---- }
----}
+++ /dev/null
----//
----// Tests the syntax for delegates and events
----//
----using System;
----
----delegate void ClickEvent ();
----
----class Button {
---- public event ClickEvent Clicked;
----
---- public void DoClick ()
---- {
---- Clicked ();
---- }
----
----}
----
----class X {
---- static bool called = false;
----
---- static int Main ()
---- {
---- Button b = new Button ();
----
---- b.Clicked += delegate {
---- Console.WriteLine ("This worked!");
---- called = true;
---- };
----
---- b.DoClick ();
----
---- if (called)
---- return 0;
---- else
---- return 1;
---- }
----
----}
+++ /dev/null
----using System;
----
----delegate void A ();
----
----class DelegateTest {
---- static void Main (string[] argv)
---- {
---- Console.WriteLine ("Test");
----
---- foreach (string arg in argv) {
---- Console.WriteLine ("OUT: {0}", arg);
---- A a = delegate {
---- Console.WriteLine ("arg: {0}", arg);
---- };
---- a ();
---- }
---- }
----}
----
+++ /dev/null
----//
----// Instance access.
----//
----using System;
----
----delegate void D ();
----
----class X {
---- static void Main ()
---- {
---- X x = new X (1);
---- X y = new X (100);
---- D a = x.T ();
---- D b = y.T ();
----
---- a ();
---- b ();
---- }
----
---- X (int start)
---- {
---- ins = start;
---- }
----
---- int ins;
----
---- D T ()
---- {
---- D d = delegate () {
---- Console.WriteLine ("My state is: " + ins);
---- };
----
---- return d;
---- }
----}
+++ /dev/null
----//
----// Nested anonymous methods tests and capturing of different variables.
----//
----using System;
----
----delegate void D ();
----
----class X {
---- static D GlobalStoreDelegate;
----
---- static void Main ()
---- {
---- D d = MainHost ();
----
---- d ();
---- GlobalStoreDelegate ();
---- GlobalStoreDelegate ();
---- }
----
---- static D MainHost ()
---- {
---- int toplevel_local = 0;
----
---- D d = delegate () {
---- int anonymous_local = 1;
----
---- GlobalStoreDelegate = delegate {
---- Console.WriteLine ("var1: {0} var2: {1}", toplevel_local, anonymous_local);
---- anonymous_local = anonymous_local + 1;
---- };
----
---- toplevel_local = toplevel_local + 1;
---- };
----
---- return d;
---- }
----}
+++ /dev/null
----//
----// Nested anonymous methods and capturing of variables test
----//
----using System;
----
----delegate void D ();
----
----class X {
----
---- static int Main ()
---- {
---- X x = new X();
---- x.M ();
---- e ();
---- Console.WriteLine ("J should be 101= {0}", j);
---- if (j != 101)
---- return 3;
---- Console.WriteLine ("OK");
---- return 0;
---- }
----
---- static int j = 0;
---- static D e;
----
---- void M ()
---- {
---- int l = 100;
----
---- D d = delegate {
---- int b;
---- b = 1;
---- Console.WriteLine ("Inside d");
---- e = delegate {
---- Console.WriteLine ("Inside e");
---- j = l + b;
---- Console.WriteLine ("j={0} l={1} b={2}", j, l, b);
---- };
---- };
---- Console.WriteLine ("Calling d");
---- d ();
---- }
----
----}
+++ /dev/null
----//
----using System;
----
----delegate void D ();
----
----class X {
---- static D r;
----
---- static void Main ()
---- {
---- D d = T ();
----
---- d ();
---- r ();
---- r ();
---- }
----
---- static D T ()
---- {
---- int var1 = 0;
----
---- D d = delegate () {
---- int var2 = 1;
----
---- r = delegate {
---- Console.WriteLine ("var1: {0} var2: {1}", var1, var2);
---- var2 = var2 + 1;
---- };
----
---- var1 = var1 + 1;
---- };
----
---- return d;
---- }
----}
+++ /dev/null
----using System;
----
----delegate void D ();
----
----class X {
----
---- static int Main ()
---- {
---- X x = new X();
---- x.M ();
---- e ();
---- Console.WriteLine ("J should be 101= {0}", j);
---- if (j != 101)
---- return 3;
---- Console.WriteLine ("OK");
---- return 0;
---- }
----
---- static int j;
---- static D e;
----
---- void M ()
---- {
---- int l = 100;
----
---- D d = delegate {
---- int b;
---- b = 1;
---- e = delegate {
---- j = l + b;
---- };
---- };
---- d ();
---- }
----
----}
+++ /dev/null
----//
----// Tests capturing of double nested variables
----//
----using System;
----
----delegate void S ();
----
----class X {
---- static int Main ()
---- {
---- int i;
---- int a = 0;
---- S b = null;
----
---- for (i = 0; i < 10; i++){
---- int j = 0;
---- b = delegate {
---- Console.WriteLine ("i={0} j={1}", i, j);
---- i = i + 1;
---- j = j + 1;
---- a = j;
---- };
---- }
---- b ();
---- Console.WriteLine ("i = {0}", i);
---- if (!t (i, 11))
---- return 1;
---- b ();
---- if (!t (i, 12))
---- return 2;
---- Console.WriteLine ("i = {0}", i);
---- Console.WriteLine ("a = {0}", a);
---- if (!t (a, 2))
---- return 3;
----
---- return 0;
---- }
----
---- static bool t (int a, int b)
---- {
---- return a == b;
---- }
----}
+++ /dev/null
----using System;
----
----delegate int D ();
----
----class X {
----
---- static void Main ()
---- {
---- D x = T (1);
----
---- Console.WriteLine ("Should be 2={0}", x ());
---- }
----
---- static D T (int a)
---- {
---- D d = delegate {
---- a = a + 1;
---- return a;
---- };
----
---- return d;
---- }
----}
+++ /dev/null
----using System;
----
----delegate int D (int arg);
----
----class X {
----
---- static int Main ()
---- {
---- D x = T (1);
----
---- int v = x (10);
---- Console.WriteLine ("Should be 11={0}", v);
---- return v == 11 ? 0 : 1;
---- }
----
---- static D T (int a)
---- {
---- D d = delegate (int arg) {
---- return arg + a;
---- };
----
---- return d;
---- }
----}
+++ /dev/null
----// Compiler options: -unsafe
----using System;
----
----delegate int D ();
----
----unsafe class X {
----
---- static int Main ()
---- {
---- D x = T (1);
----
---- int v = x ();
---- Console.WriteLine ("Should be 2={0}", v);
---- return v == 2 ? 0 : 1;
---- }
----
---- static D T (int a)
---- {
---- D d = delegate {
---- int *x = &a;
----
---- *x = *x + 1;
---- return *x;
---- };
----
---- return d;
---- }
----}
+++ /dev/null
----using System;
----
----delegate void D ();
----
----class X {
----
---- static int Main ()
---- {
---- X x = new X();
---- x.M (10);
---- e ();
---- Console.WriteLine ("J should be 11= {0}", j);
---- e ();
---- Console.WriteLine ("J should be 11= {0}", j);
---- x.M (100);
---- e ();
---- Console.WriteLine ("J should be 101= {0}", j);
---- if (j != 101)
---- return 3;
---- Console.WriteLine ("OK");
---- return 0;
---- }
----
---- static int j;
---- static D e;
----
---- void M (int a)
---- {
---- Console.WriteLine ("A is=" + a);
---- D d = delegate {
---- int b;
---- b = 1;
---- e = delegate {
---- Console.WriteLine ("IN NESTED DELEGATE: {0}", a);
---- j = a + b;
---- };
---- };
---- d ();
---- }
----
----}
+++ /dev/null
----using System;
----
----class Delegable {
---- public event EventHandler MyDelegate;
----}
----
----class DelegateTest {
---- static void Main (string[] argv)
---- {
---- Console.WriteLine ("Test");
----
---- Delegable db = new Delegable ();
---- db.MyDelegate += delegate (object o, EventArgs args) {
---- Console.WriteLine ("{0}", argv);
---- Console.WriteLine ("{0}", db);
---- };
---- }
----}
----
----
+++ /dev/null
----//
----// Parameter and return value compilation tests for anonymous methods
----//
----delegate void D (int x);
----delegate void E (out int x);
----
----class X {
---- static int Main ()
---- {
---- // This should create an AnonymousMethod with the implicit argument
---- D d1 = delegate {};
---- D d2 = delegate (int a) {};
----
---- return 0;
---- }
----}
+++ /dev/null
----using System;
----using System.Collections;
----
----delegate bool predicate (object a);
----
----class X {
----
---- static int Main ()
---- {
---- ArrayList a = new ArrayList ();
---- for (int i = 0; i < 10; i++)
---- a.Add (i);
----
---- ArrayList even = Find (delegate (object arg) {
---- return ((((int) arg) % 2) == 0);
---- }, a);
----
---- Console.WriteLine ("Even numbers");
---- foreach (object r in even){
---- Console.WriteLine (r);
---- }
---- if (even.Count != 5)
---- return 1;
---- if (((int)even [0]) != 0 ||
---- ((int)even [1]) != 2 ||
---- ((int)even [2]) != 4 ||
---- ((int)even [3]) != 6 ||
---- ((int)even [4]) != 8)
---- return 2;
----
---- return 0;
---- }
----
---- static ArrayList Find (predicate p, ArrayList source)
---- {
---- ArrayList result = new ArrayList ();
----
---- foreach (object a in source){
---- if (p (a))
---- result.Add (a);
---- }
----
---- return result;
---- }
----}
+++ /dev/null
----//
----// Test for access modifiers
----//
----
----using System;
----
---- public class Tester {
----
---- static void Main ()
---- {
---- A a = new A (8);
---- B b = new B (9);
----
---- b.SetCount (10);
---- Console.WriteLine ("b.Count should be 9: {0}", b.Count);
---- Console.WriteLine ("b [{0}] should return {0}: {1}", 10, b [10]);
----
---- Console.WriteLine ("a.Message : {0}", a.Message);
---- b.Message = "";
---- Console.WriteLine ("b.Messasge : {0}", b.Message);
---- }
----
---- }
----
---- public class A {
----
---- protected int count;
----
---- public A (int count)
---- {
---- this.count = count;
---- }
----
---- public virtual int Count {
---- get {
---- return count;
---- }
---- protected set {
---- count = value;
---- }
---- }
----
---- public virtual int this [int index] {
---- get {
---- return index;
---- }
---- }
----
---- public virtual string Message {
---- get {
---- return "Hello Mono";
---- }
---- }
----
---- }
----
---- public class B : A {
----
---- public B (int count) : base (count)
---- {
---- }
----
---- public override int Count {
---- protected set {
---- }
---- }
----
---- public void SetCount (int value)
---- {
---- Count = value;
---- }
----
---- public override int this [int index] {
---- get {
---- return base [index];
---- }
---- }
----
---- public new string Message {
---- get {
---- return "Hello Mono (2)";
---- }
---- internal set {
---- }
---- }
----
---- }
----
+++ /dev/null
----//
----// acc-modifiers2.cs: We use reflection to test that the flags are the correct ones
----//
----
----using System;
----using System.Reflection;
----
---- [AttributeUsage (AttributeTargets.Class)]
---- public class TypeCheckAttribute : Attribute {
----
---- public TypeCheckAttribute ()
---- {
---- }
---- }
----
---- [AttributeUsage (AttributeTargets.Property)]
---- public class PropertyCheckAttribute : Attribute {
----
---- public PropertyCheckAttribute ()
---- {
---- }
---- }
----
---- [AttributeUsage (AttributeTargets.Method)]
---- public class AccessorCheckAttribute : Attribute {
---- MethodAttributes flags;
----
---- public AccessorCheckAttribute (MethodAttributes flags)
---- {
---- this.flags = flags;
---- }
----
---- public MethodAttributes Attributes {
---- get {
---- return flags;
---- }
---- }
---- }
----
---- public class Test {
----
---- public static int Main (string [] args)
---- {
---- Type t = typeof (A);
----
---- foreach (PropertyInfo pi in t.GetProperties ()) {
---- object [] attrs = pi.GetCustomAttributes (typeof (PropertyCheckAttribute), true);
---- if (attrs == null)
---- return 0;
----
---- MethodInfo get_accessor, set_accessor;
---- get_accessor = pi.GetGetMethod (true);
---- set_accessor = pi.GetSetMethod (true);
----
---- if (get_accessor != null)
---- CheckFlags (pi, get_accessor);
---- if (set_accessor != null)
---- CheckFlags (pi, set_accessor);
---- }
----
---- return 0;
---- }
----
---- static void CheckFlags (PropertyInfo pi, MethodInfo accessor)
---- {
---- object [] attrs = accessor.GetCustomAttributes (typeof (AccessorCheckAttribute), true);
---- if (attrs == null)
---- return;
----
---- AccessorCheckAttribute accessor_attr = (AccessorCheckAttribute) attrs [0];
---- MethodAttributes accessor_flags = accessor.Attributes;
----
---- if ((accessor_flags & accessor_attr.Attributes) == accessor_attr.Attributes)
---- Console.WriteLine ("Test for {0}.{1} PASSED", pi.Name, accessor.Name);
---- else {
---- string message = String.Format ("Test for {0}.{1} INCORRECT: MethodAttributes should be {2}, but are {3}",
---- pi.Name, accessor.Name, accessor_attr.Attributes, accessor_flags);
---- throw new Exception (message);
---- }
---- }
----
---- }
----
---- [TypeCheck]
---- public class A {
----
---- const MethodAttributes flags = MethodAttributes.HideBySig |
---- MethodAttributes.SpecialName;
----
---- [PropertyCheck]
---- public int Value1 {
---- [AccessorCheck (flags | MethodAttributes.Public)]
---- get {
---- return 0;
---- }
---- [AccessorCheck (flags | MethodAttributes.Public)]
---- set {
---- }
---- }
----
---- [PropertyCheck]
---- public int Value2 {
---- [AccessorCheck (flags | MethodAttributes.Public)]
---- get {
---- return 0;
---- }
---- [AccessorCheck (flags | MethodAttributes.FamORAssem)]
---- protected internal set {
---- }
---- }
----
---- [PropertyCheck]
---- public int Value3 {
---- [AccessorCheck (flags | MethodAttributes.Public)]
---- get {
---- return 0;
---- }
---- [AccessorCheck (flags | MethodAttributes.Family)]
---- protected set {
---- }
---- }
----
---- [PropertyCheck]
---- public int Value4 {
---- [AccessorCheck (flags | MethodAttributes.Assembly)]
---- internal get {
---- return 0;
---- }
---- [AccessorCheck (flags | MethodAttributes.Public)]
---- set {
---- }
---- }
----
---- [PropertyCheck]
---- public int Value5 {
---- [AccessorCheck (flags | MethodAttributes.Public)]
---- get {
---- return 0;
---- }
---- [AccessorCheck (flags | MethodAttributes.Private)]
---- private set {
---- }
---- }
----
---- }
----
+++ /dev/null
----// cs0146.cs: circular class definition
----// Line: 6
----class A : B {
----}
----
----class B : A {
----}
+++ /dev/null
----class X {
----}
+++ /dev/null
----using System;
----class Test {
----
---- static void receive_int (int a)
---- {
---- Console.Write (" ");
---- Console.WriteLine (a);
---- }
----
---- static void receive_uint (uint a)
---- {
---- Console.Write (" ");
---- Console.WriteLine (a);
---- }
----
---- static void receive_short (short a)
---- {
---- Console.Write (" ");
---- Console.WriteLine (a);
---- }
----
---- static void receive_ushort (ushort a)
---- {
---- Console.Write (" ");
---- Console.WriteLine (a);
---- }
----
---- static void receive_long (long a)
---- {
---- Console.Write (" ");
---- Console.WriteLine (a);
---- }
----
---- static void receive_ulong (ulong a)
---- {
---- Console.Write (" ");
---- Console.WriteLine (a);
---- }
----
---- static void receive_sbyte (sbyte a)
---- {
---- Console.Write (" ");
---- Console.WriteLine (a);
---- }
----
---- static void receive_byte (byte a)
---- {
---- Console.Write (" ");
---- Console.WriteLine (a);
---- }
----
---- static void receive_char (char a)
---- {
---- Console.Write (" ");
---- Console.WriteLine (a);
---- }
----
---- static void probe_int()
---- {
---- int zero = (int) 0;
---- int min = (int) int.MinValue;
---- int max = (int) int.MaxValue;
----
---- Console.WriteLine ("Testing: int");
----
---- Console.WriteLine (" arg: int (int)");
----
---- receive_int (unchecked((int) zero));
---- receive_int (unchecked((int) min));
---- receive_int (unchecked((int) max));
---- Console.WriteLine (" arg: uint (int)");
----
---- receive_uint (unchecked((uint) zero));
---- receive_uint (unchecked((uint) min));
---- receive_uint (unchecked((uint) max));
---- Console.WriteLine (" arg: short (int)");
----
---- receive_short (unchecked((short) zero));
---- receive_short (unchecked((short) min));
---- receive_short (unchecked((short) max));
---- Console.WriteLine (" arg: ushort (int)");
----
---- receive_ushort (unchecked((ushort) zero));
---- receive_ushort (unchecked((ushort) min));
---- receive_ushort (unchecked((ushort) max));
---- Console.WriteLine (" arg: long (int)");
----
---- receive_long (unchecked((long) zero));
---- receive_long (unchecked((long) min));
---- receive_long (unchecked((long) max));
---- Console.WriteLine (" arg: ulong (int)");
----
---- receive_ulong (unchecked((ulong) zero));
---- receive_ulong (unchecked((ulong) min));
---- receive_ulong (unchecked((ulong) max));
---- Console.WriteLine (" arg: sbyte (int)");
----
---- receive_sbyte (unchecked((sbyte) zero));
---- receive_sbyte (unchecked((sbyte) min));
---- receive_sbyte (unchecked((sbyte) max));
---- Console.WriteLine (" arg: byte (int)");
----
---- receive_byte (unchecked((byte) zero));
---- receive_byte (unchecked((byte) min));
---- receive_byte (unchecked((byte) max));
---- Console.WriteLine (" arg: char (int)");
----
---- receive_char (unchecked((char) zero));
---- receive_char (unchecked((char) min));
---- receive_char (unchecked((char) max));
---- }
----
---- static void probe_uint()
---- {
---- uint zero = (uint) 0;
---- uint min = (uint) uint.MinValue;
---- uint max = (uint) uint.MaxValue;
----
---- Console.WriteLine ("Testing: uint");
----
---- Console.WriteLine (" arg: int (uint)");
----
---- receive_int (unchecked((int) zero));
---- receive_int (unchecked((int) min));
---- receive_int (unchecked((int) max));
---- Console.WriteLine (" arg: uint (uint)");
----
---- receive_uint (unchecked((uint) zero));
---- receive_uint (unchecked((uint) min));
---- receive_uint (unchecked((uint) max));
---- Console.WriteLine (" arg: short (uint)");
----
---- receive_short (unchecked((short) zero));
---- receive_short (unchecked((short) min));
---- receive_short (unchecked((short) max));
---- Console.WriteLine (" arg: ushort (uint)");
----
---- receive_ushort (unchecked((ushort) zero));
---- receive_ushort (unchecked((ushort) min));
---- receive_ushort (unchecked((ushort) max));
---- Console.WriteLine (" arg: long (uint)");
----
---- receive_long (unchecked((long) zero));
---- receive_long (unchecked((long) min));
---- receive_long (unchecked((long) max));
---- Console.WriteLine (" arg: ulong (uint)");
----
---- receive_ulong (unchecked((ulong) zero));
---- receive_ulong (unchecked((ulong) min));
---- receive_ulong (unchecked((ulong) max));
---- Console.WriteLine (" arg: sbyte (uint)");
----
---- receive_sbyte (unchecked((sbyte) zero));
---- receive_sbyte (unchecked((sbyte) min));
---- receive_sbyte (unchecked((sbyte) max));
---- Console.WriteLine (" arg: byte (uint)");
----
---- receive_byte (unchecked((byte) zero));
---- receive_byte (unchecked((byte) min));
---- receive_byte (unchecked((byte) max));
---- Console.WriteLine (" arg: char (uint)");
----
---- receive_char (unchecked((char) zero));
---- receive_char (unchecked((char) min));
---- receive_char (unchecked((char) max));
---- }
----
---- static void probe_short()
---- {
---- short zero = (short) 0;
---- short min = (short) short.MinValue;
---- short max = (short) short.MaxValue;
----
---- Console.WriteLine ("Testing: short");
----
---- Console.WriteLine (" arg: int (short)");
----
---- receive_int (unchecked((int) zero));
---- receive_int (unchecked((int) min));
---- receive_int (unchecked((int) max));
---- Console.WriteLine (" arg: uint (short)");
----
---- receive_uint (unchecked((uint) zero));
---- receive_uint (unchecked((uint) min));
---- receive_uint (unchecked((uint) max));
---- Console.WriteLine (" arg: short (short)");
----
---- receive_short (unchecked((short) zero));
---- receive_short (unchecked((short) min));
---- receive_short (unchecked((short) max));
---- Console.WriteLine (" arg: ushort (short)");
----
---- receive_ushort (unchecked((ushort) zero));
---- receive_ushort (unchecked((ushort) min));
---- receive_ushort (unchecked((ushort) max));
---- Console.WriteLine (" arg: long (short)");
----
---- receive_long (unchecked((long) zero));
---- receive_long (unchecked((long) min));
---- receive_long (unchecked((long) max));
---- Console.WriteLine (" arg: ulong (short)");
----
---- receive_ulong (unchecked((ulong) zero));
---- receive_ulong (unchecked((ulong) min));
---- receive_ulong (unchecked((ulong) max));
---- Console.WriteLine (" arg: sbyte (short)");
----
---- receive_sbyte (unchecked((sbyte) zero));
---- receive_sbyte (unchecked((sbyte) min));
---- receive_sbyte (unchecked((sbyte) max));
---- Console.WriteLine (" arg: byte (short)");
----
---- receive_byte (unchecked((byte) zero));
---- receive_byte (unchecked((byte) min));
---- receive_byte (unchecked((byte) max));
---- Console.WriteLine (" arg: char (short)");
----
---- receive_char (unchecked((char) zero));
---- receive_char (unchecked((char) min));
---- receive_char (unchecked((char) max));
---- }
----
---- static void probe_ushort()
---- {
---- ushort zero = (ushort) 0;
---- ushort min = (ushort) ushort.MinValue;
---- ushort max = (ushort) ushort.MaxValue;
----
---- Console.WriteLine ("Testing: ushort");
----
---- Console.WriteLine (" arg: int (ushort)");
----
---- receive_int (unchecked((int) zero));
---- receive_int (unchecked((int) min));
---- receive_int (unchecked((int) max));
---- Console.WriteLine (" arg: uint (ushort)");
----
---- receive_uint (unchecked((uint) zero));
---- receive_uint (unchecked((uint) min));
---- receive_uint (unchecked((uint) max));
---- Console.WriteLine (" arg: short (ushort)");
----
---- receive_short (unchecked((short) zero));
---- receive_short (unchecked((short) min));
---- receive_short (unchecked((short) max));
---- Console.WriteLine (" arg: ushort (ushort)");
----
---- receive_ushort (unchecked((ushort) zero));
---- receive_ushort (unchecked((ushort) min));
---- receive_ushort (unchecked((ushort) max));
---- Console.WriteLine (" arg: long (ushort)");
----
---- receive_long (unchecked((long) zero));
---- receive_long (unchecked((long) min));
---- receive_long (unchecked((long) max));
---- Console.WriteLine (" arg: ulong (ushort)");
----
---- receive_ulong (unchecked((ulong) zero));
---- receive_ulong (unchecked((ulong) min));
---- receive_ulong (unchecked((ulong) max));
---- Console.WriteLine (" arg: sbyte (ushort)");
----
---- receive_sbyte (unchecked((sbyte) zero));
---- receive_sbyte (unchecked((sbyte) min));
---- receive_sbyte (unchecked((sbyte) max));
---- Console.WriteLine (" arg: byte (ushort)");
----
---- receive_byte (unchecked((byte) zero));
---- receive_byte (unchecked((byte) min));
---- receive_byte (unchecked((byte) max));
---- Console.WriteLine (" arg: char (ushort)");
----
---- receive_char (unchecked((char) zero));
---- receive_char (unchecked((char) min));
---- receive_char (unchecked((char) max));
---- }
----
---- static void probe_long()
---- {
---- long zero = (long) 0;
---- long min = (long) long.MinValue;
---- long max = (long) long.MaxValue;
----
---- Console.WriteLine ("Testing: long");
----
---- Console.WriteLine (" arg: int (long)");
----
---- receive_int (unchecked((int) zero));
---- receive_int (unchecked((int) min));
---- receive_int (unchecked((int) max));
---- Console.WriteLine (" arg: uint (long)");
----
---- receive_uint (unchecked((uint) zero));
---- receive_uint (unchecked((uint) min));
---- receive_uint (unchecked((uint) max));
---- Console.WriteLine (" arg: short (long)");
----
---- receive_short (unchecked((short) zero));
---- receive_short (unchecked((short) min));
---- receive_short (unchecked((short) max));
---- Console.WriteLine (" arg: ushort (long)");
----
---- receive_ushort (unchecked((ushort) zero));
---- receive_ushort (unchecked((ushort) min));
---- receive_ushort (unchecked((ushort) max));
---- Console.WriteLine (" arg: long (long)");
----
---- receive_long (unchecked((long) zero));
---- receive_long (unchecked((long) min));
---- receive_long (unchecked((long) max));
---- Console.WriteLine (" arg: ulong (long)");
----
---- receive_ulong (unchecked((ulong) zero));
---- receive_ulong (unchecked((ulong) min));
---- receive_ulong (unchecked((ulong) max));
---- Console.WriteLine (" arg: sbyte (long)");
----
---- receive_sbyte (unchecked((sbyte) zero));
---- receive_sbyte (unchecked((sbyte) min));
---- receive_sbyte (unchecked((sbyte) max));
---- Console.WriteLine (" arg: byte (long)");
----
---- receive_byte (unchecked((byte) zero));
---- receive_byte (unchecked((byte) min));
---- receive_byte (unchecked((byte) max));
---- Console.WriteLine (" arg: char (long)");
----
---- receive_char (unchecked((char) zero));
---- receive_char (unchecked((char) min));
---- receive_char (unchecked((char) max));
---- }
----
---- static void probe_ulong()
---- {
---- ulong zero = (ulong) 0;
---- ulong min = (ulong) ulong.MinValue;
---- ulong max = (ulong) ulong.MaxValue;
----
---- Console.WriteLine ("Testing: ulong");
----
---- Console.WriteLine (" arg: int (ulong)");
----
---- receive_int (unchecked((int) zero));
---- receive_int (unchecked((int) min));
---- receive_int (unchecked((int) max));
---- Console.WriteLine (" arg: uint (ulong)");
----
---- receive_uint (unchecked((uint) zero));
---- receive_uint (unchecked((uint) min));
---- receive_uint (unchecked((uint) max));
---- Console.WriteLine (" arg: short (ulong)");
----
---- receive_short (unchecked((short) zero));
---- receive_short (unchecked((short) min));
---- receive_short (unchecked((short) max));
---- Console.WriteLine (" arg: ushort (ulong)");
----
---- receive_ushort (unchecked((ushort) zero));
---- receive_ushort (unchecked((ushort) min));
---- receive_ushort (unchecked((ushort) max));
---- Console.WriteLine (" arg: long (ulong)");
----
---- receive_long (unchecked((long) zero));
---- receive_long (unchecked((long) min));
---- receive_long (unchecked((long) max));
---- Console.WriteLine (" arg: ulong (ulong)");
----
---- receive_ulong (unchecked((ulong) zero));
---- receive_ulong (unchecked((ulong) min));
---- receive_ulong (unchecked((ulong) max));
---- Console.WriteLine (" arg: sbyte (ulong)");
----
---- receive_sbyte (unchecked((sbyte) zero));
---- receive_sbyte (unchecked((sbyte) min));
---- receive_sbyte (unchecked((sbyte) max));
---- Console.WriteLine (" arg: byte (ulong)");
----
---- receive_byte (unchecked((byte) zero));
---- receive_byte (unchecked((byte) min));
---- receive_byte (unchecked((byte) max));
---- Console.WriteLine (" arg: char (ulong)");
----
---- receive_char (unchecked((char) zero));
---- receive_char (unchecked((char) min));
---- receive_char (unchecked((char) max));
---- }
----
---- static void probe_sbyte()
---- {
---- sbyte zero = (sbyte) 0;
---- sbyte min = (sbyte) sbyte.MinValue;
---- sbyte max = (sbyte) sbyte.MaxValue;
----
---- Console.WriteLine ("Testing: sbyte");
----
---- Console.WriteLine (" arg: int (sbyte)");
----
---- receive_int (unchecked((int) zero));
---- receive_int (unchecked((int) min));
---- receive_int (unchecked((int) max));
---- Console.WriteLine (" arg: uint (sbyte)");
----
---- receive_uint (unchecked((uint) zero));
---- receive_uint (unchecked((uint) min));
---- receive_uint (unchecked((uint) max));
---- Console.WriteLine (" arg: short (sbyte)");
----
---- receive_short (unchecked((short) zero));
---- receive_short (unchecked((short) min));
---- receive_short (unchecked((short) max));
---- Console.WriteLine (" arg: ushort (sbyte)");
----
---- receive_ushort (unchecked((ushort) zero));
---- receive_ushort (unchecked((ushort) min));
---- receive_ushort (unchecked((ushort) max));
---- Console.WriteLine (" arg: long (sbyte)");
----
---- receive_long (unchecked((long) zero));
---- receive_long (unchecked((long) min));
---- receive_long (unchecked((long) max));
---- Console.WriteLine (" arg: ulong (sbyte)");
----
---- receive_ulong (unchecked((ulong) zero));
---- receive_ulong (unchecked((ulong) min));
---- receive_ulong (unchecked((ulong) max));
---- Console.WriteLine (" arg: sbyte (sbyte)");
----
---- receive_sbyte (unchecked((sbyte) zero));
---- receive_sbyte (unchecked((sbyte) min));
---- receive_sbyte (unchecked((sbyte) max));
---- Console.WriteLine (" arg: byte (sbyte)");
----
---- receive_byte (unchecked((byte) zero));
---- receive_byte (unchecked((byte) min));
---- receive_byte (unchecked((byte) max));
---- Console.WriteLine (" arg: char (sbyte)");
----
---- receive_char (unchecked((char) zero));
---- receive_char (unchecked((char) min));
---- receive_char (unchecked((char) max));
---- }
----
---- static void probe_byte()
---- {
---- byte zero = (byte) 0;
---- byte min = (byte) byte.MinValue;
---- byte max = (byte) byte.MaxValue;
----
---- Console.WriteLine ("Testing: byte");
----
---- Console.WriteLine (" arg: int (byte)");
----
---- receive_int (unchecked((int) zero));
---- receive_int (unchecked((int) min));
---- receive_int (unchecked((int) max));
---- Console.WriteLine (" arg: uint (byte)");
----
---- receive_uint (unchecked((uint) zero));
---- receive_uint (unchecked((uint) min));
---- receive_uint (unchecked((uint) max));
---- Console.WriteLine (" arg: short (byte)");
----
---- receive_short (unchecked((short) zero));
---- receive_short (unchecked((short) min));
---- receive_short (unchecked((short) max));
---- Console.WriteLine (" arg: ushort (byte)");
----
---- receive_ushort (unchecked((ushort) zero));
---- receive_ushort (unchecked((ushort) min));
---- receive_ushort (unchecked((ushort) max));
---- Console.WriteLine (" arg: long (byte)");
----
---- receive_long (unchecked((long) zero));
---- receive_long (unchecked((long) min));
---- receive_long (unchecked((long) max));
---- Console.WriteLine (" arg: ulong (byte)");
----
---- receive_ulong (unchecked((ulong) zero));
---- receive_ulong (unchecked((ulong) min));
---- receive_ulong (unchecked((ulong) max));
---- Console.WriteLine (" arg: sbyte (byte)");
----
---- receive_sbyte (unchecked((sbyte) zero));
---- receive_sbyte (unchecked((sbyte) min));
---- receive_sbyte (unchecked((sbyte) max));
---- Console.WriteLine (" arg: byte (byte)");
----
---- receive_byte (unchecked((byte) zero));
---- receive_byte (unchecked((byte) min));
---- receive_byte (unchecked((byte) max));
---- Console.WriteLine (" arg: char (byte)");
----
---- receive_char (unchecked((char) zero));
---- receive_char (unchecked((char) min));
---- receive_char (unchecked((char) max));
---- }
----
---- static void probe_char()
---- {
---- char zero = (char) 0;
---- char min = (char) char.MinValue;
---- char max = (char) char.MaxValue;
----
---- Console.WriteLine ("Testing: char");
----
---- Console.WriteLine (" arg: int (char)");
----
---- receive_int (unchecked((int) zero));
---- receive_int (unchecked((int) min));
---- receive_int (unchecked((int) max));
---- Console.WriteLine (" arg: uint (char)");
----
---- receive_uint (unchecked((uint) zero));
---- receive_uint (unchecked((uint) min));
---- receive_uint (unchecked((uint) max));
---- Console.WriteLine (" arg: short (char)");
----
---- receive_short (unchecked((short) zero));
---- receive_short (unchecked((short) min));
---- receive_short (unchecked((short) max));
---- Console.WriteLine (" arg: ushort (char)");
----
---- receive_ushort (unchecked((ushort) zero));
---- receive_ushort (unchecked((ushort) min));
---- receive_ushort (unchecked((ushort) max));
---- Console.WriteLine (" arg: long (char)");
----
---- receive_long (unchecked((long) zero));
---- receive_long (unchecked((long) min));
---- receive_long (unchecked((long) max));
---- Console.WriteLine (" arg: ulong (char)");
----
---- receive_ulong (unchecked((ulong) zero));
---- receive_ulong (unchecked((ulong) min));
---- receive_ulong (unchecked((ulong) max));
---- Console.WriteLine (" arg: sbyte (char)");
----
---- receive_sbyte (unchecked((sbyte) zero));
---- receive_sbyte (unchecked((sbyte) min));
---- receive_sbyte (unchecked((sbyte) max));
---- Console.WriteLine (" arg: byte (char)");
----
---- receive_byte (unchecked((byte) zero));
---- receive_byte (unchecked((byte) min));
---- receive_byte (unchecked((byte) max));
---- Console.WriteLine (" arg: char (char)");
----
---- receive_char (unchecked((char) zero));
---- receive_char (unchecked((char) min));
---- receive_char (unchecked((char) max));
---- }
----
---- static void Main ()
---- {
---- probe_int ();
---- probe_uint ();
---- probe_short ();
---- probe_ushort ();
---- probe_long ();
---- probe_ulong ();
---- probe_sbyte ();
---- probe_byte ();
---- probe_char ();
---- }
----}
----
+++ /dev/null
----using System;
----using System.Reflection;
----using System.ComponentModel;
----
----[assembly: CLSCompliant(true)]
----[assembly: AssemblyTitle("")]
----
----public class CLSCLass_6 {
---- private object disposedEvent = new object ();
---- public EventHandlerList event_handlers;
----
---- public event Delegate Disposed {
---- add { event_handlers.AddHandler (disposedEvent, value); }
---- remove { event_handlers.RemoveHandler (disposedEvent, value); }
---- }
----}
----
----public delegate CLSDelegate Delegate ();
----
----[Serializable]
----public class CLSDelegate {
----}
----
----internal class CLSClass_5 {
---- [CLSCompliant (true)]
---- public uint Test () {
---- return 1;
---- }
----}
----
----[CLSCompliant (true)]
----public class CLSClass_4 {
---- [CLSCompliant (false)]
---- public uint Test () {
---- return 1;
---- }
----}
----
----public class CLSClass_3 {
---- [CLSCompliant (false)]
---- public uint Test_3 () {
---- return 6;
---- }
----}
----
----[CLSCompliant(false)]
----public class CLSClass_2 {
---- public sbyte XX {
---- get { return -1; }
---- }
----}
----
----class CLSClass_1 {
---- public UInt32 Valid() {
---- return 5;
---- }
----}
----
----[CLSCompliant(true)]
----public class CLSClass {
----
---- private class C1 {
----
---- [CLSCompliant(true)]
---- public class C11 {
---- protected ulong Foo3() {
---- return 1;
---- }
---- }
----
---- protected long Foo2() {
---- return 1;
---- }
---- }
----
---- [CLSCompliant(false)]
---- protected internal class CLSClass_2 {
---- public sbyte XX {
---- get { return -1; }
---- }
---- }
----
----
---- [CLSCompliant(true)]
---- private ulong Valid() {
---- return 1;
---- }
----
---- [CLSCompliant(true)]
---- public byte XX {
---- get { return 5; }
---- }
----
----// protected internal sbyte FooProtectedInternal() {
----// return -4;
----// }
----
---- internal UInt32 FooInternal() {
---- return 1;
---- }
----
---- private ulong Foo() {
---- return 1;
---- }
----
----
---- public static void Main() {}
----}
+++ /dev/null
----using System;
----
----public class CLSClass {
----
---- public byte XX {
---- get { return 5; }
---- }
----
---- public static void Main() {}
----}
+++ /dev/null
----using System;
----[assembly:CLSCompliant (true)]
----
----[CLSCompliant (false)]
----public interface I {
---- [CLSCompliant (false)]
---- void Error (ulong arg);
----}
----
----[CLSCompliant (false)]
----public interface I2 {
---- [CLSCompliant (true)]
---- void Error (long arg);
----}
----
----
----public class MainClass {
---- public static void Main () {
---- }
----}
+++ /dev/null
----using System;
----[assembly:CLSCompliant (true)]
----
----[CLSCompliant (true)]
----public abstract class CLSClass {
---- [CLSCompliant (true)]
---- public abstract void Test (IComparable arg);
----}
----
----public abstract class CLSCLass_2 {
---- public abstract void Test ();
----}
----
----public class MainClass {
---- public static void Main () {
---- }
----}
+++ /dev/null
----using System;
----
----[module: CLSCompliant(true)]
----[assembly: CLSCompliant(true)]
----
----public class MainClass {
---- public static void Main () {
---- }
----}
+++ /dev/null
----using System;
----
----public class CLSClass {
---- [CLSCompliant (false)]
---- static public implicit operator CLSClass(byte value) {
---- return new CLSClass();
---- }
----
---- [CLSCompliant (true)]
---- private void Error (bool arg) {
---- }
----}
----
----public class MainClass {
---- public static void Main () {
---- }
----}
+++ /dev/null
----using System;
----[assembly:CLSCompliant (true)]
----
----public class CLSAttribute_1: Attribute {
---- public CLSAttribute_1(int[] array) {
---- }
----
---- public CLSAttribute_1(int array) {
---- }
----}
----
----[CLSCompliant (false)]
----public class CLSAttribute_2: Attribute {
---- private CLSAttribute_2(int arg) {
---- }
----}
----
----internal class CLSAttribute_3: Attribute {
---- public CLSAttribute_3(int[] array) {
---- }
----}
----
----[CLSCompliant (false)]
----public class CLSAttribute_4: Attribute {
---- private CLSAttribute_4(int[] args) {
---- }
----}
----
----public class ClassMain {
---- public static void Main () {}
----}
+++ /dev/null
----using System;
----[assembly:CLSCompliant (true)]
----
----[CLSCompliant (false)]
----[CLSAttribute (new bool [] {true, false})]
----public class CLSAttribute: Attribute {
---- public CLSAttribute(bool[] array) {
---- }
----}
----
----public class ClassMain {
---- public static void Main () {}
----}
+++ /dev/null
----using System;
----using System.Reflection;
----
----[assembly: CLSCompliant (true)]
----
----public class CLSClass {
---- [CLSCompliant(false)]
---- public CLSClass(ulong l) {}
---- internal CLSClass(uint i) {}
----
---- [CLSCompliant(false)]
---- public ulong X_0 {
---- set {}
---- }
----
---- [CLSCompliant(false)]
---- protected ulong this[ulong i] {
---- set {}
---- }
----
---- [CLSCompliant(false)]
---- public ulong X_1;
----
---- internal ulong X_2;
----
---- public static void Main() {
---- }
----}
----public class InnerTypeClasss {
---- public struct Struct {
---- }
----
---- public Struct Method () {
---- return new Struct ();
---- }
----}
+++ /dev/null
----using System;
----[assembly:CLSCompliant(true)]
----
----public interface I1 {
----}
----
----public class CLSClass {
---- protected internal I1 Foo() {
---- return null;
---- }
----
---- static void Main() {}
----}
+++ /dev/null
----using System;
----
----[assembly:CLSCompliant(true)]
----
----class X1 {
---- public bool AA;
---- internal bool aa;
----}
----
----class X2: X1 {
---- public bool aA;
----}
----
----public class X3 {
---- internal void bb(bool arg) {}
---- internal bool bB;
---- public void BB() {}
----}
----
----class X4 {
---- public void method(int arg) {}
---- public void method(bool arg) {}
---- public bool method() { return false; }
----}
----
----
----public class BaseClass {
---- //protected internal bool mEthod() { return false; }
----}
----
----public class CLSClass: BaseClass {
---- public CLSClass() {}
---- public CLSClass(int arg) {}
----
---- //public int this[int index] { set {} }
---- //protected int this[bool index] { set {} }
----
---- public bool setItem;
---- static public implicit operator CLSClass(bool value) {
---- return new CLSClass(2);
---- }
----
---- static public implicit operator CLSClass(int value) {
---- return new CLSClass(2);
---- }
----
---- [CLSCompliant(false)]
---- public void Method() {}
----
---- internal int Method(bool arg) { return 1; }
---- internal void methoD() {}
----
---- public static void Main() {}
----}
----
----public class oBject: Object {
----}
----
----namespace A {
---- public class C1 {
---- }
----}
----
----namespace B {
---- public class c1 {
---- }
----}
----
----public class c1 {
----}
----// Test
----[System.CLSCompliant (false)]
----public interface I1 {
----}
----
----public interface i1 {
----}
----
----// Test
----enum AB {
----}
----
----[CLSCompliant (false)]
----public enum aB {
----}
----
----public interface ab {
----}
----
----// Test
----public class CLSClass_2 {
---- [CLSCompliant (false)]
---- public void Method () {}
---- public void method () {}
----}
----
----// Test
----namespace System {
---- public class sByte {
---- }
----}
+++ /dev/null
----using System;
----
----[assembly:CLSCompliant(true)]
----
----[CLSCompliant(false)]
----public delegate uint MyDelegate();
----
----[CLSCompliant(false)]
----public interface IFake {
---- [CLSCompliant(true)]
---- long AA(long arg);
---- [CLSCompliant(false)]
---- ulong BB { get; }
---- //[CLSCompliant(false)]
---- //sbyte this[ulong I] { set; }
---- [CLSCompliant(false)]
---- event MyDelegate MyEvent;
----}
----
----[CLSCompliant(false)]
----internal interface I {
---- [CLSCompliant(false)]
---- void Foo();
----
---- [CLSCompliant(true)]
---- ulong this[int indexA] { set; }
----}
----
----interface I2 {
---- int Test(int arg1, bool arg2);
----}
----
----public class CLSClass {
---- [CLSCompliant(false)]
---- public delegate uint MyDelegate();
----
---- public static void Main() {}
----}
----public class CLSClass_2 {
---- [CLSCompliant (false)]
---- public CLSClass_2(int[,,] b) {
---- }
----
---- public CLSClass_2(int[,] b) {
---- }
----
---- public void Test (int[,] b, int i) {}
---- public void Test (int[,,] b, bool b2) {}
----}
----
----public class X1 {
---- [CLSCompliant (false)]
---- public void M2 (int i) {}
----}
----
----public class X2: X1 {
---- public void M2 (ref int i) {}
----}
+++ /dev/null
----using System;
----
----[assembly:CLSCompliant(true)]
----
----namespace aa {
---- public class I1 {
---- }
----}
----
----namespace bb {
---- public interface i1 {
---- }
----}
----
----public class CLSClass {
---- public static void Main() {}
----}
+++ /dev/null
----class X {\r
---- const int x = 1;\r
---- const string s = "Hello";\r
----}\r
+++ /dev/null
----#define DEBUG
----
----using System;
----using System.Diagnostics;
----
----[Conditional("DEBUG")]
----public class TestAttribute : Attribute {}
----
----[Conditional("RELEASE")]
----public class TestNotAttribute : Attribute {}
----
----[Conditional("A")]
----[Conditional("DEBUG")]
----[Conditional("B")]
----public class TestMultiAttribute : Attribute {}
----
----// TestAttribute is included
----[Test]
----class Class1 {}
----
----// TestNotAttribute is not included
----[TestNot]
----class Class2 {}
----
----// Is included
----[TestMulti]
----class Class3 {}
----
----
----public class TestClass
----{
---- public static int Main ()
---- {
---- if (Attribute.GetCustomAttributes (typeof (Class1)).Length != 1)
---- return 1;
----
---- if (Attribute.GetCustomAttributes (typeof (Class2)).Length != 0)
---- return 1;
----
---- if (Attribute.GetCustomAttributes (typeof (Class3)).Length != 1)
---- return 1;
----
---- Console.WriteLine ("OK");
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -t:library
----
----public class A
----{
---- public static bool operator==(A a1, A a2)
---- {
---- return true;
---- }
----
---- public static bool operator!=(A a1, A a2)
---- {
---- return false;
---- }
----
---- public override bool Equals (object o)
---- {
---- return true;
---- }
----
---- public override int GetHashCode ()
---- {
---- return base.GetHashCode ();
---- }
----
---- public int KK () { return 1; }
----}
----
----public class B : A {
----}
----
+++ /dev/null
----// Compiler options: -r:conv-dll.dll
----
----public class MainClass
----{
---- public static int Main ()
---- {
---- A a = new A ();
---- B b = new B ();
---- bool r = (a == b);
----
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -langversion:default
----// Test for covariance support in delegates
----//
----
----using System;
----
---- public class A {
---- protected string name;
----
---- public A (string name)
---- {
---- this.name = "A::" + name;
---- }
----
---- public A ()
---- {
---- }
----
---- public string Name {
---- get {
---- return name;
---- }
---- }
---- }
----
---- public class B : A {
---- public B (string name)
---- {
---- this.name = "B::" + name;
---- }
----
---- public B ()
---- {
---- }
---- }
----
---- public class C : B {
---- public C (string name)
---- {
---- this.name = "C::" + name;
---- }
---- }
----
---- public class Tester {
----
---- delegate A MethodHandler (string name);
----
---- static A MethodSampleA (string name)
---- {
---- return new A (name);
---- }
----
---- static B MethodSampleB (string name)
---- {
---- return new B (name);
---- }
----
---- static C MethodSampleC (string name)
---- {
---- return new C (name);
---- }
----
---- static void Main ()
---- {
---- MethodHandler a = MethodSampleA;
---- MethodHandler b = MethodSampleB;
---- MethodHandler c = MethodSampleC;
----
---- A instance1 = a ("Hello");
---- A instance2 = b ("World");
---- A instance3 = c ("!");
----
---- Console.WriteLine (instance1.Name);
---- Console.WriteLine (instance2.Name);
---- Console.WriteLine (instance3.Name);
---- }
----
---- }
----
+++ /dev/null
----// Compiler options: -langversion:default
----//
----// Test for contravariance support in delegates
----//
----
----using System;
----
---- public class A {
---- protected string name;
----
---- public A (string name)
---- {
---- this.name = "A::" + name;
---- }
----
---- public A ()
---- {
---- }
----
---- public string Name {
---- get {
---- return name;
---- }
---- }
---- }
----
---- public class B : A {
---- public B (string name)
---- {
---- this.name = "B::" + name;
---- }
----
---- public B ()
---- {
---- }
---- }
----
---- public class C : B {
---- string value;
----
---- public C (string name, string value)
---- {
---- this.name = "C::" + name;
---- this.value = value;
---- }
----
---- public string Value {
---- get {
---- return value;
---- }
---- }
---- }
----
---- public class Tester {
----
---- delegate string MethodHandler (C c);
----
---- static string MethodSampleA (A value)
---- {
---- return value.Name;
---- }
----
---- static string MethodSampleB (B value)
---- {
---- return value.Name;
---- }
----
---- static string MethodSampleC (C value)
---- {
---- return value.Name + " " + value.Value;
---- }
----
---- static void Main ()
---- {
---- MethodHandler da = MethodSampleA;
---- MethodHandler db = MethodSampleB;
---- MethodHandler dc = MethodSampleC;
----
---- C a = new C ("Hello", "hello");
---- C b = new C ("World", "world");
---- C c = new C ("!", "!!!");
----
---- Console.WriteLine (da (a));
---- Console.WriteLine (db (b));
---- Console.WriteLine (dc (c));
---- }
----
---- }
----
+++ /dev/null
----// Compiler options: -langversion:default
----//
----// Test for contravariance support in delegates
----//
----
----using System;
----
---- public class A {
---- protected string name;
----
---- public A (string name)
---- {
---- this.name = "A::" + name;
---- }
----
---- public A ()
---- {
---- }
----
---- public string Name {
---- get {
---- return name;
---- }
---- }
---- }
----
---- public class B : A {
---- public B (string name)
---- {
---- this.name = "B::" + name;
---- }
----
---- public B ()
---- {
---- }
---- }
----
---- public class C : B {
---- string value;
----
---- public C (string name, string value)
---- {
---- this.name = "C::" + name;
---- this.value = value;
---- }
----
---- public string Value {
---- get {
---- return value;
---- }
---- }
---- }
----
---- public class Tester {
----
---- delegate void MethodHandler (C c1, C c2, C c3);
----
---- static void MethodSample (B b, A a, C c)
---- {
---- Console.WriteLine ("b = {0}", b.Name);
---- Console.WriteLine ("a = {0}", a.Name);
---- Console.WriteLine ("c = {0}, {1}", c.Name, c.Value);
---- }
----
---- static void Main ()
---- {
---- MethodHandler mh = MethodSample;
----
---- C a = new C ("Hello", "hello");
---- C b = new C ("World", "world");
---- C c = new C ("!", "!!!");
----
---- mh (b, a, c);
---- }
----
---- }
----
+++ /dev/null
----class X {\r
----}\r
----\r
----struct Y {\r
----}\r
+++ /dev/null
----// Compiler options: -t:library -unsafe
----
----public unsafe struct ExternalStruct
----{
---- public fixed double double_buffer [4];
----}
+++ /dev/null
----// Compiler options: -unsafe -r:fixed-buffer-dll.dll
----
----using System;
----
----public unsafe struct TestNew {
---- private fixed char test_1 [128];
---- public fixed bool test2 [4];
----
---- public fixed int T [2];
---- public fixed bool test20 [4], test21 [40];
----
---- private int foo, foo2;
---- public void SetTest () {
---- fixed (char* c = test_1) {
---- *c = 'g';
---- }
---- }
----}
----
----public class C {
---- unsafe static int Test () {
---- TestNew tt = new TestNew ();
---- tt.SetTest ();
---- tt.test2 [2] = false;
---- tt.T [1] = 5544;
---- if (tt.T [1] != 5544)
---- return 2;
----
---- ExternalStruct es = new ExternalStruct ();
---- es.double_buffer [1] = 999999.8888;
---- es.double_buffer [0] = es.double_buffer [1];
----
---- // Attributes test
---- if (Attribute.GetCustomAttribute (typeof (TestNew).GetField ("test2"), typeof (System.Runtime.CompilerServices.FixedBufferAttribute)) == null)
---- return 3;
----
----
---- if (typeof (TestNew).GetNestedTypes ().Length != 5)
---- return 5;
----
---- foreach (Type t in typeof (TestNew).GetNestedTypes ()) {
---- if (Attribute.GetCustomAttribute (t, typeof (System.Runtime.CompilerServices.CompilerGeneratedAttribute)) == null)
---- return 4;
---- }
----
---- Console.WriteLine ("OK");
---- return 0;
---- }
----
---- public static int Main () {
---- return Test ();
---- }
----}
+++ /dev/null
----class Stack < type > {
----
----}
----
----class Boot {
---- static void Main ()
---- {
---- }
----}
+++ /dev/null
----// Type parameters with constraints: check whether we can invoke
----// things on the constrained type.
----
----using System;
----
----interface I
----{
---- void Hello ();
----}
----
----class J
----{
---- public void Foo ()
---- {
---- Console.WriteLine ("Foo!");
---- }
----}
----
----class Stack<T>
---- where T : J, I
----{
---- public void Test (T t)
---- {
---- t.Hello ();
---- t.Foo ();
---- }
----}
----
----class Test
----{
----}
----
----class X
----{
---- static void Main()
---- {
---- }
----}
+++ /dev/null
----using System;
----
----// Runtime test for mono_class_setup_vtable()
----namespace C5
----{
---- public interface ICollection<T>
---- {
---- void Test<U> ();
---- }
----
---- public abstract class ArrayBase<T> : ICollection<T>
---- {
---- void ICollection<T>.Test<U> ()
---- { }
---- }
----
---- public class ArrayList<V> : ArrayBase<V>
---- {
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- C5.ArrayList<int> array = new C5.ArrayList<int> ();
---- }
----}
+++ /dev/null
----using System;
----
----public class Test
----{
---- static void Main ()
---- {
---- SimpleStruct <string> s = new SimpleStruct <string> ();
---- }
----}
----
----public struct SimpleStruct <T>
----{
---- T data;
----
---- public SimpleStruct (T data)
---- {
---- this.data = data;
---- }
----}
+++ /dev/null
----using System;
----
----class A<T>
---- where T: IComparable
----{
----}
----
----class B<U,V>
---- where U: IComparable
---- where V: A<U>
----{
----}
----
----class Driver
----{
---- public static void Main ()
---- {
---- A<int> a_int;
---- B<int,A<int>> b_stuff;
---- }
----}
+++ /dev/null
----public interface IFoo<T>
----{ }
----
----public class Foo : IFoo<string>
----{ }
----
----public class Hello
----{
---- public void World<U> (U u, IFoo<U> foo)
---- { }
----
---- public void World<V> (IFoo<V> foo)
---- { }
----
---- public void Test (Foo foo)
---- {
---- World ("Canada", foo);
---- World (foo);
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- }
----}
+++ /dev/null
----class MainClass
----{
---- class Gen<T>
---- {
---- public void Test ()
---- { }
---- }
----
---- class Der : Gen<int>
---- {
---- }
----
---- static void Main ()
---- {
---- object o = new Der ();
---- Gen<int> b = (Gen<int>) o;
---- b.Test ();
---- }
----}
----
+++ /dev/null
----namespace A
----{
---- public struct KeyValuePair<X,Y>
---- {
---- public KeyValuePair (X x, Y y)
---- { }
---- }
----
---- public interface IComparer<T>
---- {
---- int Compare (T x);
---- }
----
---- public class KeyValuePairComparer<K,V> : IComparer<KeyValuePair<K,V>>
---- {
---- public int Compare (KeyValuePair<K,V> a)
---- {
---- return 0;
---- }
---- }
----
---- public class TreeBag<T>
---- {
---- IComparer<T> comparer;
----
---- public TreeBag (IComparer<T> comparer)
---- {
---- this.comparer = comparer;
---- }
----
---- public int Find (ref T item)
---- {
---- return comparer.Compare (item);
---- }
---- }
----
---- public class X
---- {
---- public static void Test ()
---- {
---- KeyValuePair<int,int> pair = new KeyValuePair<int,int> (3, 89);
---- KeyValuePairComparer<int,int> comparer = new KeyValuePairComparer<int,int> ();
---- TreeBag<KeyValuePair<int,int>> bag = new TreeBag<KeyValuePair<int,int>> (comparer);
---- bag.Find (ref pair);
---- }
---- }
----}
----
----namespace B
----{
---- public class KeyValuePair<X,Y>
---- {
---- public KeyValuePair (X x, Y y)
---- { }
---- }
----
---- public interface IComparer<T>
---- {
---- int Compare (T x);
---- }
----
---- public class KeyValuePairComparer<K,V> : IComparer<KeyValuePair<K,V>>
---- {
---- public int Compare (KeyValuePair<K,V> a)
---- {
---- return 0;
---- }
---- }
----
---- public class TreeBag<T>
---- {
---- IComparer<T> comparer;
----
---- public TreeBag (IComparer<T> comparer)
---- {
---- this.comparer = comparer;
---- }
----
---- public int Find (ref T item)
---- {
---- return comparer.Compare (item);
---- }
---- }
----
---- public class X
---- {
---- public static void Test ()
---- {
---- KeyValuePair<int,int> pair = new KeyValuePair<int,int> (3, 89);
---- KeyValuePairComparer<int,int> comparer = new KeyValuePairComparer<int,int> ();
---- TreeBag<KeyValuePair<int,int>> bag = new TreeBag<KeyValuePair<int,int>> (comparer);
---- bag.Find (ref pair);
---- }
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- A.X.Test ();
---- B.X.Test ();
---- }
----}
+++ /dev/null
----public struct KeyValuePair<X,Y>
----{
---- public KeyValuePair (X x, Y y)
---- { }
----}
----
----public interface IComparer<T>
----{
---- int Compare (T x);
----}
----
----public class KeyValuePairComparer<K,V> : IComparer<KeyValuePair<K,V>>
----{
---- public int Compare (KeyValuePair<K,V> a)
---- {
---- return 0;
---- }
----}
----
----public class TreeBag<T>
----{
---- IComparer<T> comparer;
---- T item;
----
---- public TreeBag (IComparer<T> comparer, T item)
---- {
---- this.comparer = comparer;
---- this.item = item;
---- }
----
---- public int Find ()
---- {
---- return comparer.Compare (item);
---- }
----}
----
----public class X
----{
---- public static void Main ()
---- {
---- KeyValuePair<int,int> pair = new KeyValuePair<int,int> (3, 89);
---- KeyValuePairComparer<int,int> comparer = new KeyValuePairComparer<int,int> ();
---- TreeBag<KeyValuePair<int,int>> bag = new TreeBag<KeyValuePair<int,int>> (comparer, pair);
---- bag.Find ();
---- }
----}
+++ /dev/null
----using System;
----
----public delegate V Mapper<T,V> (T item);
----
----public interface ITree<T>
----{
---- void Map<V> (Mapper<T,V> mapper);
----}
----
----public class Tree<T> : ITree<T>
----{
---- T item;
----
---- public Tree (T item)
---- {
---- this.item = item;
---- }
----
---- public void Map<V> (Mapper<T,V> mapper)
---- {
---- V new_item = mapper (item);
---- }
----}
----
----class X
----{
---- private string themap (int i)
---- {
---- return String.Format ("AA {0,4} BB", i);
---- }
----
---- void Test ()
---- {
---- Tree<int> tree = new Tree<int> (3);
---- tree.Map (new Mapper<int,string> (themap));
---- }
----
---- static void Main ()
---- {
---- X x = new X ();
---- x.Test ();
---- }
----}
+++ /dev/null
----using System;
----using System.Collections.Generic;
----
----public class Test<T>
----{
---- protected T item;
----
---- public Test (T item)
---- {
---- this.item = item;
---- }
----
---- public IEnumerator<T> GetEnumerator()
---- {
---- yield return item;
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Test<int> test = new Test<int> (3);
---- foreach (int a in test)
---- ;
---- }
----}
+++ /dev/null
----using System;
----
----class X {
---- static void Main ()
---- {
---- int [] foo = null;
---- Array.Resize (ref foo, 10);
---- }
----}
+++ /dev/null
----class Stack<S>
----{
---- public void Hello (S s)
---- { }
----}
----
----class X
----{
---- Stack<int> stack;
----
---- void Test ()
---- {
---- stack.Hello (3);
---- }
----
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----public interface IList<R>
----{
---- int Map<S> (S item);
----}
----
----public class List<T> : IList<T>
----{
---- public int Map<U> (U item)
---- {
---- return 1;
---- }
----}
----
----public class SpecialList<V> : IList<V>
----{
---- public int Map<W> (W item)
---- {
---- return 2;
---- }
----}
----
----class X
----{
---- static int Main ()
---- {
---- IList<int> list = new List<int> ();
---- int result = list.Map ("Hello");
---- if (result != 1)
---- return 1;
----
---- IList<int> list2 = new SpecialList<int> ();
---- int result2 = list2.Map ("World");
---- if (result2 != 2)
---- return 2;
----
---- return 0;
---- }
----}
+++ /dev/null
----using System;
----
----public struct KeyValuePair<K,V>
----{
---- public K key;
---- public V value;
----
---- public KeyValuePair(K k, V v) { key = k; value = v; }
----
---- public KeyValuePair(K k) { key = k; value = default(V); }
----}
----
----public class Collection<T>
----{
---- public readonly T Item;
----
---- public Collection (T item)
---- {
---- this.Item = item;
---- }
----
---- public void Find (ref T item)
---- {
---- item = Item;
---- }
----}
----
----class X
----{
---- static int Main ()
---- {
---- KeyValuePair<int,long> p = new KeyValuePair<int,long> (3);
---- KeyValuePair<int,long> q = new KeyValuePair<int,long> (5, 9);
----
---- Collection<KeyValuePair<int,long>> c = new Collection<KeyValuePair<int,long>> (q);
---- c.Find (ref p);
----
---- if (p.key != 5)
---- return 1;
---- if (p.value != 9)
---- return 2;
----
---- return 0;
---- }
----}
+++ /dev/null
----using System;
----
----public interface IComparer<T>
----{
---- void Compare (T a);
----}
----
----class IC : IComparer<Foo<int>>
----{
---- public void Compare (Foo<int> a)
---- { }
----}
----
----public struct Foo<K>
----{
---- public K Value;
----
---- public Foo (K value)
---- {
---- Value = value;
---- }
----}
----
----public class List<T>
----{
---- public virtual void Sort (IComparer<T> c, T t)
---- {
---- Sorting.IntroSort<T> (c, t);
---- }
----}
----
----public class Sorting
----{
---- public static void IntroSort<T> (IComparer<T> c, T t)
---- {
---- new Sorter<T> (c, 4, t).InsertionSort (0);
---- }
----
---- class Sorter<T>
---- {
---- IComparer<T> c;
---- T[] a;
----
---- public Sorter (IComparer<T> c, int size, T item)
---- {
---- this.c = c;
---- a = new T [size];
---- }
----
---- internal void InsertionSort (int i)
---- {
---- T other;
---- c.Compare (other = a[i]);
---- }
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- List<Foo<int>> list = new List<Foo<int>> ();
---- Foo<int> foo = new Foo<int> (3);
---- list.Sort (new IC (), foo);
---- }
----}
+++ /dev/null
----using System;
----
----public delegate V Mapper<T,V> (T item);
----
----public class List<T>
----{
---- public void Map<V> (Mapper<T,V> mapper)
---- { }
----}
----
----class X
----{
---- static void Main ()
---- {
---- List<int> list = new List<int> ();
---- list.Map (new Mapper<int,double> (delegate (int i) { return i/10.0; }));
---- }
----}
----
+++ /dev/null
----using System;
----using System.Collections.Generic;
----
----public class NaturalComparer<T> : IComparer<T>
---- where T: IComparable<T>
----{
---- public int Compare (T a, T b)
---- {
---- return a.CompareTo (b);
---- }
----}
----
----public class X
----{
---- class Test : IComparable<Test>
---- {
---- public int CompareTo (Test that)
---- {
---- return 0;
---- }
----
---- public bool Equals (Test that)
---- {
---- return false;
---- }
---- }
----
---- static void Main ()
---- {
---- IComparer<Test> cmp = new NaturalComparer<Test> ();
---- Test a = new Test ();
---- Test b = new Test ();
---- cmp.Compare (a, b);
---- }
----}
+++ /dev/null
----//-- ex-gen-class-linkedlist
----//-- ex-anonymous-method-linkedlist
----//-- ex-gen-printable
----//-- ex-gen-interface-ilist
----//-- ex-gen-linkedlist-map
----//-- ex-gen-linkedlistenumerator
----//-- ex-gen-delegate-fun
----
----// A generic LinkedList class
----
----using System;
----using System.IO; // TextWriter
----using System.Collections;
----using System.Collections.Generic; // IEnumerable<T>, IEnumerator<T>
----
----public delegate R Mapper<A,R>(A x);
----
----public interface IMyList<T> : IEnumerable<T> {
---- int Count { get; } // Number of elements
---- T this[int i] { get; set; } // Get or set element at index i
---- void Add(T item); // Add element at end
---- void Insert(int i, T item); // Insert element at index i
---- void RemoveAt(int i); // Remove element at index i
---- IMyList<U> Map<U>(Mapper<T,U> f); // Map f over all elements
----}
----
----public class LinkedList<T> : IMyList<T> {
---- protected int size; // Number of elements in the list
---- protected Node first, last; // Invariant: first==null iff last==null
----
---- protected class Node {
---- public Node prev, next;
---- public T item;
----
---- public Node(T item) {
---- this.item = item;
---- }
----
---- public Node(T item, Node prev, Node next) {
---- this.item = item; this.prev = prev; this.next = next;
---- }
---- }
----
---- public LinkedList() {
---- first = last = null;
---- size = 0;
---- }
----
---- public LinkedList(params T[] arr) : this() {
---- foreach (T x in arr)
---- Add(x);
---- }
----
---- public int Count {
---- get { return size; }
---- }
----
---- public T this[int i] {
---- get { return get(i).item; }
---- set { get(i).item = value; }
---- }
----
---- private Node get(int n) {
---- if (n < 0 || n >= size)
---- throw new IndexOutOfRangeException();
---- else if (n < size/2) { // Closer to front
---- Node node = first;
---- for (int i=0; i<n; i++)
---- node = node.next;
---- return node;
---- } else { // Closer to end
---- Node node = last;
---- for (int i=size-1; i>n; i--)
---- node = node.prev;
---- return node;
---- }
---- }
----
---- public void Add(T item) {
---- Insert(size, item);
---- }
----
---- public void Insert(int i, T item) {
---- if (i == 0) {
---- if (first == null) // and thus last == null
---- first = last = new Node(item);
---- else {
---- Node tmp = new Node(item, null, first);
---- first.prev = tmp;
---- first = tmp;
---- }
---- size++;
---- } else if (i == size) {
---- if (last == null) // and thus first = null
---- first = last = new Node(item);
---- else {
---- Node tmp = new Node(item, last, null);
---- last.next = tmp;
---- last = tmp;
---- }
---- size++;
---- } else {
---- Node node = get(i);
---- // assert node.prev != null;
---- Node newnode = new Node(item, node.prev, node);
---- node.prev.next = newnode;
---- node.prev = newnode;
---- size++;
---- }
---- }
----
---- public void RemoveAt(int i) {
---- Node node = get(i);
---- if (node.prev == null)
---- first = node.next;
---- else
---- node.prev.next = node.next;
---- if (node.next == null)
---- last = node.prev;
---- else
---- node.next.prev = node.prev;
---- size--;
---- }
----
---- public override bool Equals(Object that) {
---- if (that != null && GetType() == that.GetType()
---- && this.size == ((IMyList<T>)that).Count) {
---- Node thisnode = this.first;
---- IEnumerator<T> thatenm = ((IMyList<T>)that).GetEnumerator();
---- while (thisnode != null) {
---- if (!thatenm.MoveNext())
---- throw new ApplicationException("Impossible: LinkedList<T>.Equals");
---- // assert MoveNext() was true (because of the above size test)
---- if (!thisnode.item.Equals(thatenm.Current))
---- return false;
---- thisnode = thisnode.next;
---- }
---- // assert !MoveNext(); // because of the size test
---- return true;
---- } else
---- return false;
---- }
----
---- public override int GetHashCode() {
---- int hash = 0;
---- foreach (T x in this)
---- hash ^= x.GetHashCode();
---- return hash;
---- }
----
---- public static explicit operator LinkedList<T>(T[] arr) {
---- return new LinkedList<T>(arr);
---- }
----
---- public static LinkedList<T> operator +(LinkedList<T> xs1, LinkedList<T> xs2) {
---- LinkedList<T> res = new LinkedList<T>();
---- foreach (T x in xs1)
---- res.Add(x);
---- foreach (T x in xs2)
---- res.Add(x);
---- return res;
---- }
----
---- public IMyList<U> Map<U>(Mapper<T,U> f) {
---- LinkedList<U> res = new LinkedList<U>();
---- foreach (T x in this)
---- res.Add(f(x));
---- return res;
---- }
----
---- public IEnumerator<T> GetEnumerator() {
---- return new LinkedListEnumerator(this);
---- }
----
---- IEnumerator IEnumerable.GetEnumerator() {
---- return new LinkedListEnumerator(this);
---- }
----
---- private class LinkedListEnumerator : IEnumerator<T> {
---- T curr; // The enumerator's current element
---- bool valid; // Is the current element valid?
---- Node next; // Node holding the next element, or null
----
---- public LinkedListEnumerator(LinkedList<T> lst) {
---- next = lst.first; valid = false;
---- }
----
---- public T Current {
---- get {
---- if (valid)
---- return curr;
---- else
---- throw new InvalidOperationException();
---- }
---- }
----
---- object IEnumerator.Current {
---- get { return Current; }
---- }
----
---- public bool MoveNext() {
---- if (next != null) {
---- curr = next.item; next = next.next; valid = true;
---- } else
---- valid = false;
---- return valid;
---- }
----
---- public void Reset() {
---- throw new NotImplementedException ();
---- }
----
---- public void Dispose() {
---- curr = default(T); next = null; valid = false;
---- }
---- }
----}
----
----class SortedList<T> : LinkedList<T> where T : IComparable<T> {
---- // Sorted insertion
---- public void Insert(T x) {
---- Node node = first;
---- while (node != null && x.CompareTo(node.item) > 0)
---- node = node.next;
---- if (node == null) // x > all elements; insert at end
---- Add(x);
---- else { // x <= node.item; insert before node
---- Node newnode = new Node(x);
---- if (node.prev == null) // insert as first element
---- first = newnode;
---- else
---- node.prev.next = newnode;
---- newnode.next = node;
---- newnode.prev = node.prev;
---- node.prev = newnode;
---- }
---- }
----}
----
----interface IPrintable {
---- void Print(TextWriter fs);
----}
----class PrintableLinkedList<T> : LinkedList<T>, IPrintable where T : IPrintable {
---- public void Print(TextWriter fs) {
---- bool firstElement = true;
---- foreach (T x in this) {
---- x.Print(fs);
---- if (firstElement)
---- firstElement = false;
---- else
---- fs.Write(", ");
---- }
---- }
----}
----
----class MyString : IComparable<MyString> {
---- private readonly String s;
---- public MyString(String s) {
---- this.s = s;
---- }
---- public int CompareTo(MyString that) {
---- return String.Compare(that.Value, s); // Reverse ordering
---- }
---- public bool Equals(MyString that) {
---- return that.Value == s;
---- }
---- public String Value {
---- get { return s; }
---- }
----}
----
----class MyTest {
---- public static void Main(String[] args) {
---- LinkedList<double> dLst = new LinkedList<double>(7.0, 9.0, 13.0, 0.0);
---- foreach (double d in dLst)
---- Console.Write("{0} ", d);
---- Console.WriteLine();
---- IMyList<int> iLst =
---- dLst.Map<int>(new Mapper<double, int>(Math.Sign));
---- foreach (int i in iLst)
---- Console.Write("{0} ", i);
---- Console.WriteLine();
---- IMyList<String> sLst =
---- dLst.Map<String>(delegate(double d) { return "s" + d; });
---- foreach (String s in sLst)
---- Console.Write("{0} ", s);
---- Console.WriteLine();
---- // Testing SortedList<MyString>
---- SortedList<MyString> sortedLst = new SortedList<MyString>();
---- sortedLst.Insert(new MyString("New York"));
---- sortedLst.Insert(new MyString("Rome"));
---- sortedLst.Insert(new MyString("Dublin"));
---- sortedLst.Insert(new MyString("Riyadh"));
---- sortedLst.Insert(new MyString("Tokyo"));
---- foreach (MyString s in sortedLst)
---- Console.Write("{0} ", s.Value);
---- Console.WriteLine();
---- }
----}
+++ /dev/null
----using System;
----
----namespace Slow
----{
---- public interface ITest
---- {
---- void DoNothing<T>()
---- where T : class;
---- }
----
---- public class Test : ITest
---- {
---- public void DoNothing<T>()
---- where T : class
---- {
---- T x = null;
---- }
---- }
----
---- class Program
---- {
---- static void Main(string[] args)
---- {
---- const int iterations = 10000;
----
---- Test test = new Test ();
----
---- DateTime start = DateTime.Now;
---- Console.Write ("Calling Test.DoNothing<Program>() on an object reference... ");
---- for (int i = 0; i < iterations; ++i)
---- {
---- test.DoNothing<Program> ();
---- }
---- DateTime end = DateTime.Now;
---- TimeSpan duration = end - start;
---- Console.WriteLine ("Took " + duration.TotalMilliseconds + " ms.");
----
---- ITest testInterface = test;
----
---- start = DateTime.Now;
---- Console.Write ("Calling Test.DoNothing<Program>() on an interface reference... ");
---- for (int i = 0; i < iterations; ++i)
---- {
---- testInterface.DoNothing<Program> ();
---- }
---- end = DateTime.Now;
---- duration = end - start;
---- Console.WriteLine ("Took " + duration.TotalMilliseconds + " ms.");
---- }
---- }
----}
+++ /dev/null
----using System;
----
----public interface IFoo<T>
----{ }
----
----public class Foo<T>
----{
---- public static bool Test (T x)
---- {
---- return x is IFoo<T>;
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Foo<int>.Test (3);
---- }
----}
+++ /dev/null
----//-- ex-gen-class-polynomial
----
----using System;
----
----// A type implements AddMul<A,R> if one can add an A to it, giving an R:
----
----interface AddMul<A,R> {
---- R Add(A e); // Addition with A, giving R
---- R Mul(A e); // Multiplication with A, giving R
----}
----
----// Polynomials over E, Polynomial<E>:
----
----// The base type E of the polynomial must support addition,
----// multiplication and zero (via the nullary constructor). That's what
----// the type parameter constraint on E says.
----
----// In return, one can add an E or a polynomial over E to a polynomial
----// over E. Similarly, a polynomial over E can be multiplied by an E
----// or by a polynomial over E. That's what the interface clauses say.
----
----class Polynomial<E> : AddMul<E,Polynomial<E>>,
---- AddMul<Polynomial<E>,Polynomial<E>>
---- where E : AddMul<E,E>, new() {
---- // cs contains coefficients of x^0, x^1, ...; absent coefficients are zero.
---- // Invariant: cs != null && cs.Length >= 0; cs.Length==0 represents zero.
---- private readonly E[] cs;
----
---- public Polynomial() {
---- this.cs = new E[0];
---- }
----
---- public Polynomial(E[] cs) {
---- this.cs = cs;
---- }
----
---- public Polynomial<E> Add(Polynomial<E> that) {
---- int newlen = Math.Max(this.cs.Length, that.cs.Length);
---- int minlen = Math.Min(this.cs.Length, that.cs.Length);
---- E[] newcs = new E[newlen];
---- if (this.cs.Length <= that.cs.Length) {
---- for (int i=0; i<minlen; i++)
---- newcs[i] = this.cs[i].Add(that.cs[i]);
---- for (int i=minlen; i<newlen; i++)
---- newcs[i] = that.cs[i];
---- } else {
---- for (int i=0; i<minlen; i++)
---- newcs[i] = this.cs[i].Add(that.cs[i]);
---- for (int i=minlen; i<newlen; i++)
---- newcs[i] = this.cs[i];
---- }
---- return new Polynomial<E>(newcs);
---- }
----
---- public Polynomial<E> Add(E that) {
---- return this.Add(new Polynomial<E>(new E[] { that }));
---- }
----
---- public Polynomial<E> Mul(E that) {
---- E[] newcs = new E[cs.Length];
---- for (int i=0; i<cs.Length; i++)
---- newcs[i] = that.Mul(cs[i]);
---- return new Polynomial<E>(newcs);
---- }
----
---- public Polynomial<E> Mul(Polynomial<E> that) {
---- int newlen = Math.Max(1, this.cs.Length + that.cs.Length - 1);
---- E[] newcs = new E[newlen];
---- for (int i=0; i<newlen; i++) {
---- E sum = new E(); // Permitted by constraint E : new()
---- int start = Math.Max(0, i-that.cs.Length+1);
---- int stop = Math.Min(i, this.cs.Length-1);
---- for (int j=start; j<=stop; j++) {
---- // assert 0<=j && j<this.cs.Length && 0<=i-j && i-j<that.cs.Length;
---- sum = sum.Add(this.cs[j].Mul(that.cs[i-j]));
---- }
---- newcs[i] = sum;
---- }
---- return new Polynomial<E>(newcs);
---- }
----
---- public E Eval(E x) {
---- E res = new E(); // Permitted by constraint E : new()
---- for (int j=cs.Length-1; j>=0; j--)
---- res = res.Mul(x).Add(cs[j]);
---- return res;
---- }
----}
----
----struct Int : AddMul<Int,Int> {
---- private readonly int i;
---- public Int(int i) {
---- this.i = i;
---- }
---- public Int Add(Int that) {
---- return new Int(this.i + that.i);
---- }
---- public Int Mul(Int that) {
---- return new Int(this.i * that.i);
---- }
---- public override String ToString() {
---- return i.ToString();
---- }
----}
----
----class TestPolynomial {
---- public static void Main(String[] args) {
---- // The integer polynomial 2 + 5x + x^2
---- Polynomial<Int> ip =
---- new Polynomial<Int>(new Int[] { new Int(2), new Int(5), new Int(1) });
---- Console.WriteLine(ip.Eval(new Int(10))); // 152
---- Console.WriteLine(ip.Add(ip).Eval(new Int(10))); // 304 = 152 + 152
---- Console.WriteLine(ip.Mul(ip).Eval(new Int(10))); // 23104 = 152 * 152
---- }
----}
----
+++ /dev/null
----// Compiler options: -unsafe
----using System;
----
----public class Tests {
----
---- public unsafe static void Main () {
---- Console.WriteLine (typeof (void).Name);
---- Console.WriteLine (typeof (void*).Name);
---- Console.WriteLine (typeof (void**).Name);
---- }
----}
+++ /dev/null
----// A generic type definition may have another generic type
----// definition as its parent.
----
----class Stack<S>
----{
---- public void Hello (S s)
---- { }
----}
----
----class Test<T> : Stack<T>
----{
---- public void Foo (T t)
---- { }
----}
----
----class X
----{
---- Test<int> test;
----
---- void Test ()
---- {
---- test.Foo (4);
---- test.Hello (3);
---- }
----
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----public interface ISequenced<T>
----{
---- bool Equals (ISequenced<T> that);
----}
----
----public class SequencedHasher <S,W>
---- where S : ISequenced<W>
----{
---- public bool Equals (S i1, S i2)
---- {
---- return i1 == null ? i2 == null : i1.Equals (i2);
---- }
----}
----
----public class Sequenced<T> : ISequenced<T>
----{
---- public bool Equals (ISequenced<T> that)
---- {
---- return false;
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Sequenced<int> s = new Sequenced<int> ();
---- SequencedHasher<Sequenced<int>,int> hasher = new SequencedHasher<Sequenced<int>,int> ();
---- hasher.Equals (s, s);
---- }
----}
+++ /dev/null
----public class B<T>
----{
---- public int Add (T obj)
---- {
---- return -1;
---- }
----
---- public void AddRange (object o)
---- {
---- T obj = (T) o;
---- Add (obj);
---- }
----}
----
----public interface IA
----{
----}
----
----public class A : IA
----{
----}
----
----public class Test
----{
---- public static void Main ()
---- {
---- B<IA> aux = new B<IA> ();
---- aux.AddRange (new A ());
---- }
----}
+++ /dev/null
---- class Test
---- {
---- static void Main(string[] args)
---- {
---- A<int> a = new A<int>(new A<int>.B(D), 3);
---- a.Run();
---- }
---- public static void D(int y)
---- {
---- System.Console.WriteLine("Hello " + 3);
---- }
---- }
---- class A<T>
---- {
---- public delegate void B(T t);
----
---- protected B _b;
---- protected T _value;
----
---- public A(B b, T value)
---- {
---- _b = b;
---- _value = value;
---- }
---- public void Run()
---- {
---- _b(_value);
---- }
---- }
----
+++ /dev/null
----class A<T>
----{
---- public delegate void Foo ();
---- public delegate void Bar<U> ();
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----interface IFoo <T>
----{
---- T this [int index] {
---- get; set;
---- }
----}
----
----public class FooCollection <T> : IFoo <T>
----{
---- T IFoo<T>.this [int index] {
---- get {
---- return default(T);
---- }
---- set {
---- }
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- IFoo<int> foo = new FooCollection<int> ();
---- int a = foo [3];
---- Console.WriteLine (a);
---- }
----}
+++ /dev/null
----using System;
----
----public interface IA<T> where T : struct {
----
----}
----
----public class B<T> : IA<T> where T:struct {
----
----}
----
----public class MainClass {
---- public static void Main () {}
----
----}
----
+++ /dev/null
----using System.Collections.Generic;
----
----// comment this line to see another bug in gmcs (unrelated)
----interface IB { bool foo (); }
----
----
----class B : IB { public bool foo () { return true; } }
----
----interface Filter <T> where T : IB {
---- T Is (IB x);
----
----}
----
----struct K : IB {
---- public bool foo () { return false; }
----
----}
----
----class MyFilter : Filter <K> {
---- public K Is (IB x) { return new K(); }
----}
----
----class MyBFilter : Filter <B> {
---- public B Is (IB x) { return new B(); }
----}
----
----class M {
----
---- static List<T> foo1 <T> (Filter <T> x) where T : IB {
---- List <T> result = new List <T>();
---- T maybe = x.Is (new B());
---- if (maybe != null)
---- result.Add (maybe);
---- return result;
---- }
----
---- static void Main () {
---- MyFilter m = new MyFilter ();
---- System.Console.WriteLine (foo1 <K> (m).Count);
---- MyBFilter mb = new MyBFilter ();
---- System.Console.WriteLine (foo1 <B> (mb).Count);
---- }
----}
+++ /dev/null
----public class A<T>
----{
---- public delegate void Changed (A<T> a);
----
---- protected event Changed _changed;
----
---- public void Register (Changed changed)
---- {
---- _changed += changed;
---- _changed (this);
---- }
----}
----
----public class Test
----{
---- public static void Main ()
---- {
---- A<int> a = new A<int> ();
---- a.Register (new A<int>.Changed (Del));
---- }
----
---- public static void Del (A<int> a)
---- {
---- System.Console.WriteLine ("Solved");
---- }
----}
+++ /dev/null
----using System;
----using System.Reflection;
----
----namespace FLMID.Bugs.ParametersOne
----{
---- public class Class<T>
---- {
---- public void Add(T x)
---- {
---- System.Console.WriteLine("OK");
---- }
---- }
---- public class Test
---- {
----
---- public static void Main(string [] args)
---- {
---- Class<string> instance = new Class<string>();
----
---- MethodInfo _method = null;
----
---- foreach(MethodInfo method in
----typeof(Class<string>).GetMethods(BindingFlags.Instance | BindingFlags.Public))
---- {
---- if(method.Name.Equals("Add") && method.GetParameters().Length==1)
---- {
---- _method = method;
---- break;
---- }
---- }
---- _method.Invoke(instance , new object[]{"1"});
---- }
---- }
----}
+++ /dev/null
----namespace B
----{
---- using C;
----
---- partial class Test <T>
---- where T : IA, IB
---- { }
----}
----
----namespace B
----{
---- partial class Test <T>
---- where T : C.IB, C.IA
---- { }
----}
----
----namespace B
----{
---- partial class Test <T>
---- { }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
----
----namespace C {
---- interface IA { }
---- interface IB { }
----}
+++ /dev/null
----// Compiler options: -t:library
----
----public class Stack<S>
----{
---- public void Hello (S s)
---- { }
----}
+++ /dev/null
----// Compiler options: -r:gen-13-dll.dll
----
----public class X
----{
---- Stack<int> stack;
----
---- void Test ()
---- {
---- stack.Hello (3);
---- }
----
---- static void Main ()
---- { }
----}
+++ /dev/null
----//-- ex-nullable-bool
----
----using System;
----
----class MyTest {
---- public static void Main(String[] args) {
---- Console.WriteLine("Note that null prints as blank or []\n");
---- bool? b1 = null, b2 = false, b3 = true;
---- bool? b4 = b1^b2, b5 = b1&b2, b6 = b1|b2; // null false null
---- Console.WriteLine("[{0}] [{1}] [{2}]", b4, b5, b6);
---- bool? b7 = b1^b3, b8 = b1&b3, b9 = b1|b3; // null null true
---- Console.WriteLine("[{0}] [{1}] [{2}]", b7, b8, b9);
---- Console.WriteLine(b1 ? "null is true" : "null is false"); // null is false
---- Console.WriteLine(!b1 ? "!null is true" : "!null is false"); // !null is false
----
---- Console.WriteLine();
---- bool?[] bvals = new bool?[] { null, false, true };
---- Console.WriteLine("{0,-6} {1,-6} {2,-6} {3,-6} {4,-6}",
---- "x", "y", "x&y", "x|y", "x^y");
---- foreach (bool? x in bvals)
---- foreach (bool? y in bvals)
---- Console.WriteLine("{0,-6} {1,-6} {2,-6} {3,-6} {4,-6}",
---- x, y, x&y, x|y, x^y);
---- Console.WriteLine();
---- Console.WriteLine("{0,-6} {1,-6}", "x", "!x");
---- foreach (bool? x in bvals)
---- Console.WriteLine("{0,-6} {1,-6}", x, !x);
---- }
----}
+++ /dev/null
----//-- ex-nullable
----
----using System;
----
----class MyTest {
---- public static void Main(String[] args) {
---- Console.WriteLine("Note that null prints as blank or []\n");
---- int? i1 = 11, i2 = 22, i3 = null, i4 = i1+i2, i5 = i1+i3;
---- // Values: 11 22 null 33 null
---- Console.WriteLine("[{0}] [{1}] [{2}] [{3}] [{4}]", i1, i2, i3, i4, i5);
---- int i6 = (int)i1; // Legal
---- // int i7 = (int)i5; // Legal but fails at run-time
---- // int i8 = i1; // Illegal
----
---- int?[] iarr = { i1, i2, i3, i4, i5 };
---- i2 += i1;
---- i2 += i4;
---- Console.WriteLine("i2 = {0}", i2); // 66 = 11+22+33
----
---- int sum = 0;
---- for (int i=0; i<iarr.Length; i++)
---- sum += iarr[i] != null ? iarr[i].Value : 0;
---- // sum += iarr[i] ?? 0;
---- Console.WriteLine("sum = {0}", sum); // 66 = 11+22+33
----
---- for (int i=0; i<iarr.Length; i++)
---- if (iarr[i] > 11)
---- Console.Write("[{0}] ", iarr[i]); // 22 33
---- Console.WriteLine();
----
---- for (int i=0; i<iarr.Length; i++)
---- if (iarr[i] != i1)
---- Console.Write("[{0}] ", iarr[i]); // 22 null 33 null
---- Console.WriteLine();
---- Console.WriteLine();
---- int?[] ivals = { null, 2, 5 };
---- Console.WriteLine("{0,6} {1,6} {2,6} {3,6} {4,-6} {5,-6} {6,-6} {7,-6}",
---- "x", "y", "x+y", "x-y", "x<y", "x>=y", "x==y", "x!=y");
---- Console.WriteLine();
---- foreach (int? x in ivals)
---- foreach (int? y in ivals)
---- Console.WriteLine("{0,6} {1,6} {2,6} {3,6} {4,-6} {5,-6} {6,-6} {7,-6}",
---- x, y, x+y, x-y, (x<y), (x>=y), x==y, x!=y);
---- }
----}
+++ /dev/null
----//-- ex-nullable-sqrt
----
----using System;
----
----class MyTest {
---- public static int? Sqrt(int? x) {
---- if (x.HasValue && x.Value >= 0)
---- return (int)(Math.Sqrt(x.Value));
---- else
---- return null;
---- }
----
---- public static void Main(String[] args) {
---- // Prints :2:::
---- Console.WriteLine(":{0}:{1}:{2}:", Sqrt(5), Sqrt(null), Sqrt(-5));
---- }
----}
+++ /dev/null
----// Not used -- ex-nullable-struct
----
----// Converting a struct from S to S? creates a copy of the struct.
----// Getting the struct out of the non-null value creates another copy.
----
----using System;
----
----struct S {
---- private int x;
---- public int X {
---- get { return x; }
---- set { this.x = value; } // Cannot be used on non-variable ns.Value
---- }
---- public void Set(int x) {
---- this.x = x;
---- }
----}
----
----class MyTest {
---- public static void Main(String[] args) {
---- S s = new S();
---- s.Set(11);
---- Console.WriteLine("s.X = {0}", s.X);
---- S? ns = s;
---- Console.WriteLine("s.X = {0} ns.Value.X = {1}", s.X, ns.Value.X);
---- ns.Value.Set(22);
---- Console.WriteLine("s.X = {0} ns.Value.X = {1}", s.X, ns.Value.X);
---- s.Set(33);
---- Console.WriteLine("s.X = {0} ns.Value.X = {1}", s.X, ns.Value.X);
---- }
----}
+++ /dev/null
----// sestoft@dina.kvl.dk * 2004-08
----
----using System;
----
----class MyTest {
---- public static void Main(String[] args) {
---- Foo<int?> fni1 = new Foo<int?>(null);
---- Console.WriteLine(fni1.Fmt());
---- Foo<int?> fni2 = new Foo<int?>(17);
---- Console.WriteLine(fni2.Fmt());
---- Foo<int> fi = new Foo<int>(7);
---- Console.WriteLine(fi.Fmt());
---- Foo<String> fs1 = new Foo<String>(null);
---- Console.WriteLine(fs1.Fmt());
---- Foo<String> fs2 = new Foo<String>("haha");
---- Console.WriteLine(fs2.Fmt());
---- }
----}
----
----class Foo<T> {
---- T x;
---- public Foo(T x) {
---- this.x = x;
---- }
----
---- // This shows how to deal with tests for null in a generic setting
---- // where null may mean both `null reference' and `null value of a
---- // nullable type'. Namely, the test (x == null) will always be
---- // false if the generic type parameter t is instantiated with a
---- // nullable type. Reason: the null literal will be considered a
---- // null reference and x will be boxed if a value type, and hence the
---- // comparison will be false...
----
---- public String Fmt() {
---- if (x is INullableValue && ((INullableValue)x).HasValue
---- || !(x is INullableValue) && x != null)
---- return x.ToString();
---- else
---- return "null";
---- }
----}
+++ /dev/null
----using System;
----
----class X
----{
---- static void Main ()
---- {
---- int? a = null;
---- int b = 3;
---- long? c = a;
---- Console.WriteLine (c);
---- long? d = b;
---- byte? f = (byte?) d;
---- }
----}
+++ /dev/null
----using System;
----
----namespace Martin {
---- public class A
---- {
---- public readonly long Data;
----
---- public A (long data)
---- {
---- this.Data = data;
---- }
----
---- public static explicit operator B (A a)
---- {
---- return new B ((int) a.Data);
---- }
---- }
----
---- public class B
---- {
---- public readonly int Data;
----
---- public B (int data)
---- {
---- this.Data = data;
---- }
----
---- public static implicit operator A (B b)
---- {
---- return new A (b.Data);
---- }
---- }
----
---- class X
---- {
---- static void Main ()
---- {
---- B? b = new B (5);
---- A? a = b;
---- B? c = (B?) a;
---- B? d = (Martin.B?) a;
---- }
---- }
----}
+++ /dev/null
----using System;
----
----class X
----{
---- static void Main ()
---- {
---- int? a = 4;
---- int? b = -a;
---- Console.WriteLine (b);
---- }
----}
+++ /dev/null
----using System;
----
----class X
----{
---- static void Main ()
---- {
---- int? a = 4;
---- long b = 5;
---- long? c = a * b;
---- Console.WriteLine (c);
---- }
----}
+++ /dev/null
----using System;
----
----class X
----{
---- static void Main ()
---- {
---- bool? a = true;
---- int? b = a ? 3 : 4;
---- Console.WriteLine (b);
---- }
----}
+++ /dev/null
----public class Stack<S>
----{
---- public Stack (S s)
---- { }
----
---- public void Push (S s)
---- { }
----}
----
----public class X
----{
---- static void Main ()
---- {
---- Stack<int> s1 = new Stack<int> (3);
---- s1.Push (4);
----
---- Stack<string> s2 = new Stack<string> ("Hello");
---- s2.Push ("Test");
---- }
----}
+++ /dev/null
----using System;
----
----class X
----{
---- static void Main ()
---- {
---- int?[] bvals = new int?[] { null, 3, 4 };
---- foreach (long? x in bvals)
---- Console.WriteLine (x);
---- }
----}
+++ /dev/null
----using System;
----
----class X
----{
---- static void Main ()
---- {
---- int?[] bvals = new int? [] { null, 3, 4 };
---- foreach (int? x in bvals)
---- Console.WriteLine (x);
---- }
----}
+++ /dev/null
----using System;
----
----public static class Assert
----{
---- public static int Errors {
---- get { return errors; }
---- }
----
---- static int errors = 0;
----
---- static void Error (string method, string text)
---- {
---- Console.WriteLine ("Assert failed: {0} ({1})", method, text);
---- errors++;
---- }
----
---- public static void IsTrue (string text, bool b)
---- {
---- if (!b)
---- Error ("IsTrue", text);
---- }
----
---- public static void IsFalse (string text, bool b)
---- {
---- if (b)
---- Error ("IsFalse", text);
---- }
----
---- public static void IsNull<T> (string text, Nullable<T> nullable)
---- {
---- if (nullable.HasValue)
---- Error ("IsNull", text);
---- }
----
---- public static void IsNotNull<T> (string text, Nullable<T> nullable)
---- {
---- if (!nullable.HasValue)
---- Error ("IsNotNull", text);
---- }
----
---- public static void IsTrue (string text, Nullable<bool> b)
---- {
---- if (!b.HasValue || !b.Value)
---- Error ("IsTrue", text);
---- }
----
---- public static void IsFalse (string text, Nullable<bool> b)
---- {
---- if (!b.HasValue || b.Value)
---- Error ("IsFalse", text);
---- }
----}
----
----class X
----{
---- static int Main ()
---- {
---- bool? a = null, b = false, c = true;
---- bool? d = null, e = false, f = true;
----
---- Assert.IsNull ("a", a);
---- Assert.IsFalse ("b", b);
---- Assert.IsTrue ("c", c);
---- Assert.IsTrue ("a == d", a == d);
---- Assert.IsTrue ("b == e", b == e);
---- Assert.IsTrue ("c == f", c == f);
----
---- Assert.IsFalse ("a != d", a != d);
---- Assert.IsFalse ("a == b", a == b);
---- Assert.IsTrue ("a != b", a != b);
----
---- Assert.IsNull ("d & a", d & a);
---- Assert.IsFalse ("d & b", d & b);
---- Assert.IsNull ("d & c", d & c);
---- Assert.IsFalse ("e & a", e & a);
---- Assert.IsFalse ("e & b", e & b);
---- Assert.IsFalse ("e & c", e & c);
---- Assert.IsNull ("f & a", f & a);
---- Assert.IsFalse ("f & b", f & b);
---- Assert.IsTrue ("f & c", f & c);
----
---- Assert.IsNull ("d | a", d | a);
---- Assert.IsNull ("d | b", d | b);
---- Assert.IsTrue ("d | c", d | c);
---- Assert.IsNull ("e | a", e | a);
---- Assert.IsFalse ("e | b", e | b);
---- Assert.IsTrue ("e | c", e | c);
---- Assert.IsTrue ("f | a", f | a);
---- Assert.IsTrue ("f | b", f | b);
---- Assert.IsTrue ("f | c", f | c);
----
---- Assert.IsNull ("d && a", d && a);
---- Assert.IsFalse ("d && b", d && b);
---- Assert.IsNull ("d && c", d && c);
---- Assert.IsFalse ("e && a", e && a);
---- Assert.IsFalse ("e && b", e && b);
---- Assert.IsFalse ("e && c", e && c);
---- Assert.IsNull ("f && a", f && a);
---- Assert.IsFalse ("f && b", f && b);
---- Assert.IsTrue ("f && c", f && c);
----
---- Assert.IsNull ("d || a", d || a);
---- Assert.IsNull ("d || b", d || b);
---- Assert.IsTrue ("d || c", d || c);
---- Assert.IsNull ("e || a", e || a);
---- Assert.IsFalse ("e || b", e || b);
---- Assert.IsTrue ("e || c", e || c);
---- Assert.IsTrue ("f || a", f || a);
---- Assert.IsTrue ("f || b", f || b);
---- Assert.IsTrue ("f || c", f || c);
----
---- int? g = 3, h = null, i = 3, j = null;
----
---- Assert.IsFalse ("g == null", g == null);
---- Assert.IsTrue ("g != null", g != null);
---- Assert.IsTrue ("h == null", h == null);
---- Assert.IsFalse ("h != null", h != null);
----
---- Assert.IsTrue ("g == i", g == i);
---- Assert.IsFalse ("g != i", g != i);
---- Assert.IsFalse ("g == j", g == j);
---- Assert.IsTrue ("g != j", g != j);
---- Assert.IsFalse ("h == i", h == i);
---- Assert.IsTrue ("h != i", h != i);
---- Assert.IsTrue ("h == j", h == j);
---- Assert.IsFalse ("h != j", h != j);
----
---- Console.WriteLine ("{0} errors.", Assert.Errors);
---- return Assert.Errors;
---- }
----}
+++ /dev/null
----using System;
----
----class X
----{
---- static int Test ()
---- {
---- int? a = 5;
---- int? b = a++;
----
---- if (a != 6)
---- return 1;
---- if (b != 5)
---- return 2;
----
---- int? c = ++a;
----
---- if (c != 7)
---- return 3;
----
---- b++;
---- ++b;
----
---- if (b != 7)
---- return 4;
----
---- int? d = b++ + ++a;
----
---- if (a != 8)
---- return 5;
---- if (b != 8)
---- return 6;
---- if (d != 15)
---- return 7;
----
---- return 0;
---- }
----
---- static int Main ()
---- {
---- int result = Test ();
---- if (result != 0)
---- Console.WriteLine ("ERROR: {0}", result);
---- return result;
---- }
----}
+++ /dev/null
----using System;
----
----namespace Test
----{
---- public class Application
---- {
---- public static void Main()
---- {
---- string[] array = new string[10];
----
---- System.Collections.Generic.IEnumerable<string> enumer = array;
---- }
---- }
----}
+++ /dev/null
----using System;
----public class Test<T>{
---- private T[,] data;
---- public Test(T[,] data){
---- this.data = data;
---- }
----}
----public class Program{
---- public static void Main(string[] args){
---- Test<double> test = new Test<double>(new double[2,2]);
---- }
----}
----
+++ /dev/null
----using System;
----
----public class MyLinkedList<T> {
---- protected Node first;
----
---- protected class Node
---- {
---- public T item;
----
---- public Node (T item)
---- {
---- this.item = item;
---- }
---- }
----}
----
----class SortedList<U> : MyLinkedList<U>
----{
---- public void Insert (U x) {
---- Node node = first;
---- }
----}
----
----class X {
---- static void Main ()
---- { }
----}
+++ /dev/null
----namespace A
----{
---- interface IFoo
---- {
---- void Hello (IFoo foo);
---- }
----}
----
----namespace B
----{
---- partial class Test <T> : IDoo, A.IFoo where T : A.IFoo
---- { }
----}
----
----namespace B
----{
---- using A;
----
---- partial class Test <T> : Y, IFoo where T : IFoo
---- {
---- void IFoo.Hello (IFoo foo)
---- { }
---- }
----}
----
----interface IDoo { }
----
----class Y { }
----
----class X
----{
---- static void Main ()
---- { }
----}
----
----
----
----
+++ /dev/null
----using System;
----
----static class Test1 {
---- public class IOp<T> { }
---- static void Foo<S,OP>(uint v) where OP : IOp<S> { }
----};
----
----static class Test2 {
---- public class IOp<T> { }
---- static void Foo<T,OP>(uint v) where OP : IOp<T> { }
----};
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----static class Test1 {
---- public class IOp<T> { }
---- static void Foo<S,OP>(uint v) where OP : IOp<S> { }
----};
----
----static class Test2 {
---- public class IOp<T> { }
---- static void Foo<T,OP>(uint v) where OP : IOp<T> { }
----};
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----// Very simple example of a generic method.
----
----class Stack<S>
----{
---- public static void Hello<T,U> (S s, T t, U u)
---- {
---- U v = u;
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- }
----}
+++ /dev/null
----using System;
----static class Test1 {
---- public interface IOp<T> {
---- T Func(uint v);
---- }
---- public struct Op : IOp<ushort>, IOp<uint> {
---- ushort IOp<ushort>.Func(uint v) { return (ushort )(v * 2); }
---- uint IOp<uint>.Func(uint v) { return v * 4; }
---- }
---- static void Foo<T,OP>(uint v) where T:struct where OP : IOp<T> {
---- OP op = default(OP);
---- System.Console.WriteLine( op.Func(v) );
---- }
---- static public void Main() {
---- Foo<ushort, Op>(100);
---- Foo<uint, Op>(100);
---- }
----};
+++ /dev/null
----class Test<T> where T: struct{
---- public Test(){
---- T s = new T();
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
----
+++ /dev/null
----using System;
----
----public interface IFoo
----{
---- IFoo Hello ();
----}
----
----public interface IFoo<T> : IFoo
----{
---- new IFoo<T> Hello ();
----}
----
----public interface ICollectionValue<T>: IFoo<T>
----{
----}
----
----public interface ICollection<T>: ICollectionValue<T>
----{ }
----
----public abstract class EnumerableBase<T> : IFoo<T>
----{
---- public abstract IFoo<T> Hello();
----
---- IFoo IFoo.Hello ()
---- {
---- return Hello ();
---- }
----}
----
----public abstract class CollectionBase<T> : EnumerableBase<T>
----{
----}
----
----public class HashBag<T>: CollectionBase<T>, ICollection<T>
----{
---- public override IFoo<T> Hello ()
---- {
---- return this;
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- }
----}
+++ /dev/null
----public interface IBase
----{
---- void DoSomeThing();
----}
----
----public interface IExtended : IBase
----{
---- void DoSomeThingElse();
----}
----
----public class MyClass<T> where T: IExtended, new()
----{
---- public MyClass()
---- {
---- T instance = new T();
---- instance.DoSomeThing();
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----public delegate int T<X> (X x);
----
----public class B
----{
---- public static T<X> M<X> ()
---- {
---- return delegate(X x) { return 5; };
---- }
----
---- public static T<long> N ()
---- {
---- return delegate(long x) { return 6; };
---- }
----}
----
----public class D
----{
---- public static void Main ()
---- {
---- B.M<int>();
---- B.N ();
---- }
----}
+++ /dev/null
----public interface IBase
----{
---- void DoSomeThing();
----}
----
----public interface IExtended : IBase
----{
---- void DoSomeThingElse();
----}
----
----public class MyClass<T> where T: IExtended, new()
----{
---- public MyClass()
---- {
---- T instance = new T();
---- instance.DoSomeThing();
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----// Compiler options: -t:library
----
----namespace FLMID.Bugs.Marshal15
----{
---- public class A<T>
----
---- {
----
---- }
---- public abstract class B
---- {
---- protected A<bool> _aux;
---- }
---- public class X : B
---- {
---- }
---- public abstract class C
---- {
---- protected B _layout;
---- }
----}
----
+++ /dev/null
----// Compiler options: -r:gen-156-dll.dll
----
----namespace FLMID.Bugs.Marshal15
----{
---- public class D : C
---- {
---- public D()
---- {
---- _layout = new X();
---- }
---- public static void Main(string[] args)
---- {
---- System.Console.WriteLine("OK");
---- }
---- }
----}
----
+++ /dev/null
----interface a <t> { void x (); }
----
----interface b <t> : a <t> {}
----
----class kv <k,v> {} // type t
----
----interface c <k,v>: b <kv<k,v>>, // b <t>
---- a <kv<k,v>> // a <t>
----{}
----
----class m <k,v> : c <k,v>,
---- b <kv<k,v>> // b <t>
----{
---- void a <kv <k,v>>.x () {} // a<t>.x ()
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----public class Moo<C>
---- where C : Moo<C>.Foo
----{
---- public class Foo
---- { }
----}
----
----public class Test : Moo<Test>.Foo
----{
----}
----
----class X
----{
---- static void Main ()
---- {
---- Moo<Test> moo = new Moo<Test> ();
---- }
----}
+++ /dev/null
----// A generic method may also use the type parameters
----// from its enclosing type.
----
----class Stack<S>
----{
---- public static void Hello<T> (S s, T t)
---- { }
----}
----
----class X
----{
---- Stack<int> stack;
----
---- static void Main ()
---- {
---- }
----}
+++ /dev/null
----// Compiler options: -t:library
----
----public class Stack
----{
---- public Stack ()
---- { }
----
---- public void Hello<T> (T t)
---- { }
----}
+++ /dev/null
----// Compiler options: -r:gen-17-dll.dll
----
----public class X
----{
---- public static void Foo (Stack stack)
---- {
---- stack.Hello<string> ("Hello World");
---- }
----
---- static void Main ()
---- {
---- Stack stack = new Stack ();
---- Foo (stack);
---- }
----}
+++ /dev/null
----public class Stack
----{
---- public Stack ()
---- { }
----
---- public void Hello<T> (T t)
---- { }
----}
----
----public class X
----{
---- public static void Foo (Stack stack)
---- {
---- stack.Hello<string> ("Hello World");
---- }
----
---- static void Main ()
---- {
---- Stack stack = new Stack ();
---- Foo (stack);
---- }
----}
+++ /dev/null
----// A very simple generic interface
----
----public interface IEnumerator<T> {
---- T Current { get; }
---- bool MoveNext();
---- void Reset();
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----class Cell <X> {
---- X value;
----
----}
----
----class D {
---- static void Main ()
---- {
---- }
----}
+++ /dev/null
----struct Stack<S>
----{
---- public void Hello (S s)
---- { }
----}
----
----class X
----{
---- Stack<int> stack;
----
---- void Test ()
---- {
---- stack.Hello (3);
---- }
----
---- static void Main ()
---- { }
----}
+++ /dev/null
----// Testing the default value expressions (14.5.13)
----
----using System;
----
----class Foo<T>
----{
---- T[] t;
----
---- public Foo (int n)
---- {
---- t = new T [n];
---- for (int i = 0; i < n; i++)
---- t [i] = default (T);
---- }
----
---- public void Test ()
---- {
---- X.Print (t [0]);
---- }
----}
----
----class Bar<T>
----{
---- public void Test ()
---- {
---- X.Print (default (X));
---- X.Print (default (T));
---- X.Print (default (S));
---- }
----}
----
----struct S
----{
---- public readonly string Hello;
----
---- S (string hello)
---- {
---- this.Hello = hello;
---- }
----
---- public override string ToString ()
---- {
---- return String.Format ("S({0})", Hello);
---- }
----
----}
----
----class X
----{
---- public static void Print (object obj)
---- {
---- if (obj == null)
---- Console.WriteLine ("NULL");
---- else
---- Console.WriteLine ("OBJECT: {0} {1}", obj, obj.GetType ());
---- }
----
---- static void Main ()
---- {
---- Foo<string> a = new Foo<string> (4);
---- a.Test ();
----
---- Bar<int> b = new Bar<int> ();
---- b.Test ();
---- Bar<X> c = new Bar<X> ();
---- c.Test ();
---- }
----}
+++ /dev/null
----// A non-generic type may have a closed constructed type as its parent
----
----class Foo<T>
----{
---- public void Hello ()
---- { }
----
---- public void World (T t)
---- {
---- Hello ();
---- }
----}
----
----class Bar : Foo<int>
----{
---- public void Test ()
---- {
---- Hello ();
---- World (4);
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Bar bar = new Bar ();
---- bar.Test ();
---- }
----}
+++ /dev/null
----class Foo<T>
----{
---- public void Hello ()
---- { }
----
---- public void World (T t)
---- {
---- Hello ();
---- }
----}
----
----//
----// This is some kind of a `recursive' declaration:
----//
----// Note that we're using the class we're currently defining (Bar)
----// as argument of its parent.
----//
----// Is is important to run the resulting executable since this is
----// both a test for the compiler and the runtime.
----//
----
----class Bar : Foo<Bar>
----{
---- public void Test ()
---- {
---- Hello ();
---- World (this);
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----class Foo<T>
----{
---- public Foo ()
---- { }
----
---- public void Hello (T t)
---- {
---- // We're boxing the type parameter `T' to an object here.
---- Whatever (t);
---- }
----
---- public void Whatever (object o)
---- {
---- System.Console.WriteLine (o.GetType ());
---- }
----}
----
----class X
----{
---- static void Test (Foo<int> foo)
---- {
---- foo.Hello (4);
---- }
----
---- static void Main ()
---- {
---- Foo<int> foo = new Foo<int> ();
---- Test (foo);
---- }
----}
+++ /dev/null
----class Foo
----{
---- public Foo ()
---- { }
----
---- public void Hello<T> (T t)
---- {
---- // We're boxing the type parameter `T' to an object here.
---- Whatever (t);
---- }
----
---- public void Whatever (object o)
---- {
---- System.Console.WriteLine (o.GetType ());
---- }
----}
----
----class X
----{
---- static void Test (Foo foo)
---- {
---- foo.Hello<int> (531);
---- }
----
---- static void Main ()
---- {
---- Foo foo = new Foo ();
---- Test (foo);
---- }
----}
+++ /dev/null
----// Test access to class fields outside the generic type declaration.
----
----class Foo<T>
----{
---- public T Hello;
----
---- public Foo ()
---- { }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Foo<int> foo = new Foo<int> ();
---- foo.Hello = 9;
---- }
----}
+++ /dev/null
----// A generic type declaration may have a non-generic base type.
----
----class TheBase
----{
---- public void BaseFunc ()
---- { }
----}
----
----class Stack<S> : TheBase
----{
---- public void Hello (S s)
---- { }
----}
----
----class Test<T> : Stack<T>
----{
---- public void Foo (T t)
---- { }
----}
----
----class X
----{
---- Test<int> test;
----
---- void Test ()
---- {
---- test.Foo (4);
---- test.Hello (3);
---- test.BaseFunc ();
---- }
----
---- static void Main ()
---- { }
----}
+++ /dev/null
----class Stack<T>
----{
---- T t;
----
---- public Stack (T t)
---- {
---- this.t = t;
---- }
----
---- public object Test ()
---- {
---- // Boxing the type parameter `T' to an object.
---- return t;
---- }
----}
----
----class X
----{
---- public static object Test (Stack<int> stack)
---- {
---- return stack.Test ();
---- }
----
---- static void Main ()
---- {
---- Stack<int> stack = new Stack<int> (9);
---- System.Console.WriteLine (Test (stack));
---- }
----}
+++ /dev/null
----class Stack<T>
----{
---- T[] t;
----
---- public Stack (int n)
---- {
---- t = new T [n];
---- }
----
---- public object Test ()
---- {
---- // Boxing the type parameter to an object; note that we're
---- // an array !
---- return t;
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Stack<int> stack = new Stack<int> (5);
---- System.Console.WriteLine (stack.Test ());
---- }
----}
+++ /dev/null
----class Stack<T> {
----}
----
----class Test {
----}
----
----class T {
---- Stack<Test> a;
----
---- static void Main()
---- {
---- }
----}
+++ /dev/null
----// Note how the order of type parameters is different
----// in the base class.
----
----class Foo<T>
----{
---- public Foo ()
---- { }
----
---- public void Hello (T t)
---- { }
----}
----
----class Bar<T,U> : Foo<U>
----{
---- public Bar ()
---- { }
----
---- public void Test (T t, U u)
---- { }
----}
----
----class X
----{
---- static void Test (Bar<int,string> bar)
---- {
---- bar.Hello ("Test");
---- bar.Test (7, "Hello");
---- }
----
---- static void Main ()
---- {
---- Bar<int,string> bar = new Bar<int,string> ();
---- Test (bar);
---- }
----}
+++ /dev/null
----// Compiler options: -t:library
----
----public class Foo<T>
----{
---- public void Hello (T t)
---- { }
----}
----
----public class Bar<T,U> : Foo<U>
----{
---- public void Test (T t, U u)
---- { }
----}
+++ /dev/null
----// Compiler options: -r:gen-31-dll.dll
----
----public class X
----{
---- public static void Test (Bar<int,string> bar)
---- {
---- bar.Hello ("Test");
---- bar.Test (7, "Hello");
---- }
----
---- static void Main ()
---- { }
----}
+++ /dev/null
----// Generic interfaces
----
----interface Foo<S>
----{
---- void Hello (S s);
----}
----
----interface Bar<T,U> : Foo<U>
----{
---- void Test (T t, U u);
----}
----
----class X
----{
---- static void Test (Bar<int,string> bar)
---- {
---- bar.Hello ("Test");
---- bar.Test (7, "Hello");
---- }
----
---- static void Main ()
---- { }
----}
+++ /dev/null
----// Generic interfaces
----
----interface Foo<R,S>
----{
---- void Hello (R r, S s);
----}
----
----interface Bar<T,U,V> : Foo<V,float>
----{
---- void Test (T t, U u, V v);
----}
----
----class X
----{
---- static void Test (Bar<long,int,string> bar)
---- {
---- bar.Hello ("Test", 3.14F);
---- bar.Test (512, 7, "Hello");
---- }
----
---- static void Main ()
---- { }
----}
+++ /dev/null
----class Foo<T>
----{ }
----
----class Stack<T>
----{ }
----
----//
----// We may use a constructed type `Stack<T>' instead of
----// just a type parameter.
----//
----
----class Bar<T> : Foo<Stack<T>>
----{ }
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----// May use a constructed type as constraint.
----
----class Test<T>
----{ }
----
----class Foo<T>
---- where T : Test<T>
----{ }
----
----class X
----{
---- static void Main ()
---- {
---- }
----}
+++ /dev/null
----//
----// This is another "important" test: it checks whether we set
----// TypeContainer.CurrentType correctly when compiling the
----// declaration of `Stack'.
----//
----
----class Stack<T>
----{
---- //
---- // This must be encoded as a TypeSpec (Stack<!0>) and
---- // not as a TypeDef.
---- //
---- // PEVerify the resulting executable on Windows to make sure !
---- //
---- void Hello (Stack<T> stack)
---- {
---- }
----
---- void Test ()
---- {
---- Hello (this);
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----//
----// Check whether we're correctly handling `this'.
----//
----//
----
----public class Foo<T,U>
----{
---- public void Hello (Foo<T,U> foo)
---- {
---- }
----
---- public virtual void Test ()
---- {
---- //
---- // Again, this must be encoded as a TypeSpec (Foo<!0,!1>)
---- // instead of a TypeDef.
---- Hello (this);
---- }
----}
----
----public class Bar<T> : Foo<T,long>
----{
---- public void Test (Foo<T,long> foo)
---- {
---- Hello (foo);
---- }
----}
----
----public class Baz<T> : Foo<T,string>
----{
---- public override void Test ()
---- {
---- Hello (this);
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----//
----// Another important test: nested generic types.
----//
----
----using System;
----
----class Queue<T>
----{
---- public Queue (T first, T second)
---- {
---- head = new Node<T> (null, second);
---- head = new Node<T> (head, first);
---- }
----
---- protected Node<T> head;
----
---- protected Node<T> GetFoo ()
---- {
---- return head;
---- }
----
---- protected Node<T> Foo {
---- get {
---- return GetFoo ();
---- }
---- }
----
---- protected void Test (T t)
---- {
---- Console.WriteLine (t);
---- }
----
---- public void Test ()
---- {
---- Test (head.Item);
---- Test (head.Next.Item);
---- Test (GetFoo ().Item);
---- Test (Foo.Item);
---- }
----
---- protected class Node<U>
---- {
---- public readonly U Item;
---- public readonly Node<U> Next;
----
---- public Node (Node<U> next, U item)
---- {
---- this.Next = next;
---- this.Item = item;
---- }
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Queue<int> queue = new Queue<int> (5, 9);
---- queue.Test ();
---- }
----}
+++ /dev/null
----//
----// Important test for the runtime: check whether we're correctly
----// creating the vtable for nested types.
----//
----
----using System;
----
----interface IMonkey<T>
----{
---- T Jump ();
----}
----
----class Zoo<T>
----{
---- T t;
----
---- public Zoo (T t)
---- {
---- this.t = t;
---- }
----
---- public T Name {
---- get { return t; }
---- }
----
---- public IMonkey<U> GetTheMonkey<U> (U u)
---- {
---- return new Monkey<T,U> (this, u);
---- }
----
---- public class Monkey<V,W> : IMonkey<W>
---- {
---- public readonly Zoo<V> Zoo;
---- public readonly W Data;
----
---- public Monkey (Zoo<V> zoo, W data)
---- {
---- this.Zoo = zoo;
---- this.Data = data;
---- }
----
---- public W Jump ()
---- {
---- Console.WriteLine ("Monkey {0} from {1} jumping!", Data, Zoo.Name);
---- return Data;
---- }
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Zoo<string> zoo = new Zoo<string> ("Boston");
---- IMonkey<float> monkey = zoo.GetTheMonkey<float> (3.14F);
---- monkey.Jump ();
---- }
----}
+++ /dev/null
----class Stack<T> {
----}
----
----class Test {
----}
----
----class T {
---- public void Foo (Stack<Test> a)
---- { }
----
---- static void Main()
---- {
---- }
----}
+++ /dev/null
----public interface INode<T>
----{
---- void Hello (T t);
----}
----
----public class Stack<T>
----{
---- public T TheData;
---- public readonly Foo<T> TheFoo;
----
---- public Stack (T t)
---- {
---- this.TheData = t;
---- this.TheFoo = new Foo<T> (t);
---- }
----
---- public INode<T> GetNode ()
---- {
---- return new Node (this);
---- }
----
---- public Foo<T> GetFoo (T t)
---- {
---- return new Foo<T> (t);
---- }
----
---- public Bar<T> GetBar (T t)
---- {
---- return new Bar<T> (t);
---- }
----
---- protected class Node : INode<T>
---- {
---- public readonly Stack<T> Stack;
----
---- public Node (Stack<T> stack)
---- {
---- this.Stack = stack;
---- }
----
---- public void Hello (T t)
---- {
---- }
---- }
----
---- public class Foo<T>
---- {
---- public readonly T Data;
----
---- public Bar<T> GetBar ()
---- {
---- return new Bar<T> (Data);
---- }
----
---- public Foo (T t)
---- {
---- this.Data = t;
---- }
---- }
----
---- public class Bar<U>
---- {
---- public readonly U Data;
----
---- public Bar (U u)
---- {
---- this.Data = u;
---- }
----
---- public Foo<T> GetFoo (Stack<T> stack)
---- {
---- return stack.TheFoo;
---- }
----
---- public class Baz<V>
---- {
---- public readonly V Data;
----
---- public Foo<T> GetFoo (Stack<T> stack)
---- {
---- return new Foo<T> (stack.TheData);
---- }
----
---- public Bar<V> GetBar ()
---- {
---- return new Bar<V> (Data);
---- }
----
---- public Baz (V v)
---- {
---- this.Data = v;
---- }
---- }
---- }
----
---- public void Test ()
---- {
---- Stack<T>.Foo<T> foo1 = GetFoo (TheData);
---- Foo<T> foo2 = GetFoo (TheData);
----
---- Stack<long>.Foo<T> foo3 = new Stack<long>.Foo<T> (TheData);
---- Stack<long>.Foo<float> foo4 = new Stack<long>.Foo<float> (3.14F);
----
---- Foo<double> foo5 = new Foo<double> (3.14);
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Stack<int> stack = new Stack<int> (1);
---- INode<int> node = stack.GetNode ();
---- Stack<int>.Foo<int> foo = stack.GetFoo (7);
---- Stack<int>.Bar<int> bar = stack.GetBar (8);
---- }
----}
+++ /dev/null
----// We may use type parameters as `params' type.
----
----class Stack<T>
----{
---- public void Hello (int a, params T[] args)
---- { }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Stack<string> stack = new Stack<string> ();
---- stack.Hello (1, "Hello", "World");
---- }
----}
+++ /dev/null
----// Compare this to gcs0695-*.cs: these are the allowed cases.
----
----namespace A
----{
---- interface I<X>
---- { }
----
---- interface J<X,Y> : I<X>
---- { }
----
---- class A<X> : I<X>, I<A<X>>
---- { }
----
---- class B<X> : I<B<X>>, I<X>, I<A<X>>
---- { }
----
---- class C<X> : I<int>, I<A<X>>
---- { }
----
---- class D<X> : I<A<float>>, I<B<X>>
---- { }
----
---- class E<X,Y> : J<X,Y>, J<I<X>,I<Y>>
---- { }
----
---- class F<X> : J<X,I<X>>, J<X,X>
---- { }
----}
----
----// bug #69057
----namespace B
----{
---- struct KeyValuePair<K,V>
---- { }
----
---- interface ITest<T>
---- { }
----
---- interface ITest2<K,V> : ITest<KeyValuePair<K,V>>
---- { }
----
---- class MyTest<K,V> : ITest2<K,V>, ITest<KeyValuePair<K,V>>
---- { }
----}
----
----// bug #58303
----namespace C
----{
---- class S <K> { }
----
---- interface Z<T> { }
----
---- interface I<K> : Z<S<K>> { }
----
---- class C <K> : I<K>, Z<S<K>> { }
----}
----
----class Test
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----// Static fields in generic types: this is a runtime/JIT-only test
----//
----// We need to make sure that we're instantiating each closed generic
----// type (ie. "Test<int>") only once.
----
----using System;
----
----public class Test<T>
----{
---- public static int Count;
----
---- public void Foo ()
---- {
---- Count++;
---- }
----
---- public int GetCount ()
---- {
---- return Count;
---- }
----}
----
----class X
----{
---- static int DoTheTest<T> ()
---- {
---- Test<T> test = new Test<T> ();
----
---- test.Foo ();
---- if (test.GetCount () != 1)
---- return 1;
---- if (Test<T>.Count != 1)
---- return 2;
----
---- test.Foo ();
---- if (test.GetCount () != 2)
---- return 3;
---- if (Test<T>.Count != 2)
---- return 4;
----
---- test.Foo ();
---- if (test.GetCount () != 3)
---- return 5;
---- if (Test<T>.Count != 3)
---- return 6;
----
---- return 0;
---- }
----
---- static int Main ()
---- {
---- int result = DoTheTest<int> ();
---- if (result != 0)
---- return result;
----
---- result = DoTheTest<long> () + 10;
---- if (result != 10)
---- return result;
----
---- Test<int>.Count = 0;
---- ++Test<long>.Count;
----
---- result = DoTheTest<int> () + 20;
---- if (result != 20)
---- return result;
----
---- if (Test<int>.Count != 3)
---- return 31;
---- if (Test<long>.Count != 4)
---- return 32;
---- Test<float>.Count = 5;
---- if (Test<int>.Count != 3)
---- return 33;
---- if (Test<long>.Count != 4)
---- return 34;
----
---- return 0;
---- }
----}
+++ /dev/null
----// Operators and generic types.
----
----using System;
----
----class X<T>
----{
---- public int Count;
----
---- public X (int count)
---- {
---- this.Count = count;
---- }
----
---- public static X<T> operator ++ (X<T> operand) {
---- return new X<T> (operand.Count + 1);
---- }
----}
----
----class Test
----{
---- static void Main ()
---- {
---- X<long> x = new X<long> (5);
---- Console.WriteLine (x.Count);
---- x++;
---- Console.WriteLine (x.Count);
---- }
----}
+++ /dev/null
----// Important test: Type inference
----
----class Test<A,B>
----{
---- public void Foo<U> (U u)
---- { }
----
---- public void Foo<V> (V[] v, V w)
---- { }
----
---- public void Hello<V,W> (V v, W w, Test<V,W> x)
---- { }
----
---- public void ArrayMethod<V> (params V[] args)
---- { }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Test<float,int> test = new Test<float,int> ();
---- test.Foo ("Hello World");
---- test.Foo (new long[] { 3, 4, 5 }, 9L);
---- test.Hello (3.14F, 9, test);
---- test.ArrayMethod (3.14F, (float) 9 / 3);
---- }
----}
----
+++ /dev/null
----// Generic delegates.
----
----using System;
----
----delegate void Test<T> (T t);
----
----class Foo<T>
----{
---- public event Test<T> MyEvent;
----
---- public void Hello (T t)
---- {
---- if (MyEvent != null)
---- MyEvent (t);
---- }
----}
----
----class X
----{
---- static void do_hello (string hello)
---- {
---- Console.WriteLine ("Hello: {0}", hello);
---- }
----
---- static void Main ()
---- {
---- Foo<string> foo = new Foo<string> ();
---- foo.MyEvent += new Test<string> (do_hello);
---- foo.Hello ("Boston");
---- }
----}
+++ /dev/null
----// Compiler options: -t:library
----
----namespace Foo
----{
---- public class List
---- {
---- }
----}
----
----namespace Bar
----{
---- public class List<T>
---- {
---- }
----}
+++ /dev/null
----// Compiler options: -r:gen-47-dll.dll
----
----// Important test: verify our namespace lookup rules
----//
----// There's a generic and a non-generic `List' type in two
----// different namespaces: make sure we pick the correct one.
----
----using Foo;
----using Bar;
----
----class X
----{
---- static void Main ()
---- {
---- List<int> list = new List<int> ();
---- }
----}
+++ /dev/null
----// This fixed a problem in the JIT.
----
----public class Stack<T>
----{
---- T[] data;
----
---- public Stack ()
---- {
---- data = new T [10];
---- }
----
---- public void Add (T t)
---- {
---- data [0] = t;
---- }
----}
----
----struct Foo
----{
---- int a;
----}
----
----class X
----{
---- static void Main ()
---- {
---- Foo foo = new Foo ();
---- Stack<Foo> stack = new Stack<Foo> ();
---- stack.Add (foo);
---- }
----}
+++ /dev/null
----// Important test: compare this to gcs0408-*.cs; these are the allowed cases.
----
----class X<T>
----{
---- void A (T t)
---- { }
----
---- void A (T[] t)
---- { }
----
---- void A (T[,] t)
---- { }
----
---- void A (T[][] t)
---- { }
----
---- void B (T[] t)
---- { }
----
---- void B (int t)
---- { }
----
---- void C (T[] t)
---- { }
----
---- void C (T[,] t)
---- { }
----
---- void C (int[,,] t)
---- { }
----
---- void D (int x, T y)
---- { }
----
---- void D (T x, long y)
---- { }
----}
----
----class Foo
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----class Stack<T> {
----}
----
----class Test {
----}
----
----class T {
---- static void Main()
---- {
---- Stack<Test> a;
---- }
----}
+++ /dev/null
----// Type inference when creating delegates
----
----using System;
----
----delegate int D (string s, int i);
----
----delegate int E ();
----
----class X
----{
---- public static T F<T> (string s, T t)
---- {
---- return t;
---- }
----
---- public static T G<T> ()
---- {
---- throw new ArgumentException ();
---- }
----
---- static void Main ()
---- {
---- D d1 = new D (F<int>);
---- D d2 = new D (F);
----
---- E e1 = new E (G<int>);
---- }
----}
+++ /dev/null
----using System;
----
----public class Foo<T>
---- where T : A
----{
---- public void Test (T t)
---- {
---- Console.WriteLine (t);
---- Console.WriteLine (t.GetType ());
---- t.Hello ();
---- }
----}
----
----public class A
----{
---- public void Hello ()
---- {
---- Console.WriteLine ("Hello World");
---- }
----}
----
----public class B : A
----{
----}
----
----class X
----{
---- static void Main ()
---- {
---- Foo<B> foo = new Foo<B> ();
---- foo.Test (new B ());
---- }
----}
+++ /dev/null
----// We create an instance of a type parameter which has the new() constraint.
----using System;
----
----public class Foo<T>
---- where T : new ()
----{
---- public T Create ()
---- {
---- return new T ();
---- }
----}
----
----class X
----{
---- public X ()
---- { }
----
---- void Hello ()
---- {
---- Console.WriteLine ("Hello World");
---- }
----
---- static void Main ()
---- {
---- Foo<X> foo = new Foo<X> ();
---- foo.Create ().Hello ();
---- }
----}
+++ /dev/null
----//
----// Important test: Type parameters and boxing (26.7.3).
----//
----// This tests the constrained_ prefix opcode.
----//
----using System;
----
----public interface ICounter
----{
---- void Increment ();
----}
----
----namespace ValueTypeCounters
----{
---- public struct SimpleCounter : ICounter
---- {
---- public int Value;
----
---- public void Increment ()
---- {
---- Value += 2;
---- }
---- }
----
---- public struct PrintingCounter : ICounter
---- {
---- public int Value;
----
---- public override string ToString ()
---- {
---- return Value.ToString ();
---- }
----
---- public void Increment ()
---- {
---- Value += 2;
---- }
---- }
----
---- public struct ExplicitCounter : ICounter
---- {
---- public int Value;
----
---- public override string ToString ()
---- {
---- return Value.ToString ();
---- }
----
---- void ICounter.Increment ()
---- {
---- Value++;
---- }
---- }
----
---- public struct InterfaceCounter : ICounter
---- {
---- public int Value;
----
---- public override string ToString ()
---- {
---- return Value.ToString ();
---- }
----
---- void ICounter.Increment ()
---- {
---- Value++;
---- }
----
---- public void Increment ()
---- {
---- Value += 2;
---- }
---- }
----}
----
----namespace ReferenceTypeCounters
----{
---- public class SimpleCounter : ICounter
---- {
---- public int Value;
----
---- public void Increment ()
---- {
---- Value += 2;
---- }
---- }
----
---- public class PrintingCounter : ICounter
---- {
---- public int Value;
----
---- public override string ToString ()
---- {
---- return Value.ToString ();
---- }
----
---- public void Increment ()
---- {
---- Value += 2;
---- }
---- }
----
---- public class ExplicitCounter : ICounter
---- {
---- public int Value;
----
---- public override string ToString ()
---- {
---- return Value.ToString ();
---- }
----
---- void ICounter.Increment ()
---- {
---- Value++;
---- }
---- }
----
---- public class InterfaceCounter : ICounter
---- {
---- public int Value;
----
---- public override string ToString ()
---- {
---- return Value.ToString ();
---- }
----
---- void ICounter.Increment ()
---- {
---- Value++;
---- }
----
---- public void Increment ()
---- {
---- Value += 2;
---- }
---- }
----}
----
----namespace Test
----{
---- using V = ValueTypeCounters;
---- using R = ReferenceTypeCounters;
----
---- public class Test<T>
---- where T : ICounter
---- {
---- public static void Foo (T x)
---- {
---- Console.WriteLine (x.ToString ());
---- x.Increment ();
---- Console.WriteLine (x.ToString ());
---- }
---- }
----
---- public class X
---- {
---- static void Main ()
---- {
---- Test<V.SimpleCounter>.Foo (new V.SimpleCounter ());
---- Test<V.PrintingCounter>.Foo (new V.PrintingCounter ());
---- Test<V.ExplicitCounter>.Foo (new V.ExplicitCounter ());
---- Test<V.InterfaceCounter>.Foo (new V.InterfaceCounter ());
---- Test<R.SimpleCounter>.Foo (new R.SimpleCounter ());
---- Test<R.PrintingCounter>.Foo (new R.PrintingCounter ());
---- Test<R.ExplicitCounter>.Foo (new R.ExplicitCounter ());
---- Test<R.InterfaceCounter>.Foo (new R.InterfaceCounter ());
---- }
---- }
----}
+++ /dev/null
----//
----// Conversions involving type parameters (26.7.4).
----// This is a compilation-only test since some of the explict
----// conversions would trigger an InvalidCastException.
----//
----
----using System;
----
----interface Foo
----{
---- void Hello ();
----}
----
----class A
----{ }
----
----class B : A, Foo
----{
---- public void Hello ()
---- { }
----
---- public static implicit operator C (B b)
---- {
---- return new C ();
---- }
----}
----
----class C
----{
---- public static explicit operator B (C c)
---- {
---- return new B ();
---- }
----}
----
----class Test
----{
---- static void Simple<T> (T t)
---- {
---- object o = t;
---- t = (T) o;
---- Foo foo = (Foo) t;
---- t = (T) foo;
---- }
----
---- static void Interface<T> (T t)
---- where T : Foo
---- {
---- Foo foo = t;
---- }
----
---- static void Class<T> (T t)
---- where T : B
---- {
---- B b = t;
---- A a = t;
---- Foo foo = t;
---- t = (T) b;
---- t = (T) a;
---- t = (T) foo;
---- C c = t;
---- t = (T) c;
---- }
----
---- static void Array<T> (T[] t)
---- {
---- object o = t;
---- Array a = t;
---- t = (T []) o;
---- t = (T []) a;
---- }
----
---- static void Main ()
---- { }
----}
+++ /dev/null
----// Using constructed types in a namespace alias.
----
----namespace N1
----{
---- class A<T>
---- {
---- public class B { }
----
---- public class C<U> { }
---- }
----
---- class C { }
----}
----
----namespace N2
----{
---- using Y = N1.A<int>;
----
---- class X
---- {
---- static void Main ()
---- {
---- Y y = new Y ();
---- Y.B b = new Y.B ();
---- Y.C<long> c = new Y.C<long> ();
---- }
---- }
----}
+++ /dev/null
----//-- ex-gen-logger
----//-- ex-gen-struct-pair
----//-- ex-gen-logging-pairs
----// 1.2 alpha
----
----using System;
----
----public class Log<T> {
---- private const int SIZE = 5;
---- private static int instanceCount = 0;
---- private int count = 0;
---- private T[] log = new T[SIZE];
---- public Log() { instanceCount++; }
---- public static int InstanceCount { get { return instanceCount; } }
---- public void Add(T msg) { log[count++ % SIZE] = msg; }
---- public int Count { get { return count; } }
---- public T Last {
---- get { // Return the last log entry, or null if nothing logged yet
---- return count==0 ? default(T) : log[(count-1)%SIZE];
---- }
---- set { // Update the last log entry, or create one if nothing logged yet
---- if (count==0)
---- log[count++] = value;
---- else
---- log[(count-1)%SIZE] = value;
---- }
---- }
---- public T[] All {
---- get {
---- int size = Math.Min(count, SIZE);
---- T[] res = new T[size];
---- for (int i=0; i<size; i++)
---- res[i] = log[(count-size+i) % SIZE];
---- return res;
---- }
---- }
----}
----
----class TestLog {
---- class MyTest {
---- public static void Main(String[] args) {
---- Log<String> log1 = new Log<String>();
---- log1.Add("Reboot");
---- log1.Add("Coffee");
---- Log<DateTime> log2 = new Log<DateTime>();
---- log2.Add(DateTime.Now);
---- log2.Add(DateTime.Now.AddHours(1));
---- DateTime[] dts = log2.All;
---- // Printing both logs:
---- foreach (String s in log1.All)
---- Console.Write("{0} ", s);
---- Console.WriteLine();
---- foreach (DateTime dt in dts)
---- Console.Write("{0} ", dt);
---- Console.WriteLine();
---- }
---- }
----}
+++ /dev/null
----using System;
----
----interface IHello<T>
----{
---- void Print (T t);
----}
----
----interface Foo
----{
---- IHello<U> Test<U> ();
----}
----
----class Hello<T> : IHello<T>, Foo
----{
---- public void Print (T t)
---- {
---- Console.WriteLine ("Hello: {0}", t);
---- }
----
---- public IHello<U> Test<U> ()
---- {
---- return new Hello<U> ();
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Hello<int> hello = new Hello<int> ();
---- hello.Print (5);
---- hello.Test<float> ().Print (3.14F);
----
---- IHello<string> foo = hello.Test<string> ();
---- foo.Print ("World");
---- }
----}
+++ /dev/null
----class Foo {
---- static void Main () {}
----}
----
----class Foo <T> {
---- static Foo <T> x;
---- static Foo <T> Blah { get { return x; } }
----}
+++ /dev/null
----namespace N {
---- interface A <T> {
---- }
----}
----class X <T> : N.A <T> {
----}
----class Foo {
---- static void Main () {}
----}
+++ /dev/null
----// Using an array of a type parameter.
----
----class Stack<T>
----{
---- int size;
---- T[] data;
----
---- public Stack ()
---- {
---- data = new T [200];
---- }
----
---- public void Push (T item)
---- {
---- data [size++] = item;
---- }
----
---- public T Pop ()
---- {
---- return data [--size];
---- }
----
---- public void Hello (T t)
---- {
---- System.Console.WriteLine ("Hello: {0}", t);
---- }
----}
----
----class Test
----{
---- static void Main ()
---- {
---- }
----}
+++ /dev/null
----using System;
----
----interface IFoo
----{
---- MyList<U> Map<U> ();
----}
----
----class MyList<T>
----{
---- public void Hello (T t)
---- {
---- Console.WriteLine (t);
---- }
----}
----
----class Foo : IFoo
----{
---- public MyList<T> Map<T> ()
---- {
---- return new MyList<T> ();
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Foo foo = new Foo ();
---- MyList<int> list = foo.Map<int> ();
---- list.Hello (9);
---- }
----}
+++ /dev/null
----using System;
----
----public delegate B Test<A,B> (A a);
----
----public class Foo<T>
----{
---- T t;
----
---- public Foo (T t)
---- {
---- this.t = t;
---- }
----
---- public U Method<U> (Test<T,U> test)
---- {
---- return test (t);
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Test<double,int> test = new Test<double,int> (Math.Sign);
----
---- Foo<double> foo = new Foo<double> (Math.PI);
---- Console.WriteLine (foo.Method<int> (test));
----
---- string s = foo.Method<string> (delegate (double d) { return "s" + d; });
---- Console.WriteLine (s);
---- }
----}
+++ /dev/null
----using System.Collections.Generic;
----
----class X
----{
---- public IEnumerable<int> Test (int a, long b)
---- {
---- while (a < b) {
---- a++;
---- yield return a;
---- }
---- }
----
---- static int Main ()
---- {
---- X x = new X ();
---- int sum = 0;
---- foreach (int i in x.Test (3, 8L))
---- sum += i;
----
---- return sum == 30 ? 0 : 1;
---- }
----}
+++ /dev/null
----using System;
----
----public class Test
----{
---- public static int IndexOf (Array array, object value)
---- {
---- // This is picking the non-generic version.
---- return IndexOf (array, value, 0, array.Length);
---- }
----
---- public static int IndexOf (Array array, object value, int startIndex, int count)
---- {
---- return 2;
---- }
----
---- public static int IndexOf<T> (T[] array, T value, int startIndex, int count)
---- {
---- return 1;
---- }
----}
----
----class X
----{
---- static int Main ()
---- {
---- Test test = new Test ();
---- string[] array = new string [] { "Hello" };
----
---- int result = Test.IndexOf (array, array);
---- if (result != 2)
---- return 1;
----
---- string hello = "Hello World";
---- // This is picking the generic version.
---- result = Test.IndexOf (array, hello, 1, 2);
---- if (result != 1)
---- return 2;
----
---- return 0;
---- }
----}
+++ /dev/null
----using System;
----
----public interface IHello<T>
----{ }
----
----public interface IFoo<T>
----{
---- IHello<T> GetHello ();
----}
----
----public interface IBar<T> : IFoo<T>
----{ }
----
----public class Foo<T> : IBar<T>, IFoo<T>
----{
---- public Hello GetHello ()
---- {
---- return new Hello (this);
---- }
----
---- IHello<T> IFoo<T>.GetHello ()
---- {
---- return new Hello (this);
---- }
----
---- public class Hello : IHello<T>
---- {
---- public readonly Foo<T> Foo;
----
---- public Hello (Foo<T> foo)
---- {
---- this.Foo = foo;
---- }
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----//-- ex-gen-type-parameter-in-constraint
----
----using System;
----using System.Collections.Generic;
----
----// A constraint may involve type parameters
----// A type may have multiple constraints
----
----struct ComparablePair<T,U> : IComparable<ComparablePair<T,U>>
---- where T : IComparable<T>
---- where U : IComparable<U> {
---- public readonly T Fst;
---- public readonly U Snd;
----
---- public ComparablePair(T fst, U snd) {
---- Fst = fst; Snd = snd;
---- }
----
---- // Lexicographic ordering
---- public int CompareTo(ComparablePair<T,U> that) {
---- int firstCmp = this.Fst.CompareTo(that.Fst);
---- return firstCmp != 0 ? firstCmp : this.Snd.CompareTo(that.Snd);
---- }
----
---- public bool Equals(ComparablePair<T,U> that) {
---- return this.Fst.Equals(that.Fst) && this.Snd.Equals(that.Snd);
---- }
----
---- public override String ToString() {
---- return "(" + Fst + ", " + Snd + ")";
---- }
----}
----
----// Sorting soccer world champions by country and year
----
----class MyTest {
---- static void Test ()
---- {
---- new ComparablePair<string,int>("Brazil", 2002);
---- }
----
---- public static void Main(string[] args) {
---- List<ComparablePair<string,int>> lst
---- = new List<ComparablePair<string,int>>();
---- lst.Add(new ComparablePair<String,int>("Brazil", 2002));
---- lst.Add(new ComparablePair<String,int>("Italy", 1982));
---- lst.Add(new ComparablePair<String,int>("Argentina", 1978 ));
---- lst.Add(new ComparablePair<String,int>("Argentina", 1986 ));
---- lst.Add(new ComparablePair<String,int>("Germany", 1990));
---- lst.Add(new ComparablePair<String,int>("Brazil", 1994));
---- lst.Add(new ComparablePair<String,int>("France", 1998));
---- // lst.Sort();
---- foreach (ComparablePair<String,int> pair in lst)
---- Console.WriteLine(pair);
---- }
----}
+++ /dev/null
----using System;
----
----public class Foo<T>
----{
----}
----
----class X
----{
---- static void Main ()
---- {
---- Console.WriteLine (typeof (Foo<>));
---- }
----}
+++ /dev/null
----class Test
----{
---- public delegate int Foo<T> (T t, T u);
----
---- public void Hello<U> (Foo<U> foo, U u)
---- { }
----}
----
----class X
----{
---- static int Add (int a, int b)
---- {
---- return a + b;
---- }
----
---- static void Main ()
---- {
---- Test test = new Test ();
---- test.Hello<int> (new Test.Foo<int> (Add), 5);
---- }
----}
+++ /dev/null
----namespace Martin
----{
---- public class Foo<T>
---- { }
----}
----
----namespace Baulig
----{
---- using M = Martin;
----
---- class X
---- {
---- static void Main ()
---- {
---- M.Foo<int> foo;
---- }
---- }
----}
+++ /dev/null
----public interface IFoo
----{
---- int GetHashCode ();
----}
----
----public interface IFoo<T>
----{
---- int GetHashCode ();
----}
----
----public class Test<T>
----{
---- public int Foo (IFoo<T> foo)
---- {
---- return foo.GetHashCode ();
---- }
----
---- public int Foo (IFoo foo)
---- {
---- return foo.GetHashCode ();
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----class Stack<T> : X
----{
----}
----
----class Test
----{
----}
----
----class X
----{
---- static void Main()
---- {
---- }
----}
+++ /dev/null
----namespace Martin
----{
---- public class Test<T>
---- {
---- public static int Foo ()
---- {
---- return 0;
---- }
---- }
----}
----
----class Foo<T>
----{
---- public Foo (int a)
---- { }
----
---- public Foo ()
---- : this (Martin.Test<T>.Foo ())
---- { }
----}
----
----class X
----{
---- static void Main ()
---- {
---- }
----}
+++ /dev/null
----using System;
----
----class Foo<T>
----{
---- public T Test<U> (U u)
---- where U : T
---- {
---- return u;
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- Foo<X> foo = new Foo<X> ();
----
---- Y y = new Y ();
---- X x = foo.Test<Y> (y);
---- }
----}
----
----class Y : X
----{
----}
+++ /dev/null
----//-- ex-gen-logger
----//-- ex-gen-struct-pair
----//-- ex-gen-logging-pairs
----// 1.2 alpha
----
----using System;
----
----public class Log<T> {
---- private const int SIZE = 5;
---- private static int instanceCount = 0;
---- private int count = 0;
---- private T[] log = new T[SIZE];
---- public Log() { instanceCount++; }
---- public static int InstanceCount { get { return instanceCount; } }
---- public void Add(T msg) { log[count++ % SIZE] = msg; }
---- public int Count { get { return count; } }
---- public T Last {
---- get { // Return the last log entry, or null if nothing logged yet
---- return count==0 ? default(T) : log[(count-1)%SIZE];
---- }
---- set { // Update the last log entry, or create one if nothing logged yet
---- if (count==0)
---- log[count++] = value;
---- else
---- log[(count-1)%SIZE] = value;
---- }
---- }
---- public T[] All {
---- get {
---- int size = Math.Min(count, SIZE);
---- T[] res = new T[size];
---- for (int i=0; i<size; i++)
---- res[i] = log[(count-size+i) % SIZE];
---- return res;
---- }
---- }
----}
----
----class TestLog {
---- class MyTest {
---- public static void Main(String[] args) {
---- Log<String> log1 = new Log<String>();
---- log1.Add("Reboot");
---- log1.Add("Coffee");
---- Log<DateTime> log2 = new Log<DateTime>();
---- log2.Add(DateTime.Now);
---- log2.Add(DateTime.Now.AddHours(1));
---- DateTime[] dts = log2.All;
---- // Printing both logs:
---- foreach (String s in log1.All)
---- Console.Write("{0} ", s);
---- Console.WriteLine();
---- foreach (DateTime dt in dts)
---- Console.Write("{0} ", dt);
---- Console.WriteLine();
---- TestPairLog();
---- }
----
---- public static void TestPairLog() {
---- Log<Pair<DateTime,String>> log = new Log<Pair<DateTime,String>>();
---- log.Add(new Pair<DateTime,String>(DateTime.Now, "Tea leaves"));
---- log.Add(new Pair<DateTime,String>(DateTime.Now.AddMinutes(2), "Hot water"));
---- log.Add(new Pair<DateTime,String>(DateTime.Now.AddMinutes(7), "Ready"));
---- Pair<DateTime,String>[] allMsgs = log.All;
---- foreach (Pair<DateTime,String> p in allMsgs)
---- Console.WriteLine("At {0}: {1}", p.Fst, p.Snd);
---- }
---- }
----}
----
----public struct Pair<T,U> {
---- public readonly T Fst;
---- public readonly U Snd;
---- public Pair(T fst, U snd) {
---- this.Fst = fst;
---- this.Snd = snd;
---- }
----}
+++ /dev/null
----using System;
----using System.Collections;
----using System.Collections.Generic;
----
----class MyList<T> : IEnumerable<T>
----{
---- public IEnumerator<T> GetEnumerator ()
---- {
---- yield break;
---- }
----
---- IEnumerator IEnumerable.GetEnumerator ()
---- {
---- return GetEnumerator ();
---- }
----}
----
----struct Foo<T>
----{
---- public readonly T Data;
----
---- public Foo (T data)
---- {
---- this.Data = data;
---- }
----}
----
----class X
----{
---- static void Main ()
---- {
---- MyList<Foo<int>> list = new MyList <Foo<int>> ();
---- foreach (Foo<int> foo in list)
---- ;
---- }
----}
+++ /dev/null
----using System;
----
----public struct Foo<T>
----{
---- public T Data, Data2;
----
---- public Foo (T a, T b)
---- {
---- this.Data = a;
---- this.Data2 = b;
---- }
----}
----
----public class Test<T>
----{
---- public T Data, Data2;
----
---- public Test (T a, T b)
---- {
---- this.Data = a;
---- this.Data2 = b;
---- }
----}
----
----class X
----{
---- static int Main ()
---- {
---- Foo<long> foo = new Foo<long> (3, 5);
---- if (foo.Data != 3)
---- return 1;
---- if (foo.Data2 != 5)
---- return 2;
----
---- Test<long> test = new Test<long> (3, 5);
---- if (test.Data != 3)
---- return 3;
---- if (test.Data2 != 5)
---- return 4;
----
---- return 0;
---- }
----}
+++ /dev/null
----public interface IExtensible<T>
----{
---- void AddAll<U> (U item)
---- where U : T;
----}
----
----public class ArrayList<T> : IExtensible<T>
----{
---- void IExtensible<T>.AddAll<U> (U item)
---- { }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----struct Foo<T>
----{
---- public T Data;
----
---- public Foo (T data)
---- {
---- this.Data = data;
---- }
----}
----
----class Test<T>
----{
---- public Foo<T> GetFoo (T data)
---- {
---- return new Foo<T> (data);
---- }
----}
----
----class X
----{
---- static int Main ()
---- {
---- Test<long> test = new Test<long> ();
---- Foo<long> foo = test.GetFoo (0x800);
---- //
---- // This is a very simple test, just make sure the struct
---- // is returned correctly. This was broken until recently
---- // and I just fixed it on amd64.
---- if (foo.Data != 0x800)
---- return 1;
---- return 0;
---- }
----}
----
+++ /dev/null
----// Compiler options: -r:System
----using System;
----using System.Collections.Generic;
----
----public class X {
---- public static void Main(string[] args)
---- {
---- Collection<int> list = new Collection<int>();
---- list.Add (3);
---- foreach (int i in list) {
---- Console.WriteLine(i);
---- }
---- }
----}
+++ /dev/null
----using System;
----using System.Collections;
----
----public class Test
----{
---- public static void Main ()
---- {
---- foreach (object o in new Test ())
---- Console.WriteLine (o);
---- }
----
---- public IEnumerator GetEnumerator ()
---- {
---- foreach (int i in new ArrayList ())
---- yield return i;
---- }
----}
+++ /dev/null
----namespace A
----{
---- public interface IExtensible<T>
---- {
---- void AddAll<U> (U u)
---- where U : T;
---- }
----
---- public class ArrayList<T> : IExtensible<T>
---- {
---- void IExtensible<T>.AddAll<U> (U u)
---- {
---- InsertAll (u);
---- }
----
---- void InsertAll (T t)
---- { }
---- }
----}
----
----namespace B
----{
---- public interface IExtensible<S,T>
---- {
---- void AddAll<U> (U t)
---- where U : S;
---- }
----
---- public class ArrayList<X,Y> : IExtensible<Y,X>
---- {
---- public void AddAll<Z> (Z z)
---- where Z : Y
---- {
---- InsertAll (z);
---- }
----
---- void InsertAll (Y y)
---- { }
---- }
----}
----
----namespace C
----{
---- public interface IExtensible<S>
---- {
---- void AddAll<T> (T t)
---- where T : S;
---- }
----
---- public class Foo<U>
---- { }
----
---- public class ArrayList<X> : IExtensible<Foo<X>>
---- {
---- public void AddAll<Y> (Y y)
---- where Y : Foo<X>
---- {
---- InsertAll (y);
---- }
----
---- void InsertAll (Foo<X> foo)
---- { }
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----interface I
----{
---- void Hello ();
----}
----
----class Stack<T>
---- where T : I, new ()
----{
----}
----
----class Test
----{
----}
----
----class X
----{
---- static void Main()
---- {
---- }
----}
+++ /dev/null
----public interface IFoo<X>
----{ }
----
----public class Test
----{
---- public void Hello<T> (IFoo<T> foo)
---- {
---- InsertAll (foo);
---- }
----
---- public void InsertAll<U> (IFoo<U> foo)
---- { }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----public class ArrayList<T>
----{
---- void AddAll<U> (U u)
---- where U : T
---- {
---- InsertAll (u);
---- }
----
---- void InsertAll (T t)
---- { }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----public class Queue<T>
----{
---- protected class Enumerator
---- {
---- Queue<T> queue;
----
---- public Enumerator (Queue<T> queue)
---- {
---- this.queue = queue;
---- }
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----public class CollectionValueBase<T>
----{
---- public virtual T[] ToArray()
---- {
---- return null;
---- }
----}
----
----public class CollectionBase<T>: CollectionValueBase<T>
----{
----}
----
----public class SequencedBase<T>: CollectionBase<T>
----{
----}
----
----public class ArrayBase<T>: SequencedBase<T>
----{
---- public override T[] ToArray()
---- {
---- return null;
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----namespace HasherBuilder
----{
---- public class ByPrototype<S>
---- {
---- public static IHasher<S> Examine()
---- {
---- return null;
---- }
---- }
----}
----
----public interface IHasher<T>
----{
----}
----
----public class ArrayList<U>
----{
---- public IHasher<U> GetHasher ()
---- {
---- return HasherBuilder.ByPrototype<U>.Examine();
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
----
+++ /dev/null
----using System;
----
----public interface IFoo<S>
----{ }
----
----public class ArrayList<T>
----{
---- public virtual int InsertAll (IFoo<T> foo)
---- {
---- return 0;
---- }
----
---- public virtual int InsertAll<U> (IFoo<U> foo)
---- where U : T
---- {
---- return 1;
---- }
----
---- public virtual int AddAll (IFoo<T> foo)
---- {
---- return InsertAll (foo);
---- }
----}
----
----class X
----{
---- static int Main ()
---- {
---- ArrayList<int> list = new ArrayList<int> ();
---- return list.AddAll (null);
---- }
----}
+++ /dev/null
----public interface IFoo<S>
----{ }
----
----public class ArrayList<T>
----{
---- public virtual int InsertAll (IFoo<T> foo)
---- {
---- return 0;
---- }
----
---- public virtual int InsertAll<U> (IFoo<U> foo)
---- where U : T
---- {
---- return 1;
---- }
----
---- public virtual int AddAll (IFoo<T> foo)
---- {
---- return InsertAll (foo);
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----namespace C5
----{
---- public class HashedArrayList<T>
---- {
---- public void Test ()
---- {
---- new HashSet <KeyValuePair<T,int>> (new KeyValuePairHasher<T,int> ());
---- }
---- }
----
---- public class HashSet<T>
---- {
---- public HashSet (IHasher<T> itemhasher)
---- { }
---- }
----
---- public interface IHasher<T>
---- {
---- }
----
---- public struct KeyValuePair<K,V>
---- {
---- }
----
---- public sealed class KeyValuePairHasher<K,V>: IHasher<KeyValuePair<K,V>>
---- {
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----public struct KeyValuePair<K,V>
----{
---- public KeyValuePair (K k, V v)
---- { }
----
---- public KeyValuePair (K k)
---- { }
----}
----
----class X
----{
---- static void Main ()
---- {
---- new KeyValuePair<int,long> ();
---- }
----}
+++ /dev/null
----using System;
----
----class Test<T>
----{
---- public void Foo (T t, out int a)
---- {
---- a = 5;
---- }
----
---- public void Hello (T t)
---- {
---- int a;
----
---- Foo (t, out a);
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----interface I
----{
---- void Hello ();
----}
----
----class Stack<T>
---- where T : ICloneable
----{
---- public object Test (T t)
---- {
---- return t.Clone ();
---- }
----}
----
----class Test
----{
----}
----
----class X
----{
---- static void Main()
---- {
---- }
----}
+++ /dev/null
----using System;
----
----public abstract class Foo<T>
----{
---- public virtual T InsertAll<U> (U u)
---- where U : T
---- {
---- return u;
---- }
----}
----
----public class Bar<T> : Foo<T>
----{
---- public override T InsertAll<U> (U u)
---- {
---- return u;
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----public class Foo<T>
----{
---- Node node;
----
---- public Node Test<V> ()
---- {
---- return node;
---- }
----
---- public class Node
---- { }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----public class Element<T>
----{
---- public readonly T Item;
----
---- public Element (T item)
---- {
---- this.Item = item;
---- }
----
---- public void GetItem (out T retval)
---- {
---- retval = Item;
---- }
----
---- public T GetItem (int a, ref T data)
---- {
---- return Item;
---- }
----
---- public void SetItem (T data)
---- { }
----}
----
----public class Foo<T>
----{
---- Element<Node> element;
----
---- public Node Test ()
---- {
---- Node node = element.Item;
---- element.GetItem (out node);
---- element.SetItem (node);
---- return element.GetItem (3, ref node);
---- }
----
---- public class Node
---- {
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----public class Foo<T>
----{
---- public readonly T Item;
----
---- public Foo (T item)
---- {
---- this.Item = item;
---- }
----
---- static void maketreer (out Node rest)
---- {
---- rest = new Node ();
---- }
----
---- class Node
---- { }
----
---- public void Hello<U> ()
---- {
---- Foo<U>.Node node;
---- Foo<U>.maketreer (out node);
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----public class LinkedList<T>
----{
---- protected class Node
---- { }
----}
----
----public class HashedLinkedList<T> : LinkedList<T>
----{
---- Node node;
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;
----
----public interface IDirectedEnumerable<T>
----{
---- IDirectedEnumerable<T> Backwards();
----}
----
----public interface IDirectedCollectionValue<T> : IDirectedEnumerable<T>
----{
---- new IDirectedCollectionValue<T> Backwards();
----}
----
----public class GuardedCollectionValue<T> : IDirectedCollectionValue<T>
----{
---- IDirectedEnumerable<T> IDirectedEnumerable<T>.Backwards ()
---- {
---- return this;
---- }
----
---- public IDirectedCollectionValue<T> Backwards ()
---- {
---- return this;
---- }
----}
----
----public interface ISequenced<T> : IDirectedCollectionValue<T>
----{
----}
----
----public class GuardedSequenced<T>
----{
---- ISequenced<T> sequenced;
----
---- public IDirectedCollectionValue<T> Test ()
---- {
---- return sequenced.Backwards();
---- }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----using System;\r
----\r
----class Foo<T>\r
----{ }\r
----\r
----class Test\r
----{\r
---- static void Hello<T> (Foo<T>[] foo, int i)\r
---- {\r
---- Foo<T> element = foo [0];\r
---- Console.WriteLine (element);\r
---- if (i > 0)\r
---- Hello<T> (foo, i - 1);\r
---- }\r
----\r
---- public static void Quicksort<U> (Foo<U>[] arr)\r
---- {\r
---- Hello<U> (arr, 1);\r
---- }\r
----\r
---- static void Main ()\r
---- {\r
---- Foo<int>[] foo = new Foo<int> [1];\r
---- foo [0] = new Foo<int> ();\r
---- Quicksort (foo);\r
---- }\r
----}\r
+++ /dev/null
----public interface IFoo
----{
---- void Test<T> ();
----
---- void Test<U,V> ();
----}
----
----public class Foo : IFoo
----{
---- void IFoo.Test<X> ()
---- { }
----
---- void IFoo.Test<Y,Z> ()
---- { }
----}
----
----public interface IBar<T>
----{
---- void Test ();
----}
----
----public interface IBar<U,V>
----{
---- void Test ();
----}
----
----public class Bar<X,Y,Z> : IBar<X>, IBar<Y,Z>
----{
---- void IBar<X>.Test ()
---- { }
----
---- void IBar<Y,Z>.Test ()
---- { }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
+++ /dev/null
----// Compiler options: -t:library
----
----public interface IFoo
----{
---- void Test<T> ();
----
---- void Test<U,V> ();
----}
----
----public interface IBar<T>
----{
---- void Test ();
----}
----
----public interface IBar<U,V>
----{
---- void Test ();
----}
+++ /dev/null
----// Compiler options: /r:gen-98-dll.dll
----public class Foo : IFoo
----{
---- void IFoo.Test<X> ()
---- { }
----
---- void IFoo.Test<Y,Z> ()
---- { }
----}
----
----public class Bar<X,Y,Z> : IBar<X>, IBar<Y,Z>
----{
---- void IBar<X>.Test ()
---- { }
----
---- void IBar<Y,Z>.Test ()
---- { }
----}
----
----class X
----{
---- static void Main ()
---- { }
----}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Stack < type > {
++++
++++}
++++
++++class Boot {
++++ static void Main ()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Cell <X> {
++++ X value;
++++
++++}
++++
++++class D {
++++ static void Main ()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Stack<T> {
++++}
++++
++++class Test {
++++}
++++
++++class T {
++++ Stack<Test> a;
++++
++++ static void Main()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Stack<T> {
++++}
++++
++++class Test {
++++}
++++
++++class T {
++++ public void Foo (Stack<Test> a)
++++ { }
++++
++++ static void Main()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Stack<T> {
++++}
++++
++++class Test {
++++}
++++
++++class T {
++++ static void Main()
++++ {
++++ Stack<Test> a;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Using an array of a type parameter.
++++
++++class Stack<T>
++++{
++++ int size;
++++ T[] data;
++++
++++ public Stack ()
++++ {
++++ data = new T [200];
++++ }
++++
++++ public void Push (T item)
++++ {
++++ data [size++] = item;
++++ }
++++
++++ public T Pop ()
++++ {
++++ return data [--size];
++++ }
++++
++++ public void Hello (T t)
++++ {
++++ System.Console.WriteLine ("Hello: {0}", t);
++++ }
++++}
++++
++++class Test
++++{
++++ static void Main ()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Stack<T> : X
++++{
++++}
++++
++++class Test
++++{
++++}
++++
++++class X
++++{
++++ static void Main()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++interface I
++++{
++++ void Hello ();
++++}
++++
++++class Stack<T>
++++ where T : I, new ()
++++{
++++}
++++
++++class Test
++++{
++++}
++++
++++class X
++++{
++++ static void Main()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++interface I
++++{
++++ void Hello ();
++++}
++++
++++class Stack<T>
++++ where T : ICloneable
++++{
++++ public object Test (T t)
++++ {
++++ return t.Clone ();
++++ }
++++}
++++
++++class Test
++++{
++++}
++++
++++class X
++++{
++++ static void Main()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Type parameters with constraints: check whether we can invoke
++++// things on the constrained type.
++++
++++using System;
++++
++++interface I
++++{
++++ void Hello ();
++++}
++++
++++class J
++++{
++++ public void Foo ()
++++ {
++++ Console.WriteLine ("Foo!");
++++ }
++++}
++++
++++class Stack<T>
++++ where T : J, I
++++{
++++ public void Test (T t)
++++ {
++++ t.Hello ();
++++ t.Foo ();
++++ }
++++}
++++
++++class Test
++++{
++++}
++++
++++class X
++++{
++++ static void Main()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Stack<S>
++++{
++++ public void Hello (S s)
++++ { }
++++}
++++
++++class X
++++{
++++ Stack<int> stack;
++++
++++ void Test ()
++++ {
++++ stack.Hello (3);
++++ }
++++
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// A generic type definition may have another generic type
++++// definition as its parent.
++++
++++class Stack<S>
++++{
++++ public void Hello (S s)
++++ { }
++++}
++++
++++class Test<T> : Stack<T>
++++{
++++ public void Foo (T t)
++++ { }
++++}
++++
++++class X
++++{
++++ Test<int> test;
++++
++++ void Test ()
++++ {
++++ test.Foo (4);
++++ test.Hello (3);
++++ }
++++
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++public class Stack<S>
++++{
++++ public void Hello (S s)
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:gtest-013-lib.dll
++++
++++public class X
++++{
++++ Stack<int> stack;
++++
++++ void Test ()
++++ {
++++ stack.Hello (3);
++++ }
++++
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public class Stack<S>
++++{
++++ public Stack (S s)
++++ { }
++++
++++ public void Push (S s)
++++ { }
++++}
++++
++++public class X
++++{
++++ static void Main ()
++++ {
++++ Stack<int> s1 = new Stack<int> (3);
++++ s1.Push (4);
++++
++++ Stack<string> s2 = new Stack<string> ("Hello");
++++ s2.Push ("Test");
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Very simple example of a generic method.
++++
++++class Stack<S>
++++{
++++ public static void Hello<T,U> (S s, T t, U u)
++++ {
++++ U v = u;
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// A generic method may also use the type parameters
++++// from its enclosing type.
++++
++++class Stack<S>
++++{
++++ public static void Hello<T> (S s, T t)
++++ { }
++++}
++++
++++class X
++++{
++++ Stack<int> stack;
++++
++++ static void Main ()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++public class Stack
++++{
++++ public Stack ()
++++ { }
++++
++++ public void Hello<T> (T t)
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:gtest-017-lib.dll
++++
++++public class X
++++{
++++ public static void Foo (Stack stack)
++++ {
++++ stack.Hello<string> ("Hello World");
++++ }
++++
++++ static void Main ()
++++ {
++++ Stack stack = new Stack ();
++++ Foo (stack);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public class Stack
++++{
++++ public Stack ()
++++ { }
++++
++++ public void Hello<T> (T t)
++++ { }
++++}
++++
++++public class X
++++{
++++ public static void Foo (Stack stack)
++++ {
++++ stack.Hello<string> ("Hello World");
++++ }
++++
++++ static void Main ()
++++ {
++++ Stack stack = new Stack ();
++++ Foo (stack);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// A very simple generic interface
++++
++++public interface IEnumerator<T> {
++++ T Current { get; }
++++ bool MoveNext();
++++ void Reset();
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++struct Stack<S>
++++{
++++ public void Hello (S s)
++++ { }
++++}
++++
++++class X
++++{
++++ Stack<int> stack;
++++
++++ void Test ()
++++ {
++++ stack.Hello (3);
++++ }
++++
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Testing the default value expressions (14.5.13)
++++
++++using System;
++++
++++class Foo<T>
++++{
++++ T[] t;
++++
++++ public Foo (int n)
++++ {
++++ t = new T [n];
++++ for (int i = 0; i < n; i++)
++++ t [i] = default (T);
++++ }
++++
++++ public void Test ()
++++ {
++++ X.Print (t [0]);
++++ }
++++}
++++
++++class Bar<T>
++++{
++++ public void Test ()
++++ {
++++ X.Print (default (X));
++++ X.Print (default (T));
++++ X.Print (default (S));
++++ }
++++}
++++
++++struct S
++++{
++++ public readonly string Hello;
++++
++++ S (string hello)
++++ {
++++ this.Hello = hello;
++++ }
++++
++++ public override string ToString ()
++++ {
++++ return String.Format ("S({0})", Hello);
++++ }
++++
++++}
++++
++++class X
++++{
++++ public static void Print (object obj)
++++ {
++++ if (obj == null)
++++ Console.WriteLine ("NULL");
++++ else
++++ Console.WriteLine ("OBJECT: {0} {1}", obj, obj.GetType ());
++++ }
++++
++++ static void Main ()
++++ {
++++ Foo<string> a = new Foo<string> (4);
++++ a.Test ();
++++
++++ Bar<int> b = new Bar<int> ();
++++ b.Test ();
++++ Bar<X> c = new Bar<X> ();
++++ c.Test ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// A non-generic type may have a closed constructed type as its parent
++++
++++class Foo<T>
++++{
++++ public void Hello ()
++++ { }
++++
++++ public void World (T t)
++++ {
++++ Hello ();
++++ }
++++}
++++
++++class Bar : Foo<int>
++++{
++++ public void Test ()
++++ {
++++ Hello ();
++++ World (4);
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Bar bar = new Bar ();
++++ bar.Test ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Foo<T>
++++{
++++ public void Hello ()
++++ { }
++++
++++ public void World (T t)
++++ {
++++ Hello ();
++++ }
++++}
++++
++++//
++++// This is some kind of a `recursive' declaration:
++++//
++++// Note that we're using the class we're currently defining (Bar)
++++// as argument of its parent.
++++//
++++// Is is important to run the resulting executable since this is
++++// both a test for the compiler and the runtime.
++++//
++++
++++class Bar : Foo<Bar>
++++{
++++ public void Test ()
++++ {
++++ Hello ();
++++ World (this);
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Foo<T>
++++{
++++ public Foo ()
++++ { }
++++
++++ public void Hello (T t)
++++ {
++++ // We're boxing the type parameter `T' to an object here.
++++ Whatever (t);
++++ }
++++
++++ public void Whatever (object o)
++++ {
++++ System.Console.WriteLine (o.GetType ());
++++ }
++++}
++++
++++class X
++++{
++++ static void Test (Foo<int> foo)
++++ {
++++ foo.Hello (4);
++++ }
++++
++++ static void Main ()
++++ {
++++ Foo<int> foo = new Foo<int> ();
++++ Test (foo);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Foo
++++{
++++ public Foo ()
++++ { }
++++
++++ public void Hello<T> (T t)
++++ {
++++ // We're boxing the type parameter `T' to an object here.
++++ Whatever (t);
++++ }
++++
++++ public void Whatever (object o)
++++ {
++++ System.Console.WriteLine (o.GetType ());
++++ }
++++}
++++
++++class X
++++{
++++ static void Test (Foo foo)
++++ {
++++ foo.Hello<int> (531);
++++ }
++++
++++ static void Main ()
++++ {
++++ Foo foo = new Foo ();
++++ Test (foo);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Test access to class fields outside the generic type declaration.
++++
++++class Foo<T>
++++{
++++ public T Hello;
++++
++++ public Foo ()
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Foo<int> foo = new Foo<int> ();
++++ foo.Hello = 9;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// A generic type declaration may have a non-generic base type.
++++
++++class TheBase
++++{
++++ public void BaseFunc ()
++++ { }
++++}
++++
++++class Stack<S> : TheBase
++++{
++++ public void Hello (S s)
++++ { }
++++}
++++
++++class Test<T> : Stack<T>
++++{
++++ public void Foo (T t)
++++ { }
++++}
++++
++++class X
++++{
++++ Test<int> test;
++++
++++ void Test ()
++++ {
++++ test.Foo (4);
++++ test.Hello (3);
++++ test.BaseFunc ();
++++ }
++++
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Stack<T>
++++{
++++ T t;
++++
++++ public Stack (T t)
++++ {
++++ this.t = t;
++++ }
++++
++++ public object Test ()
++++ {
++++ // Boxing the type parameter `T' to an object.
++++ return t;
++++ }
++++}
++++
++++class X
++++{
++++ public static object Test (Stack<int> stack)
++++ {
++++ return stack.Test ();
++++ }
++++
++++ static void Main ()
++++ {
++++ Stack<int> stack = new Stack<int> (9);
++++ System.Console.WriteLine (Test (stack));
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Stack<T>
++++{
++++ T[] t;
++++
++++ public Stack (int n)
++++ {
++++ t = new T [n];
++++ }
++++
++++ public object Test ()
++++ {
++++ // Boxing the type parameter to an object; note that we're
++++ // an array !
++++ return t;
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Stack<int> stack = new Stack<int> (5);
++++ System.Console.WriteLine (stack.Test ());
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Note how the order of type parameters is different
++++// in the base class.
++++
++++class Foo<T>
++++{
++++ public Foo ()
++++ { }
++++
++++ public void Hello (T t)
++++ { }
++++}
++++
++++class Bar<T,U> : Foo<U>
++++{
++++ public Bar ()
++++ { }
++++
++++ public void Test (T t, U u)
++++ { }
++++}
++++
++++class X
++++{
++++ static void Test (Bar<int,string> bar)
++++ {
++++ bar.Hello ("Test");
++++ bar.Test (7, "Hello");
++++ }
++++
++++ static void Main ()
++++ {
++++ Bar<int,string> bar = new Bar<int,string> ();
++++ Test (bar);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++public class Foo<T>
++++{
++++ public void Hello (T t)
++++ { }
++++}
++++
++++public class Bar<T,U> : Foo<U>
++++{
++++ public void Test (T t, U u)
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:gtest-031-lib.dll
++++
++++public class X
++++{
++++ public static void Test (Bar<int,string> bar)
++++ {
++++ bar.Hello ("Test");
++++ bar.Test (7, "Hello");
++++ }
++++
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Generic interfaces
++++
++++interface Foo<S>
++++{
++++ void Hello (S s);
++++}
++++
++++interface Bar<T,U> : Foo<U>
++++{
++++ void Test (T t, U u);
++++}
++++
++++class X
++++{
++++ static void Test (Bar<int,string> bar)
++++ {
++++ bar.Hello ("Test");
++++ bar.Test (7, "Hello");
++++ }
++++
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Generic interfaces
++++
++++interface Foo<R,S>
++++{
++++ void Hello (R r, S s);
++++}
++++
++++interface Bar<T,U,V> : Foo<V,float>
++++{
++++ void Test (T t, U u, V v);
++++}
++++
++++class X
++++{
++++ static void Test (Bar<long,int,string> bar)
++++ {
++++ bar.Hello ("Test", 3.14F);
++++ bar.Test (512, 7, "Hello");
++++ }
++++
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Foo<T>
++++{ }
++++
++++class Stack<T>
++++{ }
++++
++++//
++++// We may use a constructed type `Stack<T>' instead of
++++// just a type parameter.
++++//
++++
++++class Bar<T> : Foo<Stack<T>>
++++{ }
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// May use a constructed type as constraint.
++++
++++class Test<T>
++++{ }
++++
++++class Foo<T>
++++ where T : Test<T>
++++{ }
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// This is another "important" test: it checks whether we set
++++// TypeContainer.CurrentType correctly when compiling the
++++// declaration of `Stack'.
++++//
++++
++++class Stack<T>
++++{
++++ //
++++ // This must be encoded as a TypeSpec (Stack<!0>) and
++++ // not as a TypeDef.
++++ //
++++ // PEVerify the resulting executable on Windows to make sure !
++++ //
++++ void Hello (Stack<T> stack)
++++ {
++++ }
++++
++++ void Test ()
++++ {
++++ Hello (this);
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Check whether we're correctly handling `this'.
++++//
++++//
++++
++++public class Foo<T,U>
++++{
++++ public void Hello (Foo<T,U> foo)
++++ {
++++ }
++++
++++ public virtual void Test ()
++++ {
++++ //
++++ // Again, this must be encoded as a TypeSpec (Foo<!0,!1>)
++++ // instead of a TypeDef.
++++ Hello (this);
++++ }
++++}
++++
++++public class Bar<T> : Foo<T,long>
++++{
++++ public void Test (Foo<T,long> foo)
++++ {
++++ Hello (foo);
++++ }
++++}
++++
++++public class Baz<T> : Foo<T,string>
++++{
++++ public override void Test ()
++++ {
++++ Hello (this);
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Another important test: nested generic types.
++++//
++++
++++using System;
++++
++++class Queue<T>
++++{
++++ public Queue (T first, T second)
++++ {
++++ head = new Node<T> (null, second);
++++ head = new Node<T> (head, first);
++++ }
++++
++++ protected Node<T> head;
++++
++++ protected Node<T> GetFoo ()
++++ {
++++ return head;
++++ }
++++
++++ protected Node<T> Foo {
++++ get {
++++ return GetFoo ();
++++ }
++++ }
++++
++++ protected void Test (T t)
++++ {
++++ Console.WriteLine (t);
++++ }
++++
++++ public void Test ()
++++ {
++++ Test (head.Item);
++++ Test (head.Next.Item);
++++ Test (GetFoo ().Item);
++++ Test (Foo.Item);
++++ }
++++
++++ protected class Node<U>
++++ {
++++ public readonly U Item;
++++ public readonly Node<U> Next;
++++
++++ public Node (Node<U> next, U item)
++++ {
++++ this.Next = next;
++++ this.Item = item;
++++ }
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Queue<int> queue = new Queue<int> (5, 9);
++++ queue.Test ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Important test for the runtime: check whether we're correctly
++++// creating the vtable for nested types.
++++//
++++
++++using System;
++++
++++interface IMonkey<T>
++++{
++++ T Jump ();
++++}
++++
++++class Zoo<T>
++++{
++++ T t;
++++
++++ public Zoo (T t)
++++ {
++++ this.t = t;
++++ }
++++
++++ public T Name {
++++ get { return t; }
++++ }
++++
++++ public IMonkey<U> GetTheMonkey<U> (U u)
++++ {
++++ return new Monkey<T,U> (this, u);
++++ }
++++
++++ public class Monkey<V,W> : IMonkey<W>
++++ {
++++ public readonly Zoo<V> Zoo;
++++ public readonly W Data;
++++
++++ public Monkey (Zoo<V> zoo, W data)
++++ {
++++ this.Zoo = zoo;
++++ this.Data = data;
++++ }
++++
++++ public W Jump ()
++++ {
++++ Console.WriteLine ("Monkey {0} from {1} jumping!", Data, Zoo.Name);
++++ return Data;
++++ }
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Zoo<string> zoo = new Zoo<string> ("Boston");
++++ IMonkey<float> monkey = zoo.GetTheMonkey<float> (3.14F);
++++ monkey.Jump ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public interface INode<T>
++++{
++++ void Hello (T t);
++++}
++++
++++public class Stack<T>
++++{
++++ public T TheData;
++++ public readonly Foo<T> TheFoo;
++++
++++ public Stack (T t)
++++ {
++++ this.TheData = t;
++++ this.TheFoo = new Foo<T> (t);
++++ }
++++
++++ public INode<T> GetNode ()
++++ {
++++ return new Node (this);
++++ }
++++
++++ public Foo<T> GetFoo (T t)
++++ {
++++ return new Foo<T> (t);
++++ }
++++
++++ public Bar<T> GetBar (T t)
++++ {
++++ return new Bar<T> (t);
++++ }
++++
++++ protected class Node : INode<T>
++++ {
++++ public readonly Stack<T> Stack;
++++
++++ public Node (Stack<T> stack)
++++ {
++++ this.Stack = stack;
++++ }
++++
++++ public void Hello (T t)
++++ {
++++ }
++++ }
++++
++++ public class Foo<T>
++++ {
++++ public readonly T Data;
++++
++++ public Bar<T> GetBar ()
++++ {
++++ return new Bar<T> (Data);
++++ }
++++
++++ public Foo (T t)
++++ {
++++ this.Data = t;
++++ }
++++ }
++++
++++ public class Bar<U>
++++ {
++++ public readonly U Data;
++++
++++ public Bar (U u)
++++ {
++++ this.Data = u;
++++ }
++++
++++ public Foo<T> GetFoo (Stack<T> stack)
++++ {
++++ return stack.TheFoo;
++++ }
++++
++++ public class Baz<V>
++++ {
++++ public readonly V Data;
++++
++++ public Foo<T> GetFoo (Stack<T> stack)
++++ {
++++ return new Foo<T> (stack.TheData);
++++ }
++++
++++ public Bar<V> GetBar ()
++++ {
++++ return new Bar<V> (Data);
++++ }
++++
++++ public Baz (V v)
++++ {
++++ this.Data = v;
++++ }
++++ }
++++ }
++++
++++ public void Test ()
++++ {
++++ Stack<T>.Foo<T> foo1 = GetFoo (TheData);
++++ Foo<T> foo2 = GetFoo (TheData);
++++
++++ Stack<long>.Foo<T> foo3 = new Stack<long>.Foo<T> (TheData);
++++ Stack<long>.Foo<float> foo4 = new Stack<long>.Foo<float> (3.14F);
++++
++++ Foo<double> foo5 = new Foo<double> (3.14);
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Stack<int> stack = new Stack<int> (1);
++++ INode<int> node = stack.GetNode ();
++++ Stack<int>.Foo<int> foo = stack.GetFoo (7);
++++ Stack<int>.Bar<int> bar = stack.GetBar (8);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// We may use type parameters as `params' type.
++++
++++class Stack<T>
++++{
++++ public void Hello (int a, params T[] args)
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Stack<string> stack = new Stack<string> ();
++++ stack.Hello (1, "Hello", "World");
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compare this to gcs0695-*.cs: these are the allowed cases.
++++
++++namespace A
++++{
++++ interface I<X>
++++ { }
++++
++++ interface J<X,Y> : I<X>
++++ { }
++++
++++ class A<X> : I<X>, I<A<X>>
++++ { }
++++
++++ class B<X> : I<B<X>>, I<X>, I<A<X>>
++++ { }
++++
++++ class C<X> : I<int>, I<A<X>>
++++ { }
++++
++++ class D<X> : I<A<float>>, I<B<X>>
++++ { }
++++
++++ class E<X,Y> : J<X,Y>, J<I<X>,I<Y>>
++++ { }
++++
++++ class F<X> : J<X,I<X>>, J<X,X>
++++ { }
++++}
++++
++++// bug #69057
++++namespace B
++++{
++++ struct KeyValuePair<K,V>
++++ { }
++++
++++ interface ITest<T>
++++ { }
++++
++++ interface ITest2<K,V> : ITest<KeyValuePair<K,V>>
++++ { }
++++
++++ class MyTest<K,V> : ITest2<K,V>, ITest<KeyValuePair<K,V>>
++++ { }
++++}
++++
++++// bug #58303
++++namespace C
++++{
++++ class S <K> { }
++++
++++ interface Z<T> { }
++++
++++ interface I<K> : Z<S<K>> { }
++++
++++ class C <K> : I<K>, Z<S<K>> { }
++++}
++++
++++class Test
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Static fields in generic types: this is a runtime/JIT-only test
++++//
++++// We need to make sure that we're instantiating each closed generic
++++// type (ie. "Test<int>") only once.
++++
++++using System;
++++
++++public class Test<T>
++++{
++++ public static int Count;
++++
++++ public void Foo ()
++++ {
++++ Count++;
++++ }
++++
++++ public int GetCount ()
++++ {
++++ return Count;
++++ }
++++}
++++
++++class X
++++{
++++ static int DoTheTest<T> ()
++++ {
++++ Test<T> test = new Test<T> ();
++++
++++ test.Foo ();
++++ if (test.GetCount () != 1)
++++ return 1;
++++ if (Test<T>.Count != 1)
++++ return 2;
++++
++++ test.Foo ();
++++ if (test.GetCount () != 2)
++++ return 3;
++++ if (Test<T>.Count != 2)
++++ return 4;
++++
++++ test.Foo ();
++++ if (test.GetCount () != 3)
++++ return 5;
++++ if (Test<T>.Count != 3)
++++ return 6;
++++
++++ return 0;
++++ }
++++
++++ static int Main ()
++++ {
++++ int result = DoTheTest<int> ();
++++ if (result != 0)
++++ return result;
++++
++++ result = DoTheTest<long> () + 10;
++++ if (result != 10)
++++ return result;
++++
++++ Test<int>.Count = 0;
++++ ++Test<long>.Count;
++++
++++ result = DoTheTest<int> () + 20;
++++ if (result != 20)
++++ return result;
++++
++++ if (Test<int>.Count != 3)
++++ return 31;
++++ if (Test<long>.Count != 4)
++++ return 32;
++++ Test<float>.Count = 5;
++++ if (Test<int>.Count != 3)
++++ return 33;
++++ if (Test<long>.Count != 4)
++++ return 34;
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Operators and generic types.
++++
++++using System;
++++
++++class X<T>
++++{
++++ public int Count;
++++
++++ public X (int count)
++++ {
++++ this.Count = count;
++++ }
++++
++++ public static X<T> operator ++ (X<T> operand) {
++++ return new X<T> (operand.Count + 1);
++++ }
++++}
++++
++++class Test
++++{
++++ static void Main ()
++++ {
++++ X<long> x = new X<long> (5);
++++ Console.WriteLine (x.Count);
++++ x++;
++++ Console.WriteLine (x.Count);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Important test: Type inference
++++
++++class Test<A,B>
++++{
++++ public void Foo<U> (U u)
++++ { }
++++
++++ public void Foo<V> (V[] v, V w)
++++ { }
++++
++++ public void Hello<V,W> (V v, W w, Test<V,W> x)
++++ { }
++++
++++ public void ArrayMethod<V> (params V[] args)
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Test<float,int> test = new Test<float,int> ();
++++ test.Foo ("Hello World");
++++ test.Foo (new long[] { 3, 4, 5 }, 9L);
++++ test.Hello (3.14F, 9, test);
++++ test.ArrayMethod (3.14F, (float) 9 / 3);
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Generic delegates.
++++
++++using System;
++++
++++delegate void Test<T> (T t);
++++
++++class Foo<T>
++++{
++++ public event Test<T> MyEvent;
++++
++++ public void Hello (T t)
++++ {
++++ if (MyEvent != null)
++++ MyEvent (t);
++++ }
++++}
++++
++++class X
++++{
++++ static void do_hello (string hello)
++++ {
++++ Console.WriteLine ("Hello: {0}", hello);
++++ }
++++
++++ static void Main ()
++++ {
++++ Foo<string> foo = new Foo<string> ();
++++ foo.MyEvent += new Test<string> (do_hello);
++++ foo.Hello ("Boston");
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++namespace Foo
++++{
++++ public class List
++++ {
++++ }
++++}
++++
++++namespace Bar
++++{
++++ public class List<T>
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:gtest-047-lib.dll
++++
++++// Important test: verify our namespace lookup rules
++++//
++++// There's a generic and a non-generic `List' type in two
++++// different namespaces: make sure we pick the correct one.
++++
++++using Foo;
++++using Bar;
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ List<int> list = new List<int> ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// This fixed a problem in the JIT.
++++
++++public class Stack<T>
++++{
++++ T[] data;
++++
++++ public Stack ()
++++ {
++++ data = new T [10];
++++ }
++++
++++ public void Add (T t)
++++ {
++++ data [0] = t;
++++ }
++++}
++++
++++struct Foo
++++{
++++ int a;
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Foo foo = new Foo ();
++++ Stack<Foo> stack = new Stack<Foo> ();
++++ stack.Add (foo);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Important test: compare this to gcs0408-*.cs; these are the allowed cases.
++++
++++class X<T>
++++{
++++ void A (T t)
++++ { }
++++
++++ void A (T[] t)
++++ { }
++++
++++ void A (T[,] t)
++++ { }
++++
++++ void A (T[][] t)
++++ { }
++++
++++ void B (T[] t)
++++ { }
++++
++++ void B (int t)
++++ { }
++++
++++ void C (T[] t)
++++ { }
++++
++++ void C (T[,] t)
++++ { }
++++
++++ void C (int[,,] t)
++++ { }
++++
++++ void D (int x, T y)
++++ { }
++++
++++ void D (T x, long y)
++++ { }
++++}
++++
++++class Foo
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Type inference when creating delegates
++++
++++using System;
++++
++++delegate int D (string s, int i);
++++
++++delegate int E ();
++++
++++class X
++++{
++++ public static T F<T> (string s, T t)
++++ {
++++ return t;
++++ }
++++
++++ public static T G<T> ()
++++ {
++++ throw new ArgumentException ();
++++ }
++++
++++ static void Main ()
++++ {
++++ D d1 = new D (F<int>);
++++ D d2 = new D (F);
++++
++++ E e1 = new E (G<int>);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class Foo<T>
++++ where T : A
++++{
++++ public void Test (T t)
++++ {
++++ Console.WriteLine (t);
++++ Console.WriteLine (t.GetType ());
++++ t.Hello ();
++++ }
++++}
++++
++++public class A
++++{
++++ public void Hello ()
++++ {
++++ Console.WriteLine ("Hello World");
++++ }
++++}
++++
++++public class B : A
++++{
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Foo<B> foo = new Foo<B> ();
++++ foo.Test (new B ());
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// We create an instance of a type parameter which has the new() constraint.
++++using System;
++++
++++public class Foo<T>
++++ where T : new ()
++++{
++++ public T Create ()
++++ {
++++ return new T ();
++++ }
++++}
++++
++++class X
++++{
++++ public X ()
++++ { }
++++
++++ void Hello ()
++++ {
++++ Console.WriteLine ("Hello World");
++++ }
++++
++++ static void Main ()
++++ {
++++ Foo<X> foo = new Foo<X> ();
++++ foo.Create ().Hello ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Important test: Type parameters and boxing (26.7.3).
++++//
++++// This tests the constrained_ prefix opcode.
++++//
++++using System;
++++
++++public interface ICounter
++++{
++++ void Increment ();
++++}
++++
++++namespace ValueTypeCounters
++++{
++++ public struct SimpleCounter : ICounter
++++ {
++++ public int Value;
++++
++++ public void Increment ()
++++ {
++++ Value += 2;
++++ }
++++ }
++++
++++ public struct PrintingCounter : ICounter
++++ {
++++ public int Value;
++++
++++ public override string ToString ()
++++ {
++++ return Value.ToString ();
++++ }
++++
++++ public void Increment ()
++++ {
++++ Value += 2;
++++ }
++++ }
++++
++++ public struct ExplicitCounter : ICounter
++++ {
++++ public int Value;
++++
++++ public override string ToString ()
++++ {
++++ return Value.ToString ();
++++ }
++++
++++ void ICounter.Increment ()
++++ {
++++ Value++;
++++ }
++++ }
++++
++++ public struct InterfaceCounter : ICounter
++++ {
++++ public int Value;
++++
++++ public override string ToString ()
++++ {
++++ return Value.ToString ();
++++ }
++++
++++ void ICounter.Increment ()
++++ {
++++ Value++;
++++ }
++++
++++ public void Increment ()
++++ {
++++ Value += 2;
++++ }
++++ }
++++}
++++
++++namespace ReferenceTypeCounters
++++{
++++ public class SimpleCounter : ICounter
++++ {
++++ public int Value;
++++
++++ public void Increment ()
++++ {
++++ Value += 2;
++++ }
++++ }
++++
++++ public class PrintingCounter : ICounter
++++ {
++++ public int Value;
++++
++++ public override string ToString ()
++++ {
++++ return Value.ToString ();
++++ }
++++
++++ public void Increment ()
++++ {
++++ Value += 2;
++++ }
++++ }
++++
++++ public class ExplicitCounter : ICounter
++++ {
++++ public int Value;
++++
++++ public override string ToString ()
++++ {
++++ return Value.ToString ();
++++ }
++++
++++ void ICounter.Increment ()
++++ {
++++ Value++;
++++ }
++++ }
++++
++++ public class InterfaceCounter : ICounter
++++ {
++++ public int Value;
++++
++++ public override string ToString ()
++++ {
++++ return Value.ToString ();
++++ }
++++
++++ void ICounter.Increment ()
++++ {
++++ Value++;
++++ }
++++
++++ public void Increment ()
++++ {
++++ Value += 2;
++++ }
++++ }
++++}
++++
++++namespace Test
++++{
++++ using V = ValueTypeCounters;
++++ using R = ReferenceTypeCounters;
++++
++++ public class Test<T>
++++ where T : ICounter
++++ {
++++ public static void Foo (T x)
++++ {
++++ Console.WriteLine (x.ToString ());
++++ x.Increment ();
++++ Console.WriteLine (x.ToString ());
++++ }
++++ }
++++
++++ public class X
++++ {
++++ static void Main ()
++++ {
++++ Test<V.SimpleCounter>.Foo (new V.SimpleCounter ());
++++ Test<V.PrintingCounter>.Foo (new V.PrintingCounter ());
++++ Test<V.ExplicitCounter>.Foo (new V.ExplicitCounter ());
++++ Test<V.InterfaceCounter>.Foo (new V.InterfaceCounter ());
++++ Test<R.SimpleCounter>.Foo (new R.SimpleCounter ());
++++ Test<R.PrintingCounter>.Foo (new R.PrintingCounter ());
++++ Test<R.ExplicitCounter>.Foo (new R.ExplicitCounter ());
++++ Test<R.InterfaceCounter>.Foo (new R.InterfaceCounter ());
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Conversions involving type parameters (26.7.4).
++++// This is a compilation-only test since some of the explict
++++// conversions would trigger an InvalidCastException.
++++//
++++
++++using System;
++++
++++interface Foo
++++{
++++ void Hello ();
++++}
++++
++++class A
++++{ }
++++
++++class B : A, Foo
++++{
++++ public void Hello ()
++++ { }
++++
++++ public static implicit operator C (B b)
++++ {
++++ return new C ();
++++ }
++++}
++++
++++class C
++++{
++++ public static explicit operator B (C c)
++++ {
++++ return new B ();
++++ }
++++}
++++
++++class Test
++++{
++++ static void Simple<T> (T t)
++++ {
++++ object o = t;
++++ t = (T) o;
++++ Foo foo = (Foo) t;
++++ t = (T) foo;
++++ }
++++
++++ static void Interface<T> (T t)
++++ where T : Foo
++++ {
++++ Foo foo = t;
++++ }
++++
++++ static void Class<T> (T t)
++++ where T : B
++++ {
++++ B b = t;
++++ A a = t;
++++ Foo foo = t;
++++ t = (T) b;
++++ t = (T) a;
++++ t = (T) foo;
++++ C c = t;
++++ t = (T) c;
++++ }
++++
++++ static void Array<T> (T[] t)
++++ {
++++ object o = t;
++++ Array a = t;
++++ t = (T []) o;
++++ t = (T []) a;
++++ }
++++
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Using constructed types in a namespace alias.
++++
++++namespace N1
++++{
++++ class A<T>
++++ {
++++ public class B { }
++++
++++ public class C<U> { }
++++ }
++++
++++ class C { }
++++}
++++
++++namespace N2
++++{
++++ using Y = N1.A<int>;
++++
++++ class X
++++ {
++++ static void Main ()
++++ {
++++ Y y = new Y ();
++++ Y.B b = new Y.B ();
++++ Y.C<long> c = new Y.C<long> ();
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//-- ex-gen-logger
++++//-- ex-gen-struct-pair
++++//-- ex-gen-logging-pairs
++++// 1.2 alpha
++++
++++using System;
++++
++++public class Log<T> {
++++ private const int SIZE = 5;
++++ private static int instanceCount = 0;
++++ private int count = 0;
++++ private T[] log = new T[SIZE];
++++ public Log() { instanceCount++; }
++++ public static int InstanceCount { get { return instanceCount; } }
++++ public void Add(T msg) { log[count++ % SIZE] = msg; }
++++ public int Count { get { return count; } }
++++ public T Last {
++++ get { // Return the last log entry, or null if nothing logged yet
++++ return count==0 ? default(T) : log[(count-1)%SIZE];
++++ }
++++ set { // Update the last log entry, or create one if nothing logged yet
++++ if (count==0)
++++ log[count++] = value;
++++ else
++++ log[(count-1)%SIZE] = value;
++++ }
++++ }
++++ public T[] All {
++++ get {
++++ int size = Math.Min(count, SIZE);
++++ T[] res = new T[size];
++++ for (int i=0; i<size; i++)
++++ res[i] = log[(count-size+i) % SIZE];
++++ return res;
++++ }
++++ }
++++}
++++
++++class TestLog {
++++ class MyTest {
++++ public static void Main(String[] args) {
++++ Log<String> log1 = new Log<String>();
++++ log1.Add("Reboot");
++++ log1.Add("Coffee");
++++ Log<DateTime> log2 = new Log<DateTime>();
++++ log2.Add(DateTime.Now);
++++ log2.Add(DateTime.Now.AddHours(1));
++++ DateTime[] dts = log2.All;
++++ // Printing both logs:
++++ foreach (String s in log1.All)
++++ Console.Write("{0} ", s);
++++ Console.WriteLine();
++++ foreach (DateTime dt in dts)
++++ Console.Write("{0} ", dt);
++++ Console.WriteLine();
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++interface IHello<T>
++++{
++++ void Print (T t);
++++}
++++
++++interface Foo
++++{
++++ IHello<U> Test<U> ();
++++}
++++
++++class Hello<T> : IHello<T>, Foo
++++{
++++ public void Print (T t)
++++ {
++++ Console.WriteLine ("Hello: {0}", t);
++++ }
++++
++++ public IHello<U> Test<U> ()
++++ {
++++ return new Hello<U> ();
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Hello<int> hello = new Hello<int> ();
++++ hello.Print (5);
++++ hello.Test<float> ().Print (3.14F);
++++
++++ IHello<string> foo = hello.Test<string> ();
++++ foo.Print ("World");
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Foo {
++++ static void Main () {}
++++}
++++
++++class Foo <T> {
++++ static Foo <T> x;
++++ static Foo <T> Blah { get { return x; } }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++namespace N {
++++ interface A <T> {
++++ }
++++}
++++class X <T> : N.A <T> {
++++}
++++class Foo {
++++ static void Main () {}
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++interface IFoo
++++{
++++ MyList<U> Map<U> ();
++++}
++++
++++class MyList<T>
++++{
++++ public void Hello (T t)
++++ {
++++ Console.WriteLine (t);
++++ }
++++}
++++
++++class Foo : IFoo
++++{
++++ public MyList<T> Map<T> ()
++++ {
++++ return new MyList<T> ();
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Foo foo = new Foo ();
++++ MyList<int> list = foo.Map<int> ();
++++ list.Hello (9);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public delegate B Test<A,B> (A a);
++++
++++public class Foo<T>
++++{
++++ T t;
++++
++++ public Foo (T t)
++++ {
++++ this.t = t;
++++ }
++++
++++ public U Method<U> (Test<T,U> test)
++++ {
++++ return test (t);
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Test<double,int> test = new Test<double,int> (Math.Sign);
++++
++++ Foo<double> foo = new Foo<double> (Math.PI);
++++ Console.WriteLine (foo.Method<int> (test));
++++
++++ string s = foo.Method<string> (delegate (double d) { return "s" + d; });
++++ Console.WriteLine (s);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System.Collections.Generic;
++++
++++class X
++++{
++++ public IEnumerable<int> Test (int a, long b)
++++ {
++++ while (a < b) {
++++ a++;
++++ yield return a;
++++ }
++++ }
++++
++++ static int Main ()
++++ {
++++ X x = new X ();
++++ int sum = 0;
++++ foreach (int i in x.Test (3, 8L))
++++ sum += i;
++++
++++ return sum == 30 ? 0 : 1;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class Test
++++{
++++ public static int IndexOf (Array array, object value)
++++ {
++++ // This is picking the non-generic version.
++++ return IndexOf (array, value, 0, array.Length);
++++ }
++++
++++ public static int IndexOf (Array array, object value, int startIndex, int count)
++++ {
++++ return 2;
++++ }
++++
++++ public static int IndexOf<T> (T[] array, T value, int startIndex, int count)
++++ {
++++ return 1;
++++ }
++++}
++++
++++class X
++++{
++++ static int Main ()
++++ {
++++ Test test = new Test ();
++++ string[] array = new string [] { "Hello" };
++++
++++ int result = Test.IndexOf (array, array);
++++ if (result != 2)
++++ return 1;
++++
++++ string hello = "Hello World";
++++ // This is picking the generic version.
++++ result = Test.IndexOf (array, hello, 1, 2);
++++ if (result != 1)
++++ return 2;
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public interface IHello<T>
++++{ }
++++
++++public interface IFoo<T>
++++{
++++ IHello<T> GetHello ();
++++}
++++
++++public interface IBar<T> : IFoo<T>
++++{ }
++++
++++public class Foo<T> : IBar<T>, IFoo<T>
++++{
++++ public Hello GetHello ()
++++ {
++++ return new Hello (this);
++++ }
++++
++++ IHello<T> IFoo<T>.GetHello ()
++++ {
++++ return new Hello (this);
++++ }
++++
++++ public class Hello : IHello<T>
++++ {
++++ public readonly Foo<T> Foo;
++++
++++ public Hello (Foo<T> foo)
++++ {
++++ this.Foo = foo;
++++ }
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//-- ex-gen-type-parameter-in-constraint
++++
++++using System;
++++using System.Collections.Generic;
++++
++++// A constraint may involve type parameters
++++// A type may have multiple constraints
++++
++++struct ComparablePair<T,U> : IComparable<ComparablePair<T,U>>
++++ where T : IComparable<T>
++++ where U : IComparable<U> {
++++ public readonly T Fst;
++++ public readonly U Snd;
++++
++++ public ComparablePair(T fst, U snd) {
++++ Fst = fst; Snd = snd;
++++ }
++++
++++ // Lexicographic ordering
++++ public int CompareTo(ComparablePair<T,U> that) {
++++ int firstCmp = this.Fst.CompareTo(that.Fst);
++++ return firstCmp != 0 ? firstCmp : this.Snd.CompareTo(that.Snd);
++++ }
++++
++++ public bool Equals(ComparablePair<T,U> that) {
++++ return this.Fst.Equals(that.Fst) && this.Snd.Equals(that.Snd);
++++ }
++++
++++ public override String ToString() {
++++ return "(" + Fst + ", " + Snd + ")";
++++ }
++++}
++++
++++// Sorting soccer world champions by country and year
++++
++++class MyTest {
++++ static void Test ()
++++ {
++++ new ComparablePair<string,int>("Brazil", 2002);
++++ }
++++
++++ public static void Main(string[] args) {
++++ List<ComparablePair<string,int>> lst
++++ = new List<ComparablePair<string,int>>();
++++ lst.Add(new ComparablePair<String,int>("Brazil", 2002));
++++ lst.Add(new ComparablePair<String,int>("Italy", 1982));
++++ lst.Add(new ComparablePair<String,int>("Argentina", 1978 ));
++++ lst.Add(new ComparablePair<String,int>("Argentina", 1986 ));
++++ lst.Add(new ComparablePair<String,int>("Germany", 1990));
++++ lst.Add(new ComparablePair<String,int>("Brazil", 1994));
++++ lst.Add(new ComparablePair<String,int>("France", 1998));
++++ // lst.Sort();
++++ foreach (ComparablePair<String,int> pair in lst)
++++ Console.WriteLine(pair);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class Foo<T>
++++{
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Console.WriteLine (typeof (Foo<>));
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Test
++++{
++++ public delegate int Foo<T> (T t, T u);
++++
++++ public void Hello<U> (Foo<U> foo, U u)
++++ { }
++++}
++++
++++class X
++++{
++++ static int Add (int a, int b)
++++ {
++++ return a + b;
++++ }
++++
++++ static void Main ()
++++ {
++++ Test test = new Test ();
++++ test.Hello<int> (new Test.Foo<int> (Add), 5);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++namespace Martin
++++{
++++ public class Foo<T>
++++ { }
++++}
++++
++++namespace Baulig
++++{
++++ using M = Martin;
++++
++++ class X
++++ {
++++ static void Main ()
++++ {
++++ M.Foo<int> foo;
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public interface IFoo
++++{
++++ int GetHashCode ();
++++}
++++
++++public interface IFoo<T>
++++{
++++ int GetHashCode ();
++++}
++++
++++public class Test<T>
++++{
++++ public int Foo (IFoo<T> foo)
++++ {
++++ return foo.GetHashCode ();
++++ }
++++
++++ public int Foo (IFoo foo)
++++ {
++++ return foo.GetHashCode ();
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++namespace Martin
++++{
++++ public class Test<T>
++++ {
++++ public static int Foo ()
++++ {
++++ return 0;
++++ }
++++ }
++++}
++++
++++class Foo<T>
++++{
++++ public Foo (int a)
++++ { }
++++
++++ public Foo ()
++++ : this (Martin.Test<T>.Foo ())
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class Foo<T>
++++{
++++ public T Test<U> (U u)
++++ where U : T
++++ {
++++ return u;
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Foo<X> foo = new Foo<X> ();
++++
++++ Y y = new Y ();
++++ X x = foo.Test<Y> (y);
++++ }
++++}
++++
++++class Y : X
++++{
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//-- ex-gen-logger
++++//-- ex-gen-struct-pair
++++//-- ex-gen-logging-pairs
++++// 1.2 alpha
++++
++++using System;
++++
++++public class Log<T> {
++++ private const int SIZE = 5;
++++ private static int instanceCount = 0;
++++ private int count = 0;
++++ private T[] log = new T[SIZE];
++++ public Log() { instanceCount++; }
++++ public static int InstanceCount { get { return instanceCount; } }
++++ public void Add(T msg) { log[count++ % SIZE] = msg; }
++++ public int Count { get { return count; } }
++++ public T Last {
++++ get { // Return the last log entry, or null if nothing logged yet
++++ return count==0 ? default(T) : log[(count-1)%SIZE];
++++ }
++++ set { // Update the last log entry, or create one if nothing logged yet
++++ if (count==0)
++++ log[count++] = value;
++++ else
++++ log[(count-1)%SIZE] = value;
++++ }
++++ }
++++ public T[] All {
++++ get {
++++ int size = Math.Min(count, SIZE);
++++ T[] res = new T[size];
++++ for (int i=0; i<size; i++)
++++ res[i] = log[(count-size+i) % SIZE];
++++ return res;
++++ }
++++ }
++++}
++++
++++class TestLog {
++++ class MyTest {
++++ public static void Main(String[] args) {
++++ Log<String> log1 = new Log<String>();
++++ log1.Add("Reboot");
++++ log1.Add("Coffee");
++++ Log<DateTime> log2 = new Log<DateTime>();
++++ log2.Add(DateTime.Now);
++++ log2.Add(DateTime.Now.AddHours(1));
++++ DateTime[] dts = log2.All;
++++ // Printing both logs:
++++ foreach (String s in log1.All)
++++ Console.Write("{0} ", s);
++++ Console.WriteLine();
++++ foreach (DateTime dt in dts)
++++ Console.Write("{0} ", dt);
++++ Console.WriteLine();
++++ TestPairLog();
++++ }
++++
++++ public static void TestPairLog() {
++++ Log<Pair<DateTime,String>> log = new Log<Pair<DateTime,String>>();
++++ log.Add(new Pair<DateTime,String>(DateTime.Now, "Tea leaves"));
++++ log.Add(new Pair<DateTime,String>(DateTime.Now.AddMinutes(2), "Hot water"));
++++ log.Add(new Pair<DateTime,String>(DateTime.Now.AddMinutes(7), "Ready"));
++++ Pair<DateTime,String>[] allMsgs = log.All;
++++ foreach (Pair<DateTime,String> p in allMsgs)
++++ Console.WriteLine("At {0}: {1}", p.Fst, p.Snd);
++++ }
++++ }
++++}
++++
++++public struct Pair<T,U> {
++++ public readonly T Fst;
++++ public readonly U Snd;
++++ public Pair(T fst, U snd) {
++++ this.Fst = fst;
++++ this.Snd = snd;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Collections;
++++using System.Collections.Generic;
++++
++++class MyList<T> : IEnumerable<T>
++++{
++++ public IEnumerator<T> GetEnumerator ()
++++ {
++++ yield break;
++++ }
++++
++++ IEnumerator IEnumerable.GetEnumerator ()
++++ {
++++ return GetEnumerator ();
++++ }
++++}
++++
++++struct Foo<T>
++++{
++++ public readonly T Data;
++++
++++ public Foo (T data)
++++ {
++++ this.Data = data;
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ MyList<Foo<int>> list = new MyList <Foo<int>> ();
++++ foreach (Foo<int> foo in list)
++++ ;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public struct Foo<T>
++++{
++++ public T Data, Data2;
++++
++++ public Foo (T a, T b)
++++ {
++++ this.Data = a;
++++ this.Data2 = b;
++++ }
++++}
++++
++++public class Test<T>
++++{
++++ public T Data, Data2;
++++
++++ public Test (T a, T b)
++++ {
++++ this.Data = a;
++++ this.Data2 = b;
++++ }
++++}
++++
++++class X
++++{
++++ static int Main ()
++++ {
++++ Foo<long> foo = new Foo<long> (3, 5);
++++ if (foo.Data != 3)
++++ return 1;
++++ if (foo.Data2 != 5)
++++ return 2;
++++
++++ Test<long> test = new Test<long> (3, 5);
++++ if (test.Data != 3)
++++ return 3;
++++ if (test.Data2 != 5)
++++ return 4;
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public interface IExtensible<T>
++++{
++++ void AddAll<U> (U item)
++++ where U : T;
++++}
++++
++++public class ArrayList<T> : IExtensible<T>
++++{
++++ void IExtensible<T>.AddAll<U> (U item)
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++struct Foo<T>
++++{
++++ public T Data;
++++
++++ public Foo (T data)
++++ {
++++ this.Data = data;
++++ }
++++}
++++
++++class Test<T>
++++{
++++ public Foo<T> GetFoo (T data)
++++ {
++++ return new Foo<T> (data);
++++ }
++++}
++++
++++class X
++++{
++++ static int Main ()
++++ {
++++ Test<long> test = new Test<long> ();
++++ Foo<long> foo = test.GetFoo (0x800);
++++ //
++++ // This is a very simple test, just make sure the struct
++++ // is returned correctly. This was broken until recently
++++ // and I just fixed it on amd64.
++++ if (foo.Data != 0x800)
++++ return 1;
++++ return 0;
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:System
++++using System;
++++using System.Collections.Generic;
++++
++++public class X {
++++ public static void Main(string[] args)
++++ {
++++ Collection<int> list = new Collection<int>();
++++ list.Add (3);
++++ foreach (int i in list) {
++++ Console.WriteLine(i);
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Collections;
++++
++++public class Test
++++{
++++ public static void Main ()
++++ {
++++ foreach (object o in new Test ())
++++ Console.WriteLine (o);
++++ }
++++
++++ public IEnumerator GetEnumerator ()
++++ {
++++ foreach (int i in new ArrayList ())
++++ yield return i;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++namespace A
++++{
++++ public interface IExtensible<T>
++++ {
++++ void AddAll<U> (U u)
++++ where U : T;
++++ }
++++
++++ public class ArrayList<T> : IExtensible<T>
++++ {
++++ void IExtensible<T>.AddAll<U> (U u)
++++ {
++++ InsertAll (u);
++++ }
++++
++++ void InsertAll (T t)
++++ { }
++++ }
++++}
++++
++++namespace B
++++{
++++ public interface IExtensible<S,T>
++++ {
++++ void AddAll<U> (U t)
++++ where U : S;
++++ }
++++
++++ public class ArrayList<X,Y> : IExtensible<Y,X>
++++ {
++++ public void AddAll<Z> (Z z)
++++ where Z : Y
++++ {
++++ InsertAll (z);
++++ }
++++
++++ void InsertAll (Y y)
++++ { }
++++ }
++++}
++++
++++namespace C
++++{
++++ public interface IExtensible<S>
++++ {
++++ void AddAll<T> (T t)
++++ where T : S;
++++ }
++++
++++ public class Foo<U>
++++ { }
++++
++++ public class ArrayList<X> : IExtensible<Foo<X>>
++++ {
++++ public void AddAll<Y> (Y y)
++++ where Y : Foo<X>
++++ {
++++ InsertAll (y);
++++ }
++++
++++ void InsertAll (Foo<X> foo)
++++ { }
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public interface IFoo<X>
++++{ }
++++
++++public class Test
++++{
++++ public void Hello<T> (IFoo<T> foo)
++++ {
++++ InsertAll (foo);
++++ }
++++
++++ public void InsertAll<U> (IFoo<U> foo)
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public class ArrayList<T>
++++{
++++ void AddAll<U> (U u)
++++ where U : T
++++ {
++++ InsertAll (u);
++++ }
++++
++++ void InsertAll (T t)
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class Queue<T>
++++{
++++ protected class Enumerator
++++ {
++++ Queue<T> queue;
++++
++++ public Enumerator (Queue<T> queue)
++++ {
++++ this.queue = queue;
++++ }
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public class CollectionValueBase<T>
++++{
++++ public virtual T[] ToArray()
++++ {
++++ return null;
++++ }
++++}
++++
++++public class CollectionBase<T>: CollectionValueBase<T>
++++{
++++}
++++
++++public class SequencedBase<T>: CollectionBase<T>
++++{
++++}
++++
++++public class ArrayBase<T>: SequencedBase<T>
++++{
++++ public override T[] ToArray()
++++ {
++++ return null;
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++namespace HasherBuilder
++++{
++++ public class ByPrototype<S>
++++ {
++++ public static IHasher<S> Examine()
++++ {
++++ return null;
++++ }
++++ }
++++}
++++
++++public interface IHasher<T>
++++{
++++}
++++
++++public class ArrayList<U>
++++{
++++ public IHasher<U> GetHasher ()
++++ {
++++ return HasherBuilder.ByPrototype<U>.Examine();
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public interface IFoo<S>
++++{ }
++++
++++public class ArrayList<T>
++++{
++++ public virtual int InsertAll (IFoo<T> foo)
++++ {
++++ return 0;
++++ }
++++
++++ public virtual int InsertAll<U> (IFoo<U> foo)
++++ where U : T
++++ {
++++ return 1;
++++ }
++++
++++ public virtual int AddAll (IFoo<T> foo)
++++ {
++++ return InsertAll (foo);
++++ }
++++}
++++
++++class X
++++{
++++ static int Main ()
++++ {
++++ ArrayList<int> list = new ArrayList<int> ();
++++ return list.AddAll (null);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public interface IFoo<S>
++++{ }
++++
++++public class ArrayList<T>
++++{
++++ public virtual int InsertAll (IFoo<T> foo)
++++ {
++++ return 0;
++++ }
++++
++++ public virtual int InsertAll<U> (IFoo<U> foo)
++++ where U : T
++++ {
++++ return 1;
++++ }
++++
++++ public virtual int AddAll (IFoo<T> foo)
++++ {
++++ return InsertAll (foo);
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++namespace C5
++++{
++++ public class HashedArrayList<T>
++++ {
++++ public void Test ()
++++ {
++++ new HashSet <KeyValuePair<T,int>> (new KeyValuePairHasher<T,int> ());
++++ }
++++ }
++++
++++ public class HashSet<T>
++++ {
++++ public HashSet (IHasher<T> itemhasher)
++++ { }
++++ }
++++
++++ public interface IHasher<T>
++++ {
++++ }
++++
++++ public struct KeyValuePair<K,V>
++++ {
++++ }
++++
++++ public sealed class KeyValuePairHasher<K,V>: IHasher<KeyValuePair<K,V>>
++++ {
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public struct KeyValuePair<K,V>
++++{
++++ public KeyValuePair (K k, V v)
++++ { }
++++
++++ public KeyValuePair (K k)
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ new KeyValuePair<int,long> ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class Test<T>
++++{
++++ public void Foo (T t, out int a)
++++ {
++++ a = 5;
++++ }
++++
++++ public void Hello (T t)
++++ {
++++ int a;
++++
++++ Foo (t, out a);
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public abstract class Foo<T>
++++{
++++ public virtual T InsertAll<U> (U u)
++++ where U : T
++++ {
++++ return u;
++++ }
++++}
++++
++++public class Bar<T> : Foo<T>
++++{
++++ public override T InsertAll<U> (U u)
++++ {
++++ return u;
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class Foo<T>
++++{
++++ Node node;
++++
++++ public Node Test<V> ()
++++ {
++++ return node;
++++ }
++++
++++ public class Node
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class Element<T>
++++{
++++ public readonly T Item;
++++
++++ public Element (T item)
++++ {
++++ this.Item = item;
++++ }
++++
++++ public void GetItem (out T retval)
++++ {
++++ retval = Item;
++++ }
++++
++++ public T GetItem (int a, ref T data)
++++ {
++++ return Item;
++++ }
++++
++++ public void SetItem (T data)
++++ { }
++++}
++++
++++public class Foo<T>
++++{
++++ Element<Node> element;
++++
++++ public Node Test ()
++++ {
++++ Node node = element.Item;
++++ element.GetItem (out node);
++++ element.SetItem (node);
++++ return element.GetItem (3, ref node);
++++ }
++++
++++ public class Node
++++ {
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class Foo<T>
++++{
++++ public readonly T Item;
++++
++++ public Foo (T item)
++++ {
++++ this.Item = item;
++++ }
++++
++++ static void maketreer (out Node rest)
++++ {
++++ rest = new Node ();
++++ }
++++
++++ class Node
++++ { }
++++
++++ public void Hello<U> ()
++++ {
++++ Foo<U>.Node node;
++++ Foo<U>.maketreer (out node);
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public class LinkedList<T>
++++{
++++ protected class Node
++++ { }
++++}
++++
++++public class HashedLinkedList<T> : LinkedList<T>
++++{
++++ Node node;
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public interface IDirectedEnumerable<T>
++++{
++++ IDirectedEnumerable<T> Backwards();
++++}
++++
++++public interface IDirectedCollectionValue<T> : IDirectedEnumerable<T>
++++{
++++ new IDirectedCollectionValue<T> Backwards();
++++}
++++
++++public class GuardedCollectionValue<T> : IDirectedCollectionValue<T>
++++{
++++ IDirectedEnumerable<T> IDirectedEnumerable<T>.Backwards ()
++++ {
++++ return this;
++++ }
++++
++++ public IDirectedCollectionValue<T> Backwards ()
++++ {
++++ return this;
++++ }
++++}
++++
++++public interface ISequenced<T> : IDirectedCollectionValue<T>
++++{
++++}
++++
++++public class GuardedSequenced<T>
++++{
++++ ISequenced<T> sequenced;
++++
++++ public IDirectedCollectionValue<T> Test ()
++++ {
++++ return sequenced.Backwards();
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class Foo<T>
++++{ }
++++
++++class Test
++++{
++++ static void Hello<T> (Foo<T>[] foo, int i)
++++ {
++++ Foo<T> element = foo [0];
++++ Console.WriteLine (element);
++++ if (i > 0)
++++ Hello<T> (foo, i - 1);
++++ }
++++
++++ public static void Quicksort<U> (Foo<U>[] arr)
++++ {
++++ Hello<U> (arr, 1);
++++ }
++++
++++ static void Main ()
++++ {
++++ Foo<int>[] foo = new Foo<int> [1];
++++ foo [0] = new Foo<int> ();
++++ Quicksort (foo);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public interface IFoo
++++{
++++ void Test<T> ();
++++
++++ void Test<U,V> ();
++++}
++++
++++public class Foo : IFoo
++++{
++++ void IFoo.Test<X> ()
++++ { }
++++
++++ void IFoo.Test<Y,Z> ()
++++ { }
++++}
++++
++++public interface IBar<T>
++++{
++++ void Test ();
++++}
++++
++++public interface IBar<U,V>
++++{
++++ void Test ();
++++}
++++
++++public class Bar<X,Y,Z> : IBar<X>, IBar<Y,Z>
++++{
++++ void IBar<X>.Test ()
++++ { }
++++
++++ void IBar<Y,Z>.Test ()
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++public interface IFoo
++++{
++++ void Test<T> ();
++++
++++ void Test<U,V> ();
++++}
++++
++++public interface IBar<T>
++++{
++++ void Test ();
++++}
++++
++++public interface IBar<U,V>
++++{
++++ void Test ();
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: /r:gtest-098-lib.dll
++++public class Foo : IFoo
++++{
++++ void IFoo.Test<X> ()
++++ { }
++++
++++ void IFoo.Test<Y,Z> ()
++++ { }
++++}
++++
++++public class Bar<X,Y,Z> : IBar<X>, IBar<Y,Z>
++++{
++++ void IBar<X>.Test ()
++++ { }
++++
++++ void IBar<Y,Z>.Test ()
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++// Runtime test for mono_class_setup_vtable()
++++namespace C5
++++{
++++ public interface ICollection<T>
++++ {
++++ void Test<U> ();
++++ }
++++
++++ public abstract class ArrayBase<T> : ICollection<T>
++++ {
++++ void ICollection<T>.Test<U> ()
++++ { }
++++ }
++++
++++ public class ArrayList<V> : ArrayBase<V>
++++ {
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ C5.ArrayList<int> array = new C5.ArrayList<int> ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class Test
++++{
++++ static void Main ()
++++ {
++++ SimpleStruct <string> s = new SimpleStruct <string> ();
++++ }
++++}
++++
++++public struct SimpleStruct <T>
++++{
++++ T data;
++++
++++ public SimpleStruct (T data)
++++ {
++++ this.data = data;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class A<T>
++++ where T: IComparable
++++{
++++}
++++
++++class B<U,V>
++++ where U: IComparable
++++ where V: A<U>
++++{
++++}
++++
++++class Driver
++++{
++++ public static void Main ()
++++ {
++++ A<int> a_int;
++++ B<int,A<int>> b_stuff;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public interface IFoo<T>
++++{ }
++++
++++public class Foo : IFoo<string>
++++{ }
++++
++++public class Hello
++++{
++++ public void World<U> (U u, IFoo<U> foo)
++++ { }
++++
++++ public void World<V> (IFoo<V> foo)
++++ { }
++++
++++ public void Test (Foo foo)
++++ {
++++ World ("Canada", foo);
++++ World (foo);
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class MainClass
++++{
++++ class Gen<T>
++++ {
++++ public void Test ()
++++ { }
++++ }
++++
++++ class Der : Gen<int>
++++ {
++++ }
++++
++++ static void Main ()
++++ {
++++ object o = new Der ();
++++ Gen<int> b = (Gen<int>) o;
++++ b.Test ();
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++namespace A
++++{
++++ public struct KeyValuePair<X,Y>
++++ {
++++ public KeyValuePair (X x, Y y)
++++ { }
++++ }
++++
++++ public interface IComparer<T>
++++ {
++++ int Compare (T x);
++++ }
++++
++++ public class KeyValuePairComparer<K,V> : IComparer<KeyValuePair<K,V>>
++++ {
++++ public int Compare (KeyValuePair<K,V> a)
++++ {
++++ return 0;
++++ }
++++ }
++++
++++ public class TreeBag<T>
++++ {
++++ IComparer<T> comparer;
++++
++++ public TreeBag (IComparer<T> comparer)
++++ {
++++ this.comparer = comparer;
++++ }
++++
++++ public int Find (ref T item)
++++ {
++++ return comparer.Compare (item);
++++ }
++++ }
++++
++++ public class X
++++ {
++++ public static void Test ()
++++ {
++++ KeyValuePair<int,int> pair = new KeyValuePair<int,int> (3, 89);
++++ KeyValuePairComparer<int,int> comparer = new KeyValuePairComparer<int,int> ();
++++ TreeBag<KeyValuePair<int,int>> bag = new TreeBag<KeyValuePair<int,int>> (comparer);
++++ bag.Find (ref pair);
++++ }
++++ }
++++}
++++
++++namespace B
++++{
++++ public class KeyValuePair<X,Y>
++++ {
++++ public KeyValuePair (X x, Y y)
++++ { }
++++ }
++++
++++ public interface IComparer<T>
++++ {
++++ int Compare (T x);
++++ }
++++
++++ public class KeyValuePairComparer<K,V> : IComparer<KeyValuePair<K,V>>
++++ {
++++ public int Compare (KeyValuePair<K,V> a)
++++ {
++++ return 0;
++++ }
++++ }
++++
++++ public class TreeBag<T>
++++ {
++++ IComparer<T> comparer;
++++
++++ public TreeBag (IComparer<T> comparer)
++++ {
++++ this.comparer = comparer;
++++ }
++++
++++ public int Find (ref T item)
++++ {
++++ return comparer.Compare (item);
++++ }
++++ }
++++
++++ public class X
++++ {
++++ public static void Test ()
++++ {
++++ KeyValuePair<int,int> pair = new KeyValuePair<int,int> (3, 89);
++++ KeyValuePairComparer<int,int> comparer = new KeyValuePairComparer<int,int> ();
++++ TreeBag<KeyValuePair<int,int>> bag = new TreeBag<KeyValuePair<int,int>> (comparer);
++++ bag.Find (ref pair);
++++ }
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ A.X.Test ();
++++ B.X.Test ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public struct KeyValuePair<X,Y>
++++{
++++ public KeyValuePair (X x, Y y)
++++ { }
++++}
++++
++++public interface IComparer<T>
++++{
++++ int Compare (T x);
++++}
++++
++++public class KeyValuePairComparer<K,V> : IComparer<KeyValuePair<K,V>>
++++{
++++ public int Compare (KeyValuePair<K,V> a)
++++ {
++++ return 0;
++++ }
++++}
++++
++++public class TreeBag<T>
++++{
++++ IComparer<T> comparer;
++++ T item;
++++
++++ public TreeBag (IComparer<T> comparer, T item)
++++ {
++++ this.comparer = comparer;
++++ this.item = item;
++++ }
++++
++++ public int Find ()
++++ {
++++ return comparer.Compare (item);
++++ }
++++}
++++
++++public class X
++++{
++++ public static void Main ()
++++ {
++++ KeyValuePair<int,int> pair = new KeyValuePair<int,int> (3, 89);
++++ KeyValuePairComparer<int,int> comparer = new KeyValuePairComparer<int,int> ();
++++ TreeBag<KeyValuePair<int,int>> bag = new TreeBag<KeyValuePair<int,int>> (comparer, pair);
++++ bag.Find ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public delegate V Mapper<T,V> (T item);
++++
++++public interface ITree<T>
++++{
++++ void Map<V> (Mapper<T,V> mapper);
++++}
++++
++++public class Tree<T> : ITree<T>
++++{
++++ T item;
++++
++++ public Tree (T item)
++++ {
++++ this.item = item;
++++ }
++++
++++ public void Map<V> (Mapper<T,V> mapper)
++++ {
++++ V new_item = mapper (item);
++++ }
++++}
++++
++++class X
++++{
++++ private string themap (int i)
++++ {
++++ return String.Format ("AA {0,4} BB", i);
++++ }
++++
++++ void Test ()
++++ {
++++ Tree<int> tree = new Tree<int> (3);
++++ tree.Map (new Mapper<int,string> (themap));
++++ }
++++
++++ static void Main ()
++++ {
++++ X x = new X ();
++++ x.Test ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Collections.Generic;
++++
++++public class Test<T>
++++{
++++ protected T item;
++++
++++ public Test (T item)
++++ {
++++ this.item = item;
++++ }
++++
++++ public IEnumerator<T> GetEnumerator()
++++ {
++++ yield return item;
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Test<int> test = new Test<int> (3);
++++ foreach (int a in test)
++++ ;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class X {
++++ static void Main ()
++++ {
++++ int [] foo = null;
++++ Array.Resize (ref foo, 10);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public interface IList<R>
++++{
++++ int Map<S> (S item);
++++}
++++
++++public class List<T> : IList<T>
++++{
++++ public int Map<U> (U item)
++++ {
++++ return 1;
++++ }
++++}
++++
++++public class SpecialList<V> : IList<V>
++++{
++++ public int Map<W> (W item)
++++ {
++++ return 2;
++++ }
++++}
++++
++++class X
++++{
++++ static int Main ()
++++ {
++++ IList<int> list = new List<int> ();
++++ int result = list.Map ("Hello");
++++ if (result != 1)
++++ return 1;
++++
++++ IList<int> list2 = new SpecialList<int> ();
++++ int result2 = list2.Map ("World");
++++ if (result2 != 2)
++++ return 2;
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public struct KeyValuePair<K,V>
++++{
++++ public K key;
++++ public V value;
++++
++++ public KeyValuePair(K k, V v) { key = k; value = v; }
++++
++++ public KeyValuePair(K k) { key = k; value = default(V); }
++++}
++++
++++public class Collection<T>
++++{
++++ public readonly T Item;
++++
++++ public Collection (T item)
++++ {
++++ this.Item = item;
++++ }
++++
++++ public void Find (ref T item)
++++ {
++++ item = Item;
++++ }
++++}
++++
++++class X
++++{
++++ static int Main ()
++++ {
++++ KeyValuePair<int,long> p = new KeyValuePair<int,long> (3);
++++ KeyValuePair<int,long> q = new KeyValuePair<int,long> (5, 9);
++++
++++ Collection<KeyValuePair<int,long>> c = new Collection<KeyValuePair<int,long>> (q);
++++ c.Find (ref p);
++++
++++ if (p.key != 5)
++++ return 1;
++++ if (p.value != 9)
++++ return 2;
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public interface IComparer<T>
++++{
++++ void Compare (T a);
++++}
++++
++++class IC : IComparer<Foo<int>>
++++{
++++ public void Compare (Foo<int> a)
++++ { }
++++}
++++
++++public struct Foo<K>
++++{
++++ public K Value;
++++
++++ public Foo (K value)
++++ {
++++ Value = value;
++++ }
++++}
++++
++++public class List<T>
++++{
++++ public virtual void Sort (IComparer<T> c, T t)
++++ {
++++ Sorting.IntroSort<T> (c, t);
++++ }
++++}
++++
++++public class Sorting
++++{
++++ public static void IntroSort<T> (IComparer<T> c, T t)
++++ {
++++ new Sorter<T> (c, 4, t).InsertionSort (0);
++++ }
++++
++++ class Sorter<T>
++++ {
++++ IComparer<T> c;
++++ T[] a;
++++
++++ public Sorter (IComparer<T> c, int size, T item)
++++ {
++++ this.c = c;
++++ a = new T [size];
++++ }
++++
++++ internal void InsertionSort (int i)
++++ {
++++ T other;
++++ c.Compare (other = a[i]);
++++ }
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ List<Foo<int>> list = new List<Foo<int>> ();
++++ Foo<int> foo = new Foo<int> (3);
++++ list.Sort (new IC (), foo);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public delegate V Mapper<T,V> (T item);
++++
++++public class List<T>
++++{
++++ public void Map<V> (Mapper<T,V> mapper)
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ List<int> list = new List<int> ();
++++ list.Map (new Mapper<int,double> (delegate (int i) { return i/10.0; }));
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Collections.Generic;
++++
++++public class NaturalComparer<T> : IComparer<T>
++++ where T: IComparable<T>
++++{
++++ public int Compare (T a, T b)
++++ {
++++ return a.CompareTo (b);
++++ }
++++}
++++
++++public class X
++++{
++++ class Test : IComparable<Test>
++++ {
++++ public int CompareTo (Test that)
++++ {
++++ return 0;
++++ }
++++
++++ public bool Equals (Test that)
++++ {
++++ return false;
++++ }
++++ }
++++
++++ static void Main ()
++++ {
++++ IComparer<Test> cmp = new NaturalComparer<Test> ();
++++ Test a = new Test ();
++++ Test b = new Test ();
++++ cmp.Compare (a, b);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//-- ex-gen-class-linkedlist
++++//-- ex-anonymous-method-linkedlist
++++//-- ex-gen-printable
++++//-- ex-gen-interface-ilist
++++//-- ex-gen-linkedlist-map
++++//-- ex-gen-linkedlistenumerator
++++//-- ex-gen-delegate-fun
++++
++++// A generic LinkedList class
++++
++++using System;
++++using System.IO; // TextWriter
++++using System.Collections;
++++using System.Collections.Generic; // IEnumerable<T>, IEnumerator<T>
++++
++++public delegate R Mapper<A,R>(A x);
++++
++++public interface IMyList<T> : IEnumerable<T> {
++++ int Count { get; } // Number of elements
++++ T this[int i] { get; set; } // Get or set element at index i
++++ void Add(T item); // Add element at end
++++ void Insert(int i, T item); // Insert element at index i
++++ void RemoveAt(int i); // Remove element at index i
++++ IMyList<U> Map<U>(Mapper<T,U> f); // Map f over all elements
++++}
++++
++++public class LinkedList<T> : IMyList<T> {
++++ protected int size; // Number of elements in the list
++++ protected Node first, last; // Invariant: first==null iff last==null
++++
++++ protected class Node {
++++ public Node prev, next;
++++ public T item;
++++
++++ public Node(T item) {
++++ this.item = item;
++++ }
++++
++++ public Node(T item, Node prev, Node next) {
++++ this.item = item; this.prev = prev; this.next = next;
++++ }
++++ }
++++
++++ public LinkedList() {
++++ first = last = null;
++++ size = 0;
++++ }
++++
++++ public LinkedList(params T[] arr) : this() {
++++ foreach (T x in arr)
++++ Add(x);
++++ }
++++
++++ public int Count {
++++ get { return size; }
++++ }
++++
++++ public T this[int i] {
++++ get { return get(i).item; }
++++ set { get(i).item = value; }
++++ }
++++
++++ private Node get(int n) {
++++ if (n < 0 || n >= size)
++++ throw new IndexOutOfRangeException();
++++ else if (n < size/2) { // Closer to front
++++ Node node = first;
++++ for (int i=0; i<n; i++)
++++ node = node.next;
++++ return node;
++++ } else { // Closer to end
++++ Node node = last;
++++ for (int i=size-1; i>n; i--)
++++ node = node.prev;
++++ return node;
++++ }
++++ }
++++
++++ public void Add(T item) {
++++ Insert(size, item);
++++ }
++++
++++ public void Insert(int i, T item) {
++++ if (i == 0) {
++++ if (first == null) // and thus last == null
++++ first = last = new Node(item);
++++ else {
++++ Node tmp = new Node(item, null, first);
++++ first.prev = tmp;
++++ first = tmp;
++++ }
++++ size++;
++++ } else if (i == size) {
++++ if (last == null) // and thus first = null
++++ first = last = new Node(item);
++++ else {
++++ Node tmp = new Node(item, last, null);
++++ last.next = tmp;
++++ last = tmp;
++++ }
++++ size++;
++++ } else {
++++ Node node = get(i);
++++ // assert node.prev != null;
++++ Node newnode = new Node(item, node.prev, node);
++++ node.prev.next = newnode;
++++ node.prev = newnode;
++++ size++;
++++ }
++++ }
++++
++++ public void RemoveAt(int i) {
++++ Node node = get(i);
++++ if (node.prev == null)
++++ first = node.next;
++++ else
++++ node.prev.next = node.next;
++++ if (node.next == null)
++++ last = node.prev;
++++ else
++++ node.next.prev = node.prev;
++++ size--;
++++ }
++++
++++ public override bool Equals(Object that) {
++++ if (that != null && GetType() == that.GetType()
++++ && this.size == ((IMyList<T>)that).Count) {
++++ Node thisnode = this.first;
++++ IEnumerator<T> thatenm = ((IMyList<T>)that).GetEnumerator();
++++ while (thisnode != null) {
++++ if (!thatenm.MoveNext())
++++ throw new ApplicationException("Impossible: LinkedList<T>.Equals");
++++ // assert MoveNext() was true (because of the above size test)
++++ if (!thisnode.item.Equals(thatenm.Current))
++++ return false;
++++ thisnode = thisnode.next;
++++ }
++++ // assert !MoveNext(); // because of the size test
++++ return true;
++++ } else
++++ return false;
++++ }
++++
++++ public override int GetHashCode() {
++++ int hash = 0;
++++ foreach (T x in this)
++++ hash ^= x.GetHashCode();
++++ return hash;
++++ }
++++
++++ public static explicit operator LinkedList<T>(T[] arr) {
++++ return new LinkedList<T>(arr);
++++ }
++++
++++ public static LinkedList<T> operator +(LinkedList<T> xs1, LinkedList<T> xs2) {
++++ LinkedList<T> res = new LinkedList<T>();
++++ foreach (T x in xs1)
++++ res.Add(x);
++++ foreach (T x in xs2)
++++ res.Add(x);
++++ return res;
++++ }
++++
++++ public IMyList<U> Map<U>(Mapper<T,U> f) {
++++ LinkedList<U> res = new LinkedList<U>();
++++ foreach (T x in this)
++++ res.Add(f(x));
++++ return res;
++++ }
++++
++++ public IEnumerator<T> GetEnumerator() {
++++ return new LinkedListEnumerator(this);
++++ }
++++
++++ IEnumerator IEnumerable.GetEnumerator() {
++++ return new LinkedListEnumerator(this);
++++ }
++++
++++ private class LinkedListEnumerator : IEnumerator<T> {
++++ T curr; // The enumerator's current element
++++ bool valid; // Is the current element valid?
++++ Node next; // Node holding the next element, or null
++++
++++ public LinkedListEnumerator(LinkedList<T> lst) {
++++ next = lst.first; valid = false;
++++ }
++++
++++ public T Current {
++++ get {
++++ if (valid)
++++ return curr;
++++ else
++++ throw new InvalidOperationException();
++++ }
++++ }
++++
++++ object IEnumerator.Current {
++++ get { return Current; }
++++ }
++++
++++ public bool MoveNext() {
++++ if (next != null) {
++++ curr = next.item; next = next.next; valid = true;
++++ } else
++++ valid = false;
++++ return valid;
++++ }
++++
++++ public void Reset() {
++++ throw new NotImplementedException ();
++++ }
++++
++++ public void Dispose() {
++++ curr = default(T); next = null; valid = false;
++++ }
++++ }
++++}
++++
++++class SortedList<T> : LinkedList<T> where T : IComparable<T> {
++++ // Sorted insertion
++++ public void Insert(T x) {
++++ Node node = first;
++++ while (node != null && x.CompareTo(node.item) > 0)
++++ node = node.next;
++++ if (node == null) // x > all elements; insert at end
++++ Add(x);
++++ else { // x <= node.item; insert before node
++++ Node newnode = new Node(x);
++++ if (node.prev == null) // insert as first element
++++ first = newnode;
++++ else
++++ node.prev.next = newnode;
++++ newnode.next = node;
++++ newnode.prev = node.prev;
++++ node.prev = newnode;
++++ }
++++ }
++++}
++++
++++interface IPrintable {
++++ void Print(TextWriter fs);
++++}
++++class PrintableLinkedList<T> : LinkedList<T>, IPrintable where T : IPrintable {
++++ public void Print(TextWriter fs) {
++++ bool firstElement = true;
++++ foreach (T x in this) {
++++ x.Print(fs);
++++ if (firstElement)
++++ firstElement = false;
++++ else
++++ fs.Write(", ");
++++ }
++++ }
++++}
++++
++++class MyString : IComparable<MyString> {
++++ private readonly String s;
++++ public MyString(String s) {
++++ this.s = s;
++++ }
++++ public int CompareTo(MyString that) {
++++ return String.Compare(that.Value, s); // Reverse ordering
++++ }
++++ public bool Equals(MyString that) {
++++ return that.Value == s;
++++ }
++++ public String Value {
++++ get { return s; }
++++ }
++++}
++++
++++class MyTest {
++++ public static void Main(String[] args) {
++++ LinkedList<double> dLst = new LinkedList<double>(7.0, 9.0, 13.0, 0.0);
++++ foreach (double d in dLst)
++++ Console.Write("{0} ", d);
++++ Console.WriteLine();
++++ IMyList<int> iLst =
++++ dLst.Map<int>(new Mapper<double, int>(Math.Sign));
++++ foreach (int i in iLst)
++++ Console.Write("{0} ", i);
++++ Console.WriteLine();
++++ IMyList<String> sLst =
++++ dLst.Map<String>(delegate(double d) { return "s" + d; });
++++ foreach (String s in sLst)
++++ Console.Write("{0} ", s);
++++ Console.WriteLine();
++++ // Testing SortedList<MyString>
++++ SortedList<MyString> sortedLst = new SortedList<MyString>();
++++ sortedLst.Insert(new MyString("New York"));
++++ sortedLst.Insert(new MyString("Rome"));
++++ sortedLst.Insert(new MyString("Dublin"));
++++ sortedLst.Insert(new MyString("Riyadh"));
++++ sortedLst.Insert(new MyString("Tokyo"));
++++ foreach (MyString s in sortedLst)
++++ Console.Write("{0} ", s.Value);
++++ Console.WriteLine();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++namespace Slow
++++{
++++ public interface ITest
++++ {
++++ void DoNothing<T>()
++++ where T : class;
++++ }
++++
++++ public class Test : ITest
++++ {
++++ public void DoNothing<T>()
++++ where T : class
++++ {
++++ T x = null;
++++ }
++++ }
++++
++++ class Program
++++ {
++++ static void Main(string[] args)
++++ {
++++ const int iterations = 10000;
++++
++++ Test test = new Test ();
++++
++++ DateTime start = DateTime.Now;
++++ Console.Write ("Calling Test.DoNothing<Program>() on an object reference... ");
++++ for (int i = 0; i < iterations; ++i)
++++ {
++++ test.DoNothing<Program> ();
++++ }
++++ DateTime end = DateTime.Now;
++++ TimeSpan duration = end - start;
++++ Console.WriteLine ("Took " + duration.TotalMilliseconds + " ms.");
++++
++++ ITest testInterface = test;
++++
++++ start = DateTime.Now;
++++ Console.Write ("Calling Test.DoNothing<Program>() on an interface reference... ");
++++ for (int i = 0; i < iterations; ++i)
++++ {
++++ testInterface.DoNothing<Program> ();
++++ }
++++ end = DateTime.Now;
++++ duration = end - start;
++++ Console.WriteLine ("Took " + duration.TotalMilliseconds + " ms.");
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public interface IFoo<T>
++++{ }
++++
++++public class Foo<T>
++++{
++++ public static bool Test (T x)
++++ {
++++ return x is IFoo<T>;
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Foo<int>.Test (3);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//-- ex-gen-class-polynomial
++++
++++using System;
++++
++++// A type implements AddMul<A,R> if one can add an A to it, giving an R:
++++
++++interface AddMul<A,R> {
++++ R Add(A e); // Addition with A, giving R
++++ R Mul(A e); // Multiplication with A, giving R
++++}
++++
++++// Polynomials over E, Polynomial<E>:
++++
++++// The base type E of the polynomial must support addition,
++++// multiplication and zero (via the nullary constructor). That's what
++++// the type parameter constraint on E says.
++++
++++// In return, one can add an E or a polynomial over E to a polynomial
++++// over E. Similarly, a polynomial over E can be multiplied by an E
++++// or by a polynomial over E. That's what the interface clauses say.
++++
++++class Polynomial<E> : AddMul<E,Polynomial<E>>,
++++ AddMul<Polynomial<E>,Polynomial<E>>
++++ where E : AddMul<E,E>, new() {
++++ // cs contains coefficients of x^0, x^1, ...; absent coefficients are zero.
++++ // Invariant: cs != null && cs.Length >= 0; cs.Length==0 represents zero.
++++ private readonly E[] cs;
++++
++++ public Polynomial() {
++++ this.cs = new E[0];
++++ }
++++
++++ public Polynomial(E[] cs) {
++++ this.cs = cs;
++++ }
++++
++++ public Polynomial<E> Add(Polynomial<E> that) {
++++ int newlen = Math.Max(this.cs.Length, that.cs.Length);
++++ int minlen = Math.Min(this.cs.Length, that.cs.Length);
++++ E[] newcs = new E[newlen];
++++ if (this.cs.Length <= that.cs.Length) {
++++ for (int i=0; i<minlen; i++)
++++ newcs[i] = this.cs[i].Add(that.cs[i]);
++++ for (int i=minlen; i<newlen; i++)
++++ newcs[i] = that.cs[i];
++++ } else {
++++ for (int i=0; i<minlen; i++)
++++ newcs[i] = this.cs[i].Add(that.cs[i]);
++++ for (int i=minlen; i<newlen; i++)
++++ newcs[i] = this.cs[i];
++++ }
++++ return new Polynomial<E>(newcs);
++++ }
++++
++++ public Polynomial<E> Add(E that) {
++++ return this.Add(new Polynomial<E>(new E[] { that }));
++++ }
++++
++++ public Polynomial<E> Mul(E that) {
++++ E[] newcs = new E[cs.Length];
++++ for (int i=0; i<cs.Length; i++)
++++ newcs[i] = that.Mul(cs[i]);
++++ return new Polynomial<E>(newcs);
++++ }
++++
++++ public Polynomial<E> Mul(Polynomial<E> that) {
++++ int newlen = Math.Max(1, this.cs.Length + that.cs.Length - 1);
++++ E[] newcs = new E[newlen];
++++ for (int i=0; i<newlen; i++) {
++++ E sum = new E(); // Permitted by constraint E : new()
++++ int start = Math.Max(0, i-that.cs.Length+1);
++++ int stop = Math.Min(i, this.cs.Length-1);
++++ for (int j=start; j<=stop; j++) {
++++ // assert 0<=j && j<this.cs.Length && 0<=i-j && i-j<that.cs.Length;
++++ sum = sum.Add(this.cs[j].Mul(that.cs[i-j]));
++++ }
++++ newcs[i] = sum;
++++ }
++++ return new Polynomial<E>(newcs);
++++ }
++++
++++ public E Eval(E x) {
++++ E res = new E(); // Permitted by constraint E : new()
++++ for (int j=cs.Length-1; j>=0; j--)
++++ res = res.Mul(x).Add(cs[j]);
++++ return res;
++++ }
++++}
++++
++++struct Int : AddMul<Int,Int> {
++++ private readonly int i;
++++ public Int(int i) {
++++ this.i = i;
++++ }
++++ public Int Add(Int that) {
++++ return new Int(this.i + that.i);
++++ }
++++ public Int Mul(Int that) {
++++ return new Int(this.i * that.i);
++++ }
++++ public override String ToString() {
++++ return i.ToString();
++++ }
++++}
++++
++++class TestPolynomial {
++++ public static void Main(String[] args) {
++++ // The integer polynomial 2 + 5x + x^2
++++ Polynomial<Int> ip =
++++ new Polynomial<Int>(new Int[] { new Int(2), new Int(5), new Int(1) });
++++ Console.WriteLine(ip.Eval(new Int(10))); // 152
++++ Console.WriteLine(ip.Add(ip).Eval(new Int(10))); // 304 = 152 + 152
++++ Console.WriteLine(ip.Mul(ip).Eval(new Int(10))); // 23104 = 152 * 152
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++using System;
++++
++++public class Tests {
++++
++++ public unsafe static void Main () {
++++ Console.WriteLine (typeof (void).Name);
++++ Console.WriteLine (typeof (void*).Name);
++++ Console.WriteLine (typeof (void**).Name);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public interface ISequenced<T>
++++{
++++ bool Equals (ISequenced<T> that);
++++}
++++
++++public class SequencedHasher <S,W>
++++ where S : ISequenced<W>
++++{
++++ public bool Equals (S i1, S i2)
++++ {
++++ return i1 == null ? i2 == null : i1.Equals (i2);
++++ }
++++}
++++
++++public class Sequenced<T> : ISequenced<T>
++++{
++++ public bool Equals (ISequenced<T> that)
++++ {
++++ return false;
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Sequenced<int> s = new Sequenced<int> ();
++++ SequencedHasher<Sequenced<int>,int> hasher = new SequencedHasher<Sequenced<int>,int> ();
++++ hasher.Equals (s, s);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public class B<T>
++++{
++++ public int Add (T obj)
++++ {
++++ return -1;
++++ }
++++
++++ public void AddRange (object o)
++++ {
++++ T obj = (T) o;
++++ Add (obj);
++++ }
++++}
++++
++++public interface IA
++++{
++++}
++++
++++public class A : IA
++++{
++++}
++++
++++public class Test
++++{
++++ public static void Main ()
++++ {
++++ B<IA> aux = new B<IA> ();
++++ aux.AddRange (new A ());
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++ class Test
++++ {
++++ static void Main(string[] args)
++++ {
++++ A<int> a = new A<int>(new A<int>.B(D), 3);
++++ a.Run();
++++ }
++++ public static void D(int y)
++++ {
++++ System.Console.WriteLine("Hello " + 3);
++++ }
++++ }
++++ class A<T>
++++ {
++++ public delegate void B(T t);
++++
++++ protected B _b;
++++ protected T _value;
++++
++++ public A(B b, T value)
++++ {
++++ _b = b;
++++ _value = value;
++++ }
++++ public void Run()
++++ {
++++ _b(_value);
++++ }
++++ }
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class A<T>
++++{
++++ public delegate void Foo ();
++++ public delegate void Bar<U> ();
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++interface IFoo <T>
++++{
++++ T this [int index] {
++++ get; set;
++++ }
++++}
++++
++++public class FooCollection <T> : IFoo <T>
++++{
++++ T IFoo<T>.this [int index] {
++++ get {
++++ return default(T);
++++ }
++++ set {
++++ }
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ IFoo<int> foo = new FooCollection<int> ();
++++ int a = foo [3];
++++ Console.WriteLine (a);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public interface IA<T> where T : struct {
++++
++++}
++++
++++public class B<T> : IA<T> where T:struct {
++++
++++}
++++
++++public class MainClass {
++++ public static void Main () {}
++++
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System.Collections.Generic;
++++
++++// comment this line to see another bug in gmcs (unrelated)
++++interface IB { bool foo (); }
++++
++++
++++class B : IB { public bool foo () { return true; } }
++++
++++interface Filter <T> where T : IB {
++++ T Is (IB x);
++++
++++}
++++
++++struct K : IB {
++++ public bool foo () { return false; }
++++
++++}
++++
++++class MyFilter : Filter <K> {
++++ public K Is (IB x) { return new K(); }
++++}
++++
++++class MyBFilter : Filter <B> {
++++ public B Is (IB x) { return new B(); }
++++}
++++
++++class M {
++++
++++ static List<T> foo1 <T> (Filter <T> x) where T : IB {
++++ List <T> result = new List <T>();
++++ T maybe = x.Is (new B());
++++ if (maybe != null)
++++ result.Add (maybe);
++++ return result;
++++ }
++++
++++ static void Main () {
++++ MyFilter m = new MyFilter ();
++++ System.Console.WriteLine (foo1 <K> (m).Count);
++++ MyBFilter mb = new MyBFilter ();
++++ System.Console.WriteLine (foo1 <B> (mb).Count);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public class A<T>
++++{
++++ public delegate void Changed (A<T> a);
++++
++++ protected event Changed _changed;
++++
++++ public void Register (Changed changed)
++++ {
++++ _changed += changed;
++++ _changed (this);
++++ }
++++}
++++
++++public class Test
++++{
++++ public static void Main ()
++++ {
++++ A<int> a = new A<int> ();
++++ a.Register (new A<int>.Changed (Del));
++++ }
++++
++++ public static void Del (A<int> a)
++++ {
++++ System.Console.WriteLine ("Solved");
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Reflection;
++++
++++namespace FLMID.Bugs.ParametersOne
++++{
++++ public class Class<T>
++++ {
++++ public void Add(T x)
++++ {
++++ System.Console.WriteLine("OK");
++++ }
++++ }
++++ public class Test
++++ {
++++
++++ public static void Main(string [] args)
++++ {
++++ Class<string> instance = new Class<string>();
++++
++++ MethodInfo _method = null;
++++
++++ foreach(MethodInfo method in
++++typeof(Class<string>).GetMethods(BindingFlags.Instance | BindingFlags.Public))
++++ {
++++ if(method.Name.Equals("Add") && method.GetParameters().Length==1)
++++ {
++++ _method = method;
++++ break;
++++ }
++++ }
++++ _method.Invoke(instance , new object[]{"1"});
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++namespace B
++++{
++++ using C;
++++
++++ partial class Test <T>
++++ where T : IA, IB
++++ { }
++++}
++++
++++namespace B
++++{
++++ partial class Test <T>
++++ where T : C.IB, C.IA
++++ { }
++++}
++++
++++namespace B
++++{
++++ partial class Test <T>
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
++++
++++namespace C {
++++ interface IA { }
++++ interface IB { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//-- ex-nullable-bool
++++
++++using System;
++++
++++class MyTest {
++++ public static void Main(String[] args) {
++++ Console.WriteLine("Note that null prints as blank or []\n");
++++ bool? b1 = null, b2 = false, b3 = true;
++++ bool? b4 = b1^b2, b5 = b1&b2, b6 = b1|b2; // null false null
++++ Console.WriteLine("[{0}] [{1}] [{2}]", b4, b5, b6);
++++ bool? b7 = b1^b3, b8 = b1&b3, b9 = b1|b3; // null null true
++++ Console.WriteLine("[{0}] [{1}] [{2}]", b7, b8, b9);
++++ Console.WriteLine(b1 ? "null is true" : "null is false"); // null is false
++++ Console.WriteLine(!b1 ? "!null is true" : "!null is false"); // !null is false
++++
++++ Console.WriteLine();
++++ bool?[] bvals = new bool?[] { null, false, true };
++++ Console.WriteLine("{0,-6} {1,-6} {2,-6} {3,-6} {4,-6}",
++++ "x", "y", "x&y", "x|y", "x^y");
++++ foreach (bool? x in bvals)
++++ foreach (bool? y in bvals)
++++ Console.WriteLine("{0,-6} {1,-6} {2,-6} {3,-6} {4,-6}",
++++ x, y, x&y, x|y, x^y);
++++ Console.WriteLine();
++++ Console.WriteLine("{0,-6} {1,-6}", "x", "!x");
++++ foreach (bool? x in bvals)
++++ Console.WriteLine("{0,-6} {1,-6}", x, !x);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//-- ex-nullable
++++
++++using System;
++++
++++class MyTest {
++++ public static void Main(String[] args) {
++++ Console.WriteLine("Note that null prints as blank or []\n");
++++ int? i1 = 11, i2 = 22, i3 = null, i4 = i1+i2, i5 = i1+i3;
++++ // Values: 11 22 null 33 null
++++ Console.WriteLine("[{0}] [{1}] [{2}] [{3}] [{4}]", i1, i2, i3, i4, i5);
++++ int i6 = (int)i1; // Legal
++++ // int i7 = (int)i5; // Legal but fails at run-time
++++ // int i8 = i1; // Illegal
++++
++++ int?[] iarr = { i1, i2, i3, i4, i5 };
++++ i2 += i1;
++++ i2 += i4;
++++ Console.WriteLine("i2 = {0}", i2); // 66 = 11+22+33
++++
++++ int sum = 0;
++++ for (int i=0; i<iarr.Length; i++)
++++ sum += iarr[i] != null ? iarr[i].Value : 0;
++++ // sum += iarr[i] ?? 0;
++++ Console.WriteLine("sum = {0}", sum); // 66 = 11+22+33
++++
++++ for (int i=0; i<iarr.Length; i++)
++++ if (iarr[i] > 11)
++++ Console.Write("[{0}] ", iarr[i]); // 22 33
++++ Console.WriteLine();
++++
++++ for (int i=0; i<iarr.Length; i++)
++++ if (iarr[i] != i1)
++++ Console.Write("[{0}] ", iarr[i]); // 22 null 33 null
++++ Console.WriteLine();
++++ Console.WriteLine();
++++ int?[] ivals = { null, 2, 5 };
++++ Console.WriteLine("{0,6} {1,6} {2,6} {3,6} {4,-6} {5,-6} {6,-6} {7,-6}",
++++ "x", "y", "x+y", "x-y", "x<y", "x>=y", "x==y", "x!=y");
++++ Console.WriteLine();
++++ foreach (int? x in ivals)
++++ foreach (int? y in ivals)
++++ Console.WriteLine("{0,6} {1,6} {2,6} {3,6} {4,-6} {5,-6} {6,-6} {7,-6}",
++++ x, y, x+y, x-y, (x<y), (x>=y), x==y, x!=y);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//-- ex-nullable-sqrt
++++
++++using System;
++++
++++class MyTest {
++++ public static int? Sqrt(int? x) {
++++ if (x.HasValue && x.Value >= 0)
++++ return (int)(Math.Sqrt(x.Value));
++++ else
++++ return null;
++++ }
++++
++++ public static void Main(String[] args) {
++++ // Prints :2:::
++++ Console.WriteLine(":{0}:{1}:{2}:", Sqrt(5), Sqrt(null), Sqrt(-5));
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Not used -- ex-nullable-struct
++++
++++// Converting a struct from S to S? creates a copy of the struct.
++++// Getting the struct out of the non-null value creates another copy.
++++
++++using System;
++++
++++struct S {
++++ private int x;
++++ public int X {
++++ get { return x; }
++++ set { this.x = value; } // Cannot be used on non-variable ns.Value
++++ }
++++ public void Set(int x) {
++++ this.x = x;
++++ }
++++}
++++
++++class MyTest {
++++ public static void Main(String[] args) {
++++ S s = new S();
++++ s.Set(11);
++++ Console.WriteLine("s.X = {0}", s.X);
++++ S? ns = s;
++++ Console.WriteLine("s.X = {0} ns.Value.X = {1}", s.X, ns.Value.X);
++++ ns.Value.Set(22);
++++ Console.WriteLine("s.X = {0} ns.Value.X = {1}", s.X, ns.Value.X);
++++ s.Set(33);
++++ Console.WriteLine("s.X = {0} ns.Value.X = {1}", s.X, ns.Value.X);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// sestoft@dina.kvl.dk * 2004-08
++++
++++using System;
++++
++++class MyTest {
++++ public static void Main(String[] args) {
++++ Foo<int?> fni1 = new Foo<int?>(null);
++++ Console.WriteLine(fni1.Fmt());
++++ Foo<int?> fni2 = new Foo<int?>(17);
++++ Console.WriteLine(fni2.Fmt());
++++ Foo<int> fi = new Foo<int>(7);
++++ Console.WriteLine(fi.Fmt());
++++ Foo<String> fs1 = new Foo<String>(null);
++++ Console.WriteLine(fs1.Fmt());
++++ Foo<String> fs2 = new Foo<String>("haha");
++++ Console.WriteLine(fs2.Fmt());
++++ }
++++}
++++
++++class Foo<T> {
++++ T x;
++++ public Foo(T x) {
++++ this.x = x;
++++ }
++++
++++ // This shows how to deal with tests for null in a generic setting
++++ // where null may mean both `null reference' and `null value of a
++++ // nullable type'. Namely, the test (x == null) will always be
++++ // false if the generic type parameter t is instantiated with a
++++ // nullable type. Reason: the null literal will be considered a
++++ // null reference and x will be boxed if a value type, and hence the
++++ // comparison will be false...
++++
++++ public String Fmt() {
++++ if (x is INullableValue && ((INullableValue)x).HasValue
++++ || !(x is INullableValue) && x != null)
++++ return x.ToString();
++++ else
++++ return "null";
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ int? a = null;
++++ int b = 3;
++++ long? c = a;
++++ Console.WriteLine (c);
++++ long? d = b;
++++ byte? f = (byte?) d;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++namespace Martin {
++++ public class A
++++ {
++++ public readonly long Data;
++++
++++ public A (long data)
++++ {
++++ this.Data = data;
++++ }
++++
++++ public static explicit operator B (A a)
++++ {
++++ return new B ((int) a.Data);
++++ }
++++ }
++++
++++ public class B
++++ {
++++ public readonly int Data;
++++
++++ public B (int data)
++++ {
++++ this.Data = data;
++++ }
++++
++++ public static implicit operator A (B b)
++++ {
++++ return new A (b.Data);
++++ }
++++ }
++++
++++ class X
++++ {
++++ static void Main ()
++++ {
++++ B? b = new B (5);
++++ A? a = b;
++++ B? c = (B?) a;
++++ B? d = (Martin.B?) a;
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ int? a = 4;
++++ int? b = -a;
++++ Console.WriteLine (b);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ int? a = 4;
++++ long b = 5;
++++ long? c = a * b;
++++ Console.WriteLine (c);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ bool? a = true;
++++ int? b = a ? 3 : 4;
++++ Console.WriteLine (b);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ int?[] bvals = new int?[] { null, 3, 4 };
++++ foreach (long? x in bvals)
++++ Console.WriteLine (x);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ int?[] bvals = new int? [] { null, 3, 4 };
++++ foreach (int? x in bvals)
++++ Console.WriteLine (x);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public static class Assert
++++{
++++ public static int Errors {
++++ get { return errors; }
++++ }
++++
++++ static int errors = 0;
++++
++++ static void Error (string method, string text)
++++ {
++++ Console.WriteLine ("Assert failed: {0} ({1})", method, text);
++++ errors++;
++++ }
++++
++++ public static void IsTrue (string text, bool b)
++++ {
++++ if (!b)
++++ Error ("IsTrue", text);
++++ }
++++
++++ public static void IsFalse (string text, bool b)
++++ {
++++ if (b)
++++ Error ("IsFalse", text);
++++ }
++++
++++ public static void IsNull<T> (string text, Nullable<T> nullable)
++++ {
++++ if (nullable.HasValue)
++++ Error ("IsNull", text);
++++ }
++++
++++ public static void IsNotNull<T> (string text, Nullable<T> nullable)
++++ {
++++ if (!nullable.HasValue)
++++ Error ("IsNotNull", text);
++++ }
++++
++++ public static void IsTrue (string text, Nullable<bool> b)
++++ {
++++ if (!b.HasValue || !b.Value)
++++ Error ("IsTrue", text);
++++ }
++++
++++ public static void IsFalse (string text, Nullable<bool> b)
++++ {
++++ if (!b.HasValue || b.Value)
++++ Error ("IsFalse", text);
++++ }
++++}
++++
++++class X
++++{
++++ static int Main ()
++++ {
++++ bool? a = null, b = false, c = true;
++++ bool? d = null, e = false, f = true;
++++
++++ Assert.IsNull ("a", a);
++++ Assert.IsFalse ("b", b);
++++ Assert.IsTrue ("c", c);
++++ Assert.IsTrue ("a == d", a == d);
++++ Assert.IsTrue ("b == e", b == e);
++++ Assert.IsTrue ("c == f", c == f);
++++
++++ Assert.IsFalse ("a != d", a != d);
++++ Assert.IsFalse ("a == b", a == b);
++++ Assert.IsTrue ("a != b", a != b);
++++
++++ Assert.IsNull ("d & a", d & a);
++++ Assert.IsFalse ("d & b", d & b);
++++ Assert.IsNull ("d & c", d & c);
++++ Assert.IsFalse ("e & a", e & a);
++++ Assert.IsFalse ("e & b", e & b);
++++ Assert.IsFalse ("e & c", e & c);
++++ Assert.IsNull ("f & a", f & a);
++++ Assert.IsFalse ("f & b", f & b);
++++ Assert.IsTrue ("f & c", f & c);
++++
++++ Assert.IsNull ("d | a", d | a);
++++ Assert.IsNull ("d | b", d | b);
++++ Assert.IsTrue ("d | c", d | c);
++++ Assert.IsNull ("e | a", e | a);
++++ Assert.IsFalse ("e | b", e | b);
++++ Assert.IsTrue ("e | c", e | c);
++++ Assert.IsTrue ("f | a", f | a);
++++ Assert.IsTrue ("f | b", f | b);
++++ Assert.IsTrue ("f | c", f | c);
++++
++++ Assert.IsNull ("d && a", d && a);
++++ Assert.IsFalse ("d && b", d && b);
++++ Assert.IsNull ("d && c", d && c);
++++ Assert.IsFalse ("e && a", e && a);
++++ Assert.IsFalse ("e && b", e && b);
++++ Assert.IsFalse ("e && c", e && c);
++++ Assert.IsNull ("f && a", f && a);
++++ Assert.IsFalse ("f && b", f && b);
++++ Assert.IsTrue ("f && c", f && c);
++++
++++ Assert.IsNull ("d || a", d || a);
++++ Assert.IsNull ("d || b", d || b);
++++ Assert.IsTrue ("d || c", d || c);
++++ Assert.IsNull ("e || a", e || a);
++++ Assert.IsFalse ("e || b", e || b);
++++ Assert.IsTrue ("e || c", e || c);
++++ Assert.IsTrue ("f || a", f || a);
++++ Assert.IsTrue ("f || b", f || b);
++++ Assert.IsTrue ("f || c", f || c);
++++
++++ int? g = 3, h = null, i = 3, j = null;
++++
++++ Assert.IsFalse ("g == null", g == null);
++++ Assert.IsTrue ("g != null", g != null);
++++ Assert.IsTrue ("h == null", h == null);
++++ Assert.IsFalse ("h != null", h != null);
++++
++++ Assert.IsTrue ("g == i", g == i);
++++ Assert.IsFalse ("g != i", g != i);
++++ Assert.IsFalse ("g == j", g == j);
++++ Assert.IsTrue ("g != j", g != j);
++++ Assert.IsFalse ("h == i", h == i);
++++ Assert.IsTrue ("h != i", h != i);
++++ Assert.IsTrue ("h == j", h == j);
++++ Assert.IsFalse ("h != j", h != j);
++++
++++ Console.WriteLine ("{0} errors.", Assert.Errors);
++++ return Assert.Errors;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class X
++++{
++++ static int Test ()
++++ {
++++ int? a = 5;
++++ int? b = a++;
++++
++++ if (a != 6)
++++ return 1;
++++ if (b != 5)
++++ return 2;
++++
++++ int? c = ++a;
++++
++++ if (c != 7)
++++ return 3;
++++
++++ b++;
++++ ++b;
++++
++++ if (b != 7)
++++ return 4;
++++
++++ int? d = b++ + ++a;
++++
++++ if (a != 8)
++++ return 5;
++++ if (b != 8)
++++ return 6;
++++ if (d != 15)
++++ return 7;
++++
++++ return 0;
++++ }
++++
++++ static int Main ()
++++ {
++++ int result = Test ();
++++ if (result != 0)
++++ Console.WriteLine ("ERROR: {0}", result);
++++ return result;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++namespace Test
++++{
++++ public class Application
++++ {
++++ public static void Main()
++++ {
++++ string[] array = new string[10];
++++
++++ System.Collections.Generic.IEnumerable<string> enumer = array;
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++public class Test<T>{
++++ private T[,] data;
++++ public Test(T[,] data){
++++ this.data = data;
++++ }
++++}
++++public class Program{
++++ public static void Main(string[] args){
++++ Test<double> test = new Test<double>(new double[2,2]);
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class MyLinkedList<T> {
++++ protected Node first;
++++
++++ protected class Node
++++ {
++++ public T item;
++++
++++ public Node (T item)
++++ {
++++ this.item = item;
++++ }
++++ }
++++}
++++
++++class SortedList<U> : MyLinkedList<U>
++++{
++++ public void Insert (U x) {
++++ Node node = first;
++++ }
++++}
++++
++++class X {
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++namespace A
++++{
++++ interface IFoo
++++ {
++++ void Hello (IFoo foo);
++++ }
++++}
++++
++++namespace B
++++{
++++ partial class Test <T> : IDoo, A.IFoo where T : A.IFoo
++++ { }
++++}
++++
++++namespace B
++++{
++++ using A;
++++
++++ partial class Test <T> : Y, IFoo where T : IFoo
++++ {
++++ void IFoo.Hello (IFoo foo)
++++ { }
++++ }
++++}
++++
++++interface IDoo { }
++++
++++class Y { }
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
++++
++++
++++
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++static class Test1 {
++++ public class IOp<T> { }
++++ static void Foo<S,OP>(uint v) where OP : IOp<S> { }
++++};
++++
++++static class Test2 {
++++ public class IOp<T> { }
++++ static void Foo<T,OP>(uint v) where OP : IOp<T> { }
++++};
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++static class Test1 {
++++ public class IOp<T> { }
++++ static void Foo<S,OP>(uint v) where OP : IOp<S> { }
++++};
++++
++++static class Test2 {
++++ public class IOp<T> { }
++++ static void Foo<T,OP>(uint v) where OP : IOp<T> { }
++++};
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++static class Test1 {
++++ public interface IOp<T> {
++++ T Func(uint v);
++++ }
++++ public struct Op : IOp<ushort>, IOp<uint> {
++++ ushort IOp<ushort>.Func(uint v) { return (ushort )(v * 2); }
++++ uint IOp<uint>.Func(uint v) { return v * 4; }
++++ }
++++ static void Foo<T,OP>(uint v) where T:struct where OP : IOp<T> {
++++ OP op = default(OP);
++++ System.Console.WriteLine( op.Func(v) );
++++ }
++++ static public void Main() {
++++ Foo<ushort, Op>(100);
++++ Foo<uint, Op>(100);
++++ }
++++};
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Test<T> where T: struct{
++++ public Test(){
++++ T s = new T();
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public interface IFoo
++++{
++++ IFoo Hello ();
++++}
++++
++++public interface IFoo<T> : IFoo
++++{
++++ new IFoo<T> Hello ();
++++}
++++
++++public interface ICollectionValue<T>: IFoo<T>
++++{
++++}
++++
++++public interface ICollection<T>: ICollectionValue<T>
++++{ }
++++
++++public abstract class EnumerableBase<T> : IFoo<T>
++++{
++++ public abstract IFoo<T> Hello();
++++
++++ IFoo IFoo.Hello ()
++++ {
++++ return Hello ();
++++ }
++++}
++++
++++public abstract class CollectionBase<T> : EnumerableBase<T>
++++{
++++}
++++
++++public class HashBag<T>: CollectionBase<T>, ICollection<T>
++++{
++++ public override IFoo<T> Hello ()
++++ {
++++ return this;
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public interface IBase
++++{
++++ void DoSomeThing();
++++}
++++
++++public interface IExtended : IBase
++++{
++++ void DoSomeThingElse();
++++}
++++
++++public class MyClass<T> where T: IExtended, new()
++++{
++++ public MyClass()
++++ {
++++ T instance = new T();
++++ instance.DoSomeThing();
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public delegate int T<X> (X x);
++++
++++public class B
++++{
++++ public static T<X> M<X> ()
++++ {
++++ return delegate(X x) { return 5; };
++++ }
++++
++++ public static T<long> N ()
++++ {
++++ return delegate(long x) { return 6; };
++++ }
++++}
++++
++++public class D
++++{
++++ public static void Main ()
++++ {
++++ B.M<int>();
++++ B.N ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public interface IBase
++++{
++++ void DoSomeThing();
++++}
++++
++++public interface IExtended : IBase
++++{
++++ void DoSomeThingElse();
++++}
++++
++++public class MyClass<T> where T: IExtended, new()
++++{
++++ public MyClass()
++++ {
++++ T instance = new T();
++++ instance.DoSomeThing();
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++namespace FLMID.Bugs.Marshal15
++++{
++++ public class A<T>
++++
++++ {
++++
++++ }
++++ public abstract class B
++++ {
++++ protected A<bool> _aux;
++++ }
++++ public class X : B
++++ {
++++ }
++++ public abstract class C
++++ {
++++ protected B _layout;
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:gtest-156-lib.dll
++++
++++namespace FLMID.Bugs.Marshal15
++++{
++++ public class D : C
++++ {
++++ public D()
++++ {
++++ _layout = new X();
++++ }
++++ public static void Main(string[] args)
++++ {
++++ System.Console.WriteLine("OK");
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++interface a <t> { void x (); }
++++
++++interface b <t> : a <t> {}
++++
++++class kv <k,v> {} // type t
++++
++++interface c <k,v>: b <kv<k,v>>, // b <t>
++++ a <kv<k,v>> // a <t>
++++{}
++++
++++class m <k,v> : c <k,v>,
++++ b <kv<k,v>> // b <t>
++++{
++++ void a <kv <k,v>>.x () {} // a<t>.x ()
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public class Moo<C>
++++ where C : Moo<C>.Foo
++++{
++++ public class Foo
++++ { }
++++}
++++
++++public class Test : Moo<Test>.Foo
++++{
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ {
++++ Moo<Test> moo = new Moo<Test> ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Collections.Generic;
++++
++++public class App {
++++ public static void Main() {
++++ Dictionary<string, int> values = new Dictionary<string, int>();
++++ values["one"] = 1; values["two"] = 2;
++++
++++ foreach (string key in values.Keys) {
++++ System.Console.WriteLine("key: {0}", key);
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++class Fun<A,B> {}
++++
++++class List<T> {
++++ public List<T2> Map<T2> (Fun<T,T2> x)
++++ {
++++ return new List<T2>();
++++ }
++++
++++ public void foo<T2> ()
++++ {
++++ (new List<T2> ()).Map<T> (new Fun<T2,T> ());
++++ }
++++}
++++
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++public class FP {
++++ public delegate U Mapping<T, U>(T obj);
++++
++++ public static T identity<T>(T obj) { return obj; }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:gtest-161-lib.dll
++++public class App {
++++ public static void Main() {
++++ string s = apply<int, string>(3,
++++ delegate (int x) {
++++ return x.ToString(); });
++++ int y = apply<int, int>(3, FP.identity<int>);
++++ }
++++
++++ static U apply<T, U>(T obj, FP.Mapping<T, U> f) {
++++ return f(obj);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Reflection;
++++
++++public class Generic<T>
++++{
++++ public delegate void Delegate(Generic<T> proxy, T value);
++++}
++++
++++class X
++++{
++++ static int Main ()
++++ {
++++ Type t = typeof (Generic<bool>);
++++ MemberInfo[] mi = t.FindMembers (MemberTypes.NestedType,
++++ BindingFlags.Static | BindingFlags.Public |
++++ BindingFlags.DeclaredOnly, null, null);
++++
++++ return mi.Length - 1;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Collections;
++++using System.Collections.Generic;
++++
++++public class Foo<T>
++++{
++++ public IEnumerator<T> getEnumerator (int arg)
++++ {
++++ if (arg == 1) {
++++ int foo = arg;
++++ Console.WriteLine (foo);
++++ }
++++
++++ if (arg == 2) {
++++ int foo = arg;
++++ Console.WriteLine (foo);
++++ }
++++
++++ yield break;
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Collections;
++++using System.Collections.Generic;
++++
++++public delegate int Int2Int (int i);
++++
++++public class FunEnumerable
++++{
++++ int size;
++++ Int2Int f;
++++
++++ public FunEnumerable(int size, Int2Int f)
++++ {
++++ this.size = size; this.f = f;
++++ }
++++
++++ public IEnumerator<int> GetEnumerator()
++++ {
++++ yield return f (size);
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Collections;
++++
++++class X {
++++ delegate void A ();
++++
++++ static IEnumerable GetIt (int [] args)
++++ {
++++ foreach (int arg in args) {
++++ Console.WriteLine ("OUT: {0}", arg);
++++ A a = delegate {
++++ Console.WriteLine ("arg: {0}", arg);
++++ return;
++++ };
++++ a ();
++++ yield return arg;
++++ }
++++ }
++++
++++ static int Main ()
++++ {
++++ int total = 0;
++++ foreach (int i in GetIt (new int [] { 1, 2, 3})){
++++ Console.WriteLine ("Got: " + i);
++++ total += i;
++++ }
++++
++++ if (total != 6)
++++ return 1;
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library -unsafe
++++
++++public unsafe struct ExternalStruct
++++{
++++ public fixed double double_buffer [4];
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe -r:gtest-166-lib.dll
++++
++++// Fixed buffers tests
++++
++++using System;
++++
++++public unsafe struct TestNew {
++++ private fixed char test_1 [128];
++++ public fixed bool test2 [4];
++++
++++ public fixed int T [2];
++++ public fixed bool test20 [4], test21 [40];
++++
++++ private int foo, foo2;
++++ public void SetTest () {
++++ fixed (char* c = test_1) {
++++ *c = 'g';
++++ }
++++ }
++++}
++++
++++public class C {
++++ unsafe static int Test () {
++++ TestNew tt = new TestNew ();
++++ tt.SetTest ();
++++ tt.test2 [2] = false;
++++ tt.T [1] = 5544;
++++ if (tt.T [1] != 5544)
++++ return 2;
++++
++++ ExternalStruct es = new ExternalStruct ();
++++ es.double_buffer [1] = 999999.8888;
++++ es.double_buffer [0] = es.double_buffer [1];
++++
++++ // Attributes test
++++ if (Attribute.GetCustomAttribute (typeof (TestNew).GetField ("test2"), typeof (System.Runtime.CompilerServices.FixedBufferAttribute)) == null)
++++ return 3;
++++
++++
++++ if (typeof (TestNew).GetNestedTypes ().Length != 5)
++++ return 5;
++++
++++ foreach (Type t in typeof (TestNew).GetNestedTypes ()) {
++++ if (Attribute.GetCustomAttribute (t, typeof (System.Runtime.CompilerServices.CompilerGeneratedAttribute)) == null)
++++ return 4;
++++ }
++++
++++ Console.WriteLine ("OK");
++++ return 0;
++++ }
++++
++++ public static int Main () {
++++ return Test ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Conditional attribute class test\r
++++#define DEBUG
++++
++++using System;
++++using System.Diagnostics;
++++
++++[Conditional("DEBUG")]
++++public class TestAttribute : Attribute {}
++++
++++[Conditional("RELEASE")]
++++public class TestNotAttribute : Attribute {}
++++
++++[Conditional("A")]
++++[Conditional("DEBUG")]
++++[Conditional("B")]
++++public class TestMultiAttribute : Attribute {}
++++
++++// TestAttribute is included
++++[Test]
++++class Class1 {}
++++
++++// TestNotAttribute is not included
++++[TestNot]
++++class Class2 {}
++++
++++// Is included
++++[TestMulti]
++++class Class3 {}
++++
++++
++++public class TestClass
++++{
++++ public static int Main ()
++++ {
++++ if (Attribute.GetCustomAttributes (typeof (Class1)).Length != 1)
++++ return 1;
++++
++++ if (Attribute.GetCustomAttributes (typeof (Class2)).Length != 0)
++++ return 1;
++++
++++ if (Attribute.GetCustomAttributes (typeof (Class3)).Length != 1)
++++ return 1;
++++
++++ Console.WriteLine ("OK");
++++ return 0;
++++ }
++++}
+++ /dev/null
----interface A : B {
----}
----
----interface B : A {
----}
+++ /dev/null
----interface A {
----}
----
----interface B : A{
----}
----
----interface C : A {
----}
----
----interface D : C {
----}
+++ /dev/null
----interface A : B {
----}
+++ /dev/null
----interface A {\r
----}\r
+++ /dev/null
----interface A : B {
----}
----
----interface B : A {
----}
+++ /dev/null
----class X {
----}
----
----interface A : X {
----}
+++ /dev/null
----// cs0509.cs: base class is sealed
----// Line: 7
----struct V {
---- int v;
----}
----
----class X : V {
----}
+++ /dev/null
----class A1 {
----}
----
----class A2 {
----}
----
----class B : A1, A2 {
----}
+++ /dev/null
----// cs0246.cs: can not find type `B'
----// Line: 4
----class X : D {
----}
+++ /dev/null
----interface X {
----
---- // Methods
---- new int IntegerMethod (int a, int b);
---- new int IntegerMethod (int a, string c);
---- new int StringMethod ();
---- int A (string b);
----
---- // Properties
---- new string TheString { get; set; }
---- int TheInt { get; }
---- int TheInt2 { set; }
---- int TheInt3 { set; get; }
----
---- // Events
---- new event int MyEvent;
---- event string MyEvent2;
----
---- // Indexers
----}
----
----
+++ /dev/null
----interface INTERFACE {
---- string PROPERTY { get; set; }
----}
+++ /dev/null
----using System;
----
----interface Blah {
---- string this [ int INDEX ] { get; set; }
---- string Item (int index);
----}
----
----public class Foo {
----
---- public static void Main ()
---- {
---- Console.WriteLine ("foo");
---- }
----}
----
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++# This file contains test files which cause any type of error.
++++
++++# This file supports extended syntax
++++# csXXXX.cs : test case causes error
++++# csXXXX.cs IGNORE : adds test to ignore list
++++
++++test-50.cs IGNORE
++++test-308.cs
++++test-322.cs
++++test-377.cs
++++test-386.cs
++++test-387.cs
++++test-anon-27.cs
++++test-xml-027.cs
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++# This file contains test files which cause any type of error.
++++
++++# This file supports extended syntax
++++# csXXXX.cs : test case causes error
++++# csXXXX.cs IGNORE : adds test to ignore list
++++
++++test-50.cs IGNORE
++++test-308.cs
++++test-322.cs
++++test-377.cs
++++test-anon-27.cs
++++test-anon-29.cs
++++test-xml-027.cs
+++ /dev/null
----// Compiler options: -t:module
----
----using System;
----
----public class M1 {
----
---- public string Foo;
----
---- public M1 (string foo) {
---- this.Foo = foo;
---- }
----}
----
+++ /dev/null
----// Compiler options: -t:module
----
----public class M2 {
----}
----
+++ /dev/null
----// Compiler options: -addmodule:module-1.netmodule -addmodule:module-2.netmodule
----
----using System;
----
----public class M3 : M1 {
----
---- public M3 () : base ("FOO") {
---- }
----
---- public static int Main () {
---- if (new M3 ().Foo != "FOO")
---- return 1;
---- /* Test that the EXPORTEDTYPES table is correctly set up */
---- if (typeof (M3).Assembly.GetTypes ().Length != 3)
---- return 2;
---- if (typeof (M3).Assembly.GetType ("M2") == null)
---- return 3;
---- if (typeof (M3).Assembly.GetType ("M2") != typeof (M2))
---- return 3;
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -t:library
----
----namespace Q {
---- public class A {
---- public static new string ToString() {
---- return "Hello world!";
---- }
---- }
----}
+++ /dev/null
----// Compiler options: -r:mtest-1-dll.dll
----
----using System;
----using Q;
----
----public class B {
---- public static int Main() {
---- return (A.ToString() == "Hello world!") ? 0 : 1;
---- }
----}
+++ /dev/null
----// Compiler options: -t:library
----
----namespace Qt
----{
---- public class QtSupport
---- {
---- protected static event MousePressEvent mousePressEvent;
----
---- protected delegate void MousePressEvent ();
---- }
----
----}
+++ /dev/null
----// Compiler options: -r:mtest-2-dll.dll
----
----namespace QtSamples
----{
---- using Qt;
----
---- public class QtClass: QtSupport
---- {
---- public QtClass()
---- {
---- mousePressEvent += new MousePressEvent( pressEvent );
---- }
----
---- public void pressEvent() { }
---- }
----
----
---- public class Testing
---- {
---- public static int Main()
---- {
---- QtClass q = new QtClass();
----
---- return 0;
---- }
---- }
----}
----
----
----
+++ /dev/null
----// Compiler options: -t:library
----
----using System;
----using System.Runtime.InteropServices;
----
----namespace Foo {
---- public class Bar {
---- public const CallingConvention CConv = CallingConvention.Cdecl;
---- }
----}
+++ /dev/null
----// Compiler options: -r:mtest-3-dll.dll
----
----using System;
----using System.Runtime.InteropServices;
----
----namespace Foo {
---- public class Baz {
---- [DllImport("foo.so", CallingConvention=Bar.CConv)]
---- public static extern void doFoo();
----
---- public static void Main ()
---- { }
---- }
----}
+++ /dev/null
----// Compiler options: -t:library
----
----namespace Foo {
----namespace Bar {
---- public class Baz {
---- public class Inner {
---- public static void Frob() { }
---- }
---- }
----}
----}
+++ /dev/null
----// Compiler options: -r:mtest-4-dll.dll
----
----using Inner = Foo.Bar.Baz.Inner;
----public class Driver {
---- public static void Main () {
---- Inner.Frob();
---- }
----}
+++ /dev/null
----// Compiler options: -t:library
----//
----// First file of a 2-test file to check for #69361
----//
----public class AA
----{
---- internal protected virtual string Data {
---- get { return null; }
---- }
----}
+++ /dev/null
----// Compiler options: -r:mtest-5-dll.dll
----public class BB : AA
----{
---- protected override string Data {
---- get { return null; }
---- }
---- public static void Main () {}
----}
+++ /dev/null
----// Compiler options: -t:library
----
----using System;
----public abstract class MyTestAbstract
----{
---- protected abstract string GetName();
----
---- public MyTestAbstract()
---- {
---- }
----
---- public void PrintName()
---- {
---- Console.WriteLine("Name=" + GetName());
---- }
----}
+++ /dev/null
----// Compiler options: -r:mtest-6-dll.dll
----
----using System;
----public class MyTestExtended : MyTestAbstract
----{
---- public MyTestExtended() : base()
---- {
---- }
----
---- protected override string GetName() { return "foo"; }
---- public static void Main(string[] args)
---- {
---- Console.WriteLine("Calling PrintName");
---- MyTestExtended test = new MyTestExtended();
---- test.PrintName();
---- Console.WriteLine("Out of PrintName");
---- }
----
----}
+++ /dev/null
----// Compiler options: -t:module
----
----namespace n1
----{
---- public class Adder
---- {
---- public int Add(int x, int y)
---- {
---- return x+y;
---- }
---- }
----}
+++ /dev/null
----// Compiler options: -addmodule:mtest-7-dll.netmodule
----
----using n1;
----using System;
----
----public class ModTest
----{
----
---- public static void Main(string[] args)
---- {
---- Adder a=new Adder();
---- Console.WriteLine(a.Add(2,3));
---- }
----
----}
+++ /dev/null
----// Compiler options: -t:library
----
----using System;
----
----namespace blah
----{
----
----public delegate void MyFunnyDelegate(object sender, params object[] message);
----
----}
+++ /dev/null
----// Compiler options: -r:mtest-8-dll.dll
----
----using System;
----using blah;
----
----namespace blah2
----{
----
----public class MyClass
----{
---- public event MyFunnyDelegate DoSomething;
----
---- public void DoSomethingFunny()
---- {
---- if (DoSomething != null) DoSomething(this, "hello there", "my friend");
---- }
----
---- public static void Main(string[] args)
---- {
---- MyClass mc = new MyClass();
---- mc.DoSomethingFunny();
----
---- }
----}
----
----}
+++ /dev/null
----namespace A {\r
---- class X {\r
---- void Y () {}\r
---- }\r
----}\r
----\r
----namespace A {\r
---- class XX : X {\r
---- void YY () {}\r
---- }\r
----}\r
+++ /dev/null
----using System.Collections;
----
----class X : Queue {
----}
+++ /dev/null
----// Compiler options: -t:library
----
----internal class Provider {
----}
+++ /dev/null
----// Compiler options: -t:library
----
----public class Provider {
---- public static void Main ()
---- {
---- }
----}
----
----public class Foo {
---- public static void Main ()
---- {
---- }
----}
+++ /dev/null
----// Compiler options: -r:pi.dll -r:pp.dll
----
----class Test {
---- static void Main () {
---- Provider p = new Provider ();
---- }
----}
+++ /dev/null
----// Compiler options: -r:pp.dll -r:pi.dll
----
----class Test {
---- static void Main () {
---- Provider p = new Provider ();
---- }
----}
+++ /dev/null
----struct A {\r
---- int x;\r
----}\r
----\r
----struct B : A {\r
---- int y;\r
----}\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class t {
++++
++++ void a ()
++++ {
++++ int b;
++++
++++ try {
++++ b = 1;
++++ } catch {
++++ b = 2;
++++ }
++++ }
++++
++++ void b ()
++++ {
++++ int a;
++++
++++ try {
++++ a = 1;
++++ } catch (Exception) {
++++ a = 2;
++++ }
++++ }
++++
++++ void c ()
++++ {
++++ int a;
++++
++++ try {
++++ a = 2;
++++ } catch (Exception e) {
++++ a = 0x3;
++++ } catch {
++++ a = 0x1;
++++ }
++++ }
++++
++++ void d ()
++++ {
++++ int a;
++++
++++ try {
++++ a = 2;
++++ } catch (Exception e) {
++++ a = 0x3;
++++ } catch {
++++ a = 0x1;
++++ } finally {
++++ a = 111;
++++ }
++++ }
++++
++++ public static void Main () {}
++++}
++++
class T {
---- static void Main ()
++++ static int ret_code = 0;
++++
++++ static int Main ()
{
try {
T t = null;
t.Foo ();
} catch {
---- System.Environment.Exit (0);
++++ return ret_code;
}
----
---- System.Environment.Exit (1);
++++ ret_code = 1;
++++ return ret_code;
}
void Foo () {
if (this == null) {
System.Console.WriteLine ("This isnt anything!?!?");
---- System.Environment.Exit (1);
++++ ret_code = 1;
}
}
}
using System.Diagnostics;
class TestClass {
++++ static int return_code = 1;
[Conditional("C1"), Conditional("C2")]
public static void ConditionalMethod()
{
Console.WriteLine ("Succeeded");
---- Environment.Exit (0);
++++ return_code = 0;
}
static int Main()
{
ConditionalMethod ();
---- return 1;
++++ return return_code;
}
}
+++ /dev/null
----// Compiler options: -t:library
----
----public class C
----{
---- public const decimal D = 4;
----}
+++ /dev/null
----// Compiler options: -r:test-319-dll.dll
----
----using System;
----using System.Runtime.CompilerServices;
----
----// TODO: clean up in Decimal.cs
----
----public class ConstFields
----{
---- public const decimal ConstDecimal1 = 314159265358979323846m;
---- public static readonly decimal ConstDecimal2 = -314159265358979323846m;
---- public const decimal ConstDecimal3 = -3;
---- public const decimal ConstDecimal4 = 0;
---- public const decimal MaxValue = 79228162514264337593543950335m;
----
---- // TODO: check this value
---- static readonly Decimal MaxValueDiv10 = MaxValue / 10;
----
---- static decimal DecimalValue = -90;
---- const decimal SmallConstValue = .02M;
----
---- static int Main ()
---- {
---- Type t = typeof (ConstFields);
---- DecimalConstantAttribute a = (DecimalConstantAttribute) t.GetField ("ConstDecimal3").GetCustomAttributes (typeof (DecimalConstantAttribute), false) [0];
---- if (a.Value != ConstDecimal3)
---- return 1;
----
---- a = (DecimalConstantAttribute) t.GetField ("ConstDecimal1").GetCustomAttributes (typeof (DecimalConstantAttribute), false) [0];
---- if (a.Value != 314159265358979323846m)
---- return 2;
----
---- if (ConstDecimal1 != (-1) * ConstDecimal2)
---- return 3;
----
---- if (!(SmallConstValue < 1 && SmallConstValue > 0))
---- return 4;
----
---- // THIS IS TEST TOO
---- Console.WriteLine (C.D);
---- Console.WriteLine (Decimal.One);
---- Console.WriteLine (DecimalValue);
---- Console.WriteLine (Decimal.MaxValue);
----
---- Console.WriteLine ("Success");
---- return 0;
---- }
----}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library\r
++++
++++public class C
++++{
++++ public const decimal D = 4;
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-319-lib.dll
++++
++++using System;
++++using System.Runtime.CompilerServices;
++++
++++// TODO: clean up in Decimal.cs
++++
++++public class ConstFields
++++{
++++ public const decimal ConstDecimal1 = 314159265358979323846m;
++++ public static readonly decimal ConstDecimal2 = -314159265358979323846m;
++++ public const decimal ConstDecimal3 = -3;
++++ public const decimal ConstDecimal4 = 0;
++++ public const decimal MaxValue = 79228162514264337593543950335m;
++++
++++ // TODO: check this value
++++ static readonly Decimal MaxValueDiv10 = MaxValue / 10;
++++
++++ static decimal DecimalValue = -90;
++++ const decimal SmallConstValue = .02M;
++++
++++ static int Main ()
++++ {
++++ Type t = typeof (ConstFields);
++++ DecimalConstantAttribute a = (DecimalConstantAttribute) t.GetField ("ConstDecimal3").GetCustomAttributes (typeof (DecimalConstantAttribute), false) [0];
++++ if (a.Value != ConstDecimal3)
++++ return 1;
++++
++++ a = (DecimalConstantAttribute) t.GetField ("ConstDecimal1").GetCustomAttributes (typeof (DecimalConstantAttribute), false) [0];
++++ if (a.Value != 314159265358979323846m)
++++ return 2;
++++
++++ if (ConstDecimal1 != (-1) * ConstDecimal2)
++++ return 3;
++++
++++ if (!(SmallConstValue < 1 && SmallConstValue > 0))
++++ return 4;
++++
++++ // THIS IS TEST TOO
++++ Console.WriteLine (C.D);
++++ Console.WriteLine (Decimal.One);
++++ Console.WriteLine (DecimalValue);
++++ Console.WriteLine (Decimal.MaxValue);
++++
++++ Console.WriteLine ("Success");
++++ return 0;
++++ }
++++}
----// Compiler options: -t:library
/* foo */
#define FOO
/* bar */ // bar again
#define BAR
++++
++++public class C
++++{
++++ public static void Main () {}
++++}
+++ /dev/null
----using System;
----
----public class Three {
---- public static void Main ()
---- {
---- One o = new One ();
---- }
----}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class Three {
++++ public static void Main ()
++++ {
++++ One o = new One ();
++++ }
++++}
----// Compiler options: test-353-2.cs
++++// Compiler options: test-353-p2.cs /out:test-353.exe
using System;
+++ /dev/null
----// Subordinate test file for test-361.cs
----
----using System;
----[AttributeUsage (AttributeTargets.Class)]
----class X : Attribute { }
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Subordinate test file for test-361.cs
++++
++++using System;
++++[AttributeUsage (AttributeTargets.Class)]
++++class X : Attribute { }
----// Compiler options: test-361-2.cs
++++// Compiler options: test-361-p2.cs /out:test-361.exe
[X]
class Test {
----// Compiler options: -t:library -unsafe
++++// Compiler options: -unsafe
public unsafe struct Foo
{
public Foo *foo;
}
----
++++\r
++++public class C\r
++++{\r
++++ public static void Main () {}\r
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// This is used to debug an ordering dependent bug. The counterpart is test-388.cs.
++++//
++++
++++using System;
++++using System.Collections;
++++using System.Reflection;
++++
++++namespace Schemas
++++{
++++ public partial class basefieldtype
++++ {
++++ public virtual object Instantiate () { return null; }
++++ }
++++
++++ public partial class fieldtype
++++ {
++++ public override object Instantiate ()
++++ {
++++ Console.WriteLine ("Instantiating type '{0}'", id);
++++ return null;
++++ }
++++ }
++++
++++ public partial class compoundfield
++++ {
++++ public override object Instantiate ()
++++ {
++++ Console.WriteLine ("Instantiating compound field '{0}'", id);
++++ return null;
++++ }
++++ }
++++
++++ public partial class field
++++ {
++++ public object Instantiate ()
++++ {
++++ Console.WriteLine ("Instantiating field '{0}'", id);
++++ return null;
++++ }
++++ }
++++
++++ public partial class formdata
++++ {
++++ public object Instantiate ()
++++ {
++++ Console.WriteLine ("Instantiating form window");
++++ return null;
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
- - // This is used to debug an ordering dependent bug. The counterpart is test-389.cs.
++++// This is used to debug an ordering dependent bug.
+ +//
- - // Compiler options: -t:library test-389.cs
++++// Compiler options: test-388-p2.cs /out:test-388.exe
+ +
+ +namespace Schemas {
+ + [System.Xml.Serialization.XmlType("base-field-type"),
+ + System.Xml.Serialization.XmlInclude(typeof(compoundfield)),
+ + System.Xml.Serialization.XmlInclude(typeof(fieldtype))]
+ + public partial class basefieldtype {
+ +
+ + [System.Xml.Serialization.XmlAttribute(DataType="ID")]
+ + public string id;
+ +
+ + [System.Xml.Serialization.XmlAttribute()]
+ + public string datatype;
+ + }
+ +
+ + [System.Xml.Serialization.XmlType("field-type")]
+ + public partial class fieldtype: basefieldtype {}
+ +
+ + [System.Xml.Serialization.XmlType("compound-field")]
+ + public partial class compoundfield: basefieldtype {}
+ +
+ + public partial class field {
+ +
+ + [System.Xml.Serialization.XmlAttribute()]
+ + public string id;
+ +
+ + [System.Xml.Serialization.XmlAttribute()]
+ + public string type;
+ + }
+ +
+ + [System.Xml.Serialization.XmlType("form-data")]
+ + public partial class formdata {
+ +
+ + [System.Xml.Serialization.XmlArray(ElementName="form-fields"),
+ + System.Xml.Serialization.XmlArrayItem(Type=typeof(field),IsNullable=false)]
+ + public field[] formfields;
+ +
+ + [System.Xml.Serialization.XmlElement("field-type",Type=typeof(fieldtype)),
+ + System.Xml.Serialization.XmlElement("compound-field",Type=typeof(compoundfield))]
+ + public basefieldtype[] Items;
++++ }\r
++++ \r
++++ public class M {\r
++++ public static void Main () {}\r
+ + }
+ +}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// This is used to debug an ordering dependent bug.
++++//
++++
++++namespace Schemas {
++++ [System.Xml.Serialization.XmlType("base-field-type"),
++++ System.Xml.Serialization.XmlInclude(typeof(compoundfield)),
++++ System.Xml.Serialization.XmlInclude(typeof(fieldtype))]
++++ public partial class basefieldtype {
++++
++++ [System.Xml.Serialization.XmlAttribute(DataType="ID")]
++++ public string id;
++++
++++ [System.Xml.Serialization.XmlAttribute()]
++++ public string datatype;
++++ }
++++
++++ [System.Xml.Serialization.XmlType("field-type")]
++++ public partial class fieldtype: basefieldtype {}
++++
++++ [System.Xml.Serialization.XmlType("compound-field")]
++++ public partial class compoundfield: basefieldtype {}
++++
++++ public partial class field {
++++
++++ [System.Xml.Serialization.XmlAttribute()]
++++ public string id;
++++
++++ [System.Xml.Serialization.XmlAttribute()]
++++ public string type;
++++ }
++++
++++ [System.Xml.Serialization.XmlType("form-data")]
++++ public partial class formdata {
++++
++++ [System.Xml.Serialization.XmlArray(ElementName="form-fields"),
++++ System.Xml.Serialization.XmlArrayItem(Type=typeof(field),IsNullable=false)]
++++ public field[] formfields;
++++
++++ [System.Xml.Serialization.XmlElement("field-type",Type=typeof(fieldtype)),
++++ System.Xml.Serialization.XmlElement("compound-field",Type=typeof(compoundfield))]
++++ public basefieldtype[] Items;
++++ }\r
++++}
--- /dev/null
--- /dev/null
- - // This is used to debug an ordering dependent bug. The counterpart is test-388.cs.
++++// This is used to debug an ordering dependent bug.
+ +//
- - // Compiler options: -t:library test-388.cs
++++// Compiler options: test-389-p2.cs /out:test-389.exe
+ +
+ +using System;
+ +using System.Collections;
+ +using System.Reflection;
+ +
+ +namespace Schemas
+ +{
+ + public partial class basefieldtype
+ + {
+ + public virtual object Instantiate () { return null; }
+ + }
+ +
+ + public partial class fieldtype
+ + {
+ + public override object Instantiate ()
+ + {
+ + Console.WriteLine ("Instantiating type '{0}'", id);
+ + return null;
+ + }
+ + }
+ +
+ + public partial class compoundfield
+ + {
+ + public override object Instantiate ()
+ + {
+ + Console.WriteLine ("Instantiating compound field '{0}'", id);
+ + return null;
+ + }
+ + }
+ +
+ + public partial class field
+ + {
+ + public object Instantiate ()
+ + {
+ + Console.WriteLine ("Instantiating field '{0}'", id);
+ + return null;
+ + }
+ + }
+ +
+ + public partial class formdata
+ + {
+ + public object Instantiate ()
+ + {
+ + Console.WriteLine ("Instantiating form window");
+ + return null;
+ + }
++++ }\r
++++ \r
++++ public class M {\r
++++ public static void Main () {}\r
+ + }
+ +}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++// Test for covariance support in delegates
++++//
++++
++++using System;
++++
++++ public class A {
++++ protected string name;
++++
++++ public A (string name)
++++ {
++++ this.name = "A::" + name;
++++ }
++++
++++ public A ()
++++ {
++++ }
++++
++++ public string Name {
++++ get {
++++ return name;
++++ }
++++ }
++++ }
++++
++++ public class B : A {
++++ public B (string name)
++++ {
++++ this.name = "B::" + name;
++++ }
++++
++++ public B ()
++++ {
++++ }
++++ }
++++
++++ public class C : B {
++++ public C (string name)
++++ {
++++ this.name = "C::" + name;
++++ }
++++ }
++++
++++ public class Tester {
++++
++++ delegate A MethodHandler (string name);
++++
++++ static A MethodSampleA (string name)
++++ {
++++ return new A (name);
++++ }
++++
++++ static B MethodSampleB (string name)
++++ {
++++ return new B (name);
++++ }
++++
++++ static C MethodSampleC (string name)
++++ {
++++ return new C (name);
++++ }
++++
++++ static void Main ()
++++ {
++++ MethodHandler a = MethodSampleA;
++++ MethodHandler b = MethodSampleB;
++++ MethodHandler c = MethodSampleC;
++++
++++ A instance1 = a ("Hello");
++++ A instance2 = b ("World");
++++ A instance3 = c ("!");
++++
++++ Console.WriteLine (instance1.Name);
++++ Console.WriteLine (instance2.Name);
++++ Console.WriteLine (instance3.Name);
++++ }
++++
++++ }
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++//
++++// Test for contravariance support in delegates
++++//
++++
++++using System;
++++
++++ public class A {
++++ protected string name;
++++
++++ public A (string name)
++++ {
++++ this.name = "A::" + name;
++++ }
++++
++++ public A ()
++++ {
++++ }
++++
++++ public string Name {
++++ get {
++++ return name;
++++ }
++++ }
++++ }
++++
++++ public class B : A {
++++ public B (string name)
++++ {
++++ this.name = "B::" + name;
++++ }
++++
++++ public B ()
++++ {
++++ }
++++ }
++++
++++ public class C : B {
++++ string value;
++++
++++ public C (string name, string value)
++++ {
++++ this.name = "C::" + name;
++++ this.value = value;
++++ }
++++
++++ public string Value {
++++ get {
++++ return value;
++++ }
++++ }
++++ }
++++
++++ public class Tester {
++++
++++ delegate string MethodHandler (C c);
++++
++++ static string MethodSampleA (A value)
++++ {
++++ return value.Name;
++++ }
++++
++++ static string MethodSampleB (B value)
++++ {
++++ return value.Name;
++++ }
++++
++++ static string MethodSampleC (C value)
++++ {
++++ return value.Name + " " + value.Value;
++++ }
++++
++++ static void Main ()
++++ {
++++ MethodHandler da = MethodSampleA;
++++ MethodHandler db = MethodSampleB;
++++ MethodHandler dc = MethodSampleC;
++++
++++ C a = new C ("Hello", "hello");
++++ C b = new C ("World", "world");
++++ C c = new C ("!", "!!!");
++++
++++ Console.WriteLine (da (a));
++++ Console.WriteLine (db (b));
++++ Console.WriteLine (dc (c));
++++ }
++++
++++ }
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++//
++++// Test for contravariance support in delegates
++++//
++++
++++using System;
++++
++++ public class A {
++++ protected string name;
++++
++++ public A (string name)
++++ {
++++ this.name = "A::" + name;
++++ }
++++
++++ public A ()
++++ {
++++ }
++++
++++ public string Name {
++++ get {
++++ return name;
++++ }
++++ }
++++ }
++++
++++ public class B : A {
++++ public B (string name)
++++ {
++++ this.name = "B::" + name;
++++ }
++++
++++ public B ()
++++ {
++++ }
++++ }
++++
++++ public class C : B {
++++ string value;
++++
++++ public C (string name, string value)
++++ {
++++ this.name = "C::" + name;
++++ this.value = value;
++++ }
++++
++++ public string Value {
++++ get {
++++ return value;
++++ }
++++ }
++++ }
++++
++++ public class Tester {
++++
++++ delegate void MethodHandler (C c1, C c2, C c3);
++++
++++ static void MethodSample (B b, A a, C c)
++++ {
++++ Console.WriteLine ("b = {0}", b.Name);
++++ Console.WriteLine ("a = {0}", a.Name);
++++ Console.WriteLine ("c = {0}, {1}", c.Name, c.Value);
++++ }
++++
++++ static void Main ()
++++ {
++++ MethodHandler mh = MethodSample;
++++
++++ C a = new C ("Hello", "hello");
++++ C b = new C ("World", "world");
++++ C c = new C ("!", "!!!");
++++
++++ mh (b, a, c);
++++ }
++++
++++ }
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++public class A
++++{
++++ public static bool operator==(A a1, A a2)
++++ {
++++ return true;
++++ }
++++
++++ public static bool operator!=(A a1, A a2)
++++ {
++++ return false;
++++ }
++++
++++ public override bool Equals (object o)
++++ {
++++ return true;
++++ }
++++
++++ public override int GetHashCode ()
++++ {
++++ return base.GetHashCode ();
++++ }
++++
++++ public int KK () { return 1; }
++++}
++++
++++public class B : A {
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-396-lib.dll
++++
++++public class MainClass
++++{
++++ public static int Main ()
++++ {
++++ A a = new A ();
++++ B b = new B ();
++++ bool r = (a == b);
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Access modifiers
++++// We use reflection to test that the flags are the correct ones
++++//
++++
++++using System;
++++using System.Reflection;
++++
++++ [AttributeUsage (AttributeTargets.Class)]
++++ public class TypeCheckAttribute : Attribute {
++++
++++ public TypeCheckAttribute ()
++++ {
++++ }
++++ }
++++
++++ [AttributeUsage (AttributeTargets.Property)]
++++ public class PropertyCheckAttribute : Attribute {
++++
++++ public PropertyCheckAttribute ()
++++ {
++++ }
++++ }
++++
++++ [AttributeUsage (AttributeTargets.Method)]
++++ public class AccessorCheckAttribute : Attribute {
++++ MethodAttributes flags;
++++
++++ public AccessorCheckAttribute (MethodAttributes flags)
++++ {
++++ this.flags = flags;
++++ }
++++
++++ public MethodAttributes Attributes {
++++ get {
++++ return flags;
++++ }
++++ }
++++ }
++++
++++ public class Test {
++++
++++ public static int Main (string [] args)
++++ {
++++ Type t = typeof (A);
++++
++++ foreach (PropertyInfo pi in t.GetProperties ()) {
++++ object [] attrs = pi.GetCustomAttributes (typeof (PropertyCheckAttribute), true);
++++ if (attrs == null)
++++ return 0;
++++
++++ MethodInfo get_accessor, set_accessor;
++++ get_accessor = pi.GetGetMethod (true);
++++ set_accessor = pi.GetSetMethod (true);
++++
++++ if (get_accessor != null)
++++ CheckFlags (pi, get_accessor);
++++ if (set_accessor != null)
++++ CheckFlags (pi, set_accessor);
++++ }
++++
++++ return 0;
++++ }
++++
++++ static void CheckFlags (PropertyInfo pi, MethodInfo accessor)
++++ {
++++ object [] attrs = accessor.GetCustomAttributes (typeof (AccessorCheckAttribute), true);
++++ if (attrs == null)
++++ return;
++++
++++ AccessorCheckAttribute accessor_attr = (AccessorCheckAttribute) attrs [0];
++++ MethodAttributes accessor_flags = accessor.Attributes;
++++
++++ if ((accessor_flags & accessor_attr.Attributes) == accessor_attr.Attributes)
++++ Console.WriteLine ("Test for {0}.{1} PASSED", pi.Name, accessor.Name);
++++ else {
++++ string message = String.Format ("Test for {0}.{1} INCORRECT: MethodAttributes should be {2}, but are {3}",
++++ pi.Name, accessor.Name, accessor_attr.Attributes, accessor_flags);
++++ throw new Exception (message);
++++ }
++++ }
++++
++++ }
++++
++++ [TypeCheck]
++++ public class A {
++++
++++ const MethodAttributes flags = MethodAttributes.HideBySig |
++++ MethodAttributes.SpecialName;
++++
++++ [PropertyCheck]
++++ public int Value1 {
++++ [AccessorCheck (flags | MethodAttributes.Public)]
++++ get {
++++ return 0;
++++ }
++++ [AccessorCheck (flags | MethodAttributes.Public)]
++++ set {
++++ }
++++ }
++++
++++ [PropertyCheck]
++++ public int Value2 {
++++ [AccessorCheck (flags | MethodAttributes.Public)]
++++ get {
++++ return 0;
++++ }
++++ [AccessorCheck (flags | MethodAttributes.FamORAssem)]
++++ protected internal set {
++++ }
++++ }
++++
++++ [PropertyCheck]
++++ public int Value3 {
++++ [AccessorCheck (flags | MethodAttributes.Public)]
++++ get {
++++ return 0;
++++ }
++++ [AccessorCheck (flags | MethodAttributes.Family)]
++++ protected set {
++++ }
++++ }
++++
++++ [PropertyCheck]
++++ public int Value4 {
++++ [AccessorCheck (flags | MethodAttributes.Assembly)]
++++ internal get {
++++ return 0;
++++ }
++++ [AccessorCheck (flags | MethodAttributes.Public)]
++++ set {
++++ }
++++ }
++++
++++ [PropertyCheck]
++++ public int Value5 {
++++ [AccessorCheck (flags | MethodAttributes.Public)]
++++ get {
++++ return 0;
++++ }
++++ [AccessorCheck (flags | MethodAttributes.Private)]
++++ private set {
++++ }
++++ }
++++
++++ }
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Test for access modifiers
++++//
++++
++++using System;
++++
++++ public class Tester {
++++
++++ static void Main ()
++++ {
++++ A a = new A (8);
++++ B b = new B (9);
++++
++++ b.SetCount (10);
++++ Console.WriteLine ("b.Count should be 9: {0}", b.Count);
++++ Console.WriteLine ("b [{0}] should return {0}: {1}", 10, b [10]);
++++
++++ Console.WriteLine ("a.Message : {0}", a.Message);
++++ b.Message = "";
++++ Console.WriteLine ("b.Messasge : {0}", b.Message);
++++ }
++++
++++ }
++++
++++ public class A {
++++
++++ protected int count;
++++
++++ public A (int count)
++++ {
++++ this.count = count;
++++ }
++++
++++ public virtual int Count {
++++ get {
++++ return count;
++++ }
++++ protected set {
++++ count = value;
++++ }
++++ }
++++
++++ public virtual int this [int index] {
++++ get {
++++ return index;
++++ }
++++ }
++++
++++ public virtual string Message {
++++ get {
++++ return "Hello Mono";
++++ }
++++ }
++++
++++ }
++++
++++ public class B : A {
++++
++++ public B (int count) : base (count)
++++ {
++++ }
++++
++++ public override int Count {
++++ protected set {
++++ }
++++ }
++++
++++ public void SetCount (int value)
++++ {
++++ Count = value;
++++ }
++++
++++ public override int this [int index] {
++++ get {
++++ return base [index];
++++ }
++++ }
++++
++++ public new string Message {
++++ get {
++++ return "Hello Mono (2)";
++++ }
++++ internal set {
++++ }
++++ }
++++
++++ }
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library\r
++++
++++using System;
++++
++++public struct Result {
++++ public int res;
++++ // big enough that it won't be returned in registers
++++ double duh;
++++ long bah;
++++
++++ public Result (int val) {
++++ res = val;
++++ bah = val;
++++ duh = val;
++++ }
++++}
++++
++++public class Vararg
++++{
++++ public static int AddABunchOfInts (__arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return result;
++++ }
++++
++++ public static int AddASecondBunchOfInts (int a, __arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return result;
++++ }
++++
++++ public static Result VtAddABunchOfInts (__arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return new Result (result);
++++ }
++++
++++ public static Result VtAddASecondBunchOfInts (int a, __arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return new Result (result);
++++ }
++++
++++ public int InstAddABunchOfInts (__arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return result;
++++ }
++++
++++ public int InstAddASecondBunchOfInts (int a, __arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return result;
++++ }
++++
++++ public Result InstVtAddABunchOfInts (__arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return new Result (result);
++++ }
++++
++++ public Result InstVtAddASecondBunchOfInts (int a, __arglist)
++++ {
++++ int result = 0;
++++
++++ System.ArgIterator iter = new System.ArgIterator (__arglist);
++++ int argCount = iter.GetRemainingCount();
++++
++++ for (int i = 0; i < argCount; i++) {
++++ System.TypedReference typedRef = iter.GetNextArg();
++++ result += (int)TypedReference.ToObject( typedRef );
++++ }
++++
++++ return new Result (result);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-399-lib.dll
++++
++++using System;
++++
++++class TestVararg
++++{
++++ static int Main ()
++++ {
++++ int result = Vararg.AddABunchOfInts (__arglist ( 2, 3, 4 ));
++++ Console.WriteLine ("Answer: {0}", result);
++++
++++ if (result != 9)
++++ return 1;
++++
++++ result = Vararg.AddASecondBunchOfInts (16, __arglist ( 2, 3, 4 ));
++++ Console.WriteLine ("Answer: {0}", result);
++++
++++ if (result != 9)
++++ return 2;
++++
++++ Vararg s = new Vararg ();
++++
++++ result = s.InstAddABunchOfInts (__arglist ( 2, 3, 4, 5 ));
++++ Console.WriteLine ("Answer: {0}", result);
++++
++++ if (result != 14)
++++ return 3;
++++
++++ result = s.InstAddASecondBunchOfInts (16, __arglist ( 2, 3, 4, 5, 6 ));
++++ Console.WriteLine ("Answer: {0}", result);
++++
++++ if (result != 20)
++++ return 4;
++++
++++ result = s.InstVtAddABunchOfInts (__arglist ( 2, 3, 4, 5 )).res;
++++ Console.WriteLine ("Answer: {0}", result);
++++
++++ if (result != 14)
++++ return 5;
++++
++++ result = s.InstVtAddASecondBunchOfInts (16, __arglist ( 2, 3, 4, 5, 6 )).res;
++++ Console.WriteLine ("Answer: {0}", result);
++++
++++ if (result != 20)
++++ return 6;
++++
++++ result = Vararg.VtAddABunchOfInts (__arglist ( 2, 3, 4, 5, 1 )).res;
++++ Console.WriteLine ("Answer: {0}", result);
++++
++++ if (result != 15)
++++ return 7;
++++
++++ result = Vararg.VtAddASecondBunchOfInts (16, __arglist ( 2, 3, 4, 5, 6, 1 )).res;
++++ Console.WriteLine ("Answer: {0}", result);
++++
++++ if (result != 21)
++++ return 8;
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++
++++//
++++// Tests unsafe operators. address-of, dereference, member access
++++//
++++using System;
++++
++++unsafe struct Y {
++++ public int a;
++++ public int s;
++++}
++++
++++unsafe class X {
++++ static int TestDereference ()
++++ {
++++ Y y;
++++ Y *z;
++++ Y a;
++++
++++ z = &y;
++++ y.a = 1;
++++ y.s = 2;
++++
++++ a.a = z->a;
++++ a.s = z->s;
++++
++++ if (a.a != y.a)
++++ return 1;
++++ if (a.s != y.s)
++++ return 2;
++++
++++ return 0;
++++ }
++++
++++ static int TestPtrAdd ()
++++ {
++++ int [] a = new int [10];
++++ int i;
++++
++++ for (i = 0; i < 10; i++)
++++ a [i] = i;
++++
++++ i = 0;
++++ fixed (int *b = &a [0]){
++++ int *p = b;
++++
++++ for (i = 0; i < 10; i++){
++++ if (*p != a [i])
++++ return 10+i;
++++ p++;
++++ }
++++ }
++++ return 0;
++++ }
++++
++++ static int i = 1;
++++ static char c = 'a';
++++ static long l = 123;
++++ static double d = 1.2;
++++ static float f = 1.3F;
++++ static short s = 4;
++++
++++ static int TestPtrAssign ()
++++ {
++++
++++ fixed (int *ii = &i){
++++ *ii = 10;
++++ }
++++
++++ fixed (char *cc = &c){
++++ *cc = 'b';
++++ }
++++
++++ fixed (long *ll = &l){
++++ *ll = 100;
++++ }
++++
++++ fixed (double *dd = &d){
++++ *dd = 3.0;
++++ }
++++
++++ fixed (float *ff = &f){
++++ *ff = 1.2F;
++++ }
++++
++++ fixed (short *ss = &s){
++++ *ss = 102;
++++ }
++++
++++ if (i != 10)
++++ return 100;
++++ if (c != 'b')
++++ return 101;
++++ if (l != 100)
++++ return 102;
++++ if (d != 3.0)
++++ return 103;
++++ if (f != 1.2F)
++++ return 104;
++++ if (s != 102)
++++ return 105;
++++ return 0;
++++ }
++++
++++ static int TestPtrArithmetic ()
++++ {
++++ char [] array = new char [10];
++++ char *pb;
++++
++++ array [5] = 'j';
++++ fixed (char *pa = array){
++++ pb = pa + 1;
++++
++++
++++ //
++++ // This one tests pointer element access
++++ //
++++ if (pa [5] != 'j')
++++ return 199;
++++
++++ Console.WriteLine ("V: " + (pb - pa));
++++ if ((pb - pa) != 1)
++++ return 200;
++++
++++ pb++;
++++
++++ if (pb == pa)
++++ return 201;
++++ if (pb < pa)
++++ return 202;
++++ if (pa > pb)
++++ return 203;
++++ if (pa >= pb)
++++ return 204;
++++ if (pb <= pa)
++++ return 205;
++++ pb = pb - 2;
++++ if (pb != pa){
++++ Console.WriteLine ("VV: " + (pb - pa));
++++ return 206;
++++ }
++++ }
++++
++++ return 0;
++++ }
++++
++++ static int TestMultiple ()
++++ {
++++ char [] array = new char [10];
++++ int count = 0;
++++
++++ fixed (char *pa = array, pb = array){
++++ count++;
++++ }
++++ if (count != 1)
++++ return 300;
++++ return 0;
++++ }
++++
++++ static int Main ()
++++ {
++++ int v;
++++
++++ if ((v = TestDereference ()) != 0)
++++ return v;
++++
++++ if ((v = TestPtrAdd ()) != 0)
++++ return v;
++++
++++ if ((v = TestPtrAssign ()) != 0)
++++ return v;
++++
++++ if ((v = TestPtrArithmetic ()) != 0)
++++ return v;
++++
++++ if ((v = TestMultiple ()) != 0)
++++ return v;
++++
++++ Console.WriteLine ("Ok");
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++
++++//
++++// This test excercises stackalloc, some pointer arithmetic,
++++// and dereferences
++++//
++++using System;
++++unsafe class X {
++++ static int Main ()
++++ {
++++ char *ptr = stackalloc char [10];
++++ char *cptr = ptr;
++++ int i;
++++ long l = 0;
++++ ulong ul = 0;
++++ byte b = 0;
++++
++++ for (i = 0; i < 10; i++)
++++ ptr [i] = (char) (i + 10);
++++
++++ for (i = 0; i < 10; i++){
++++ if (*ptr != (char) (i + 10))
++++ return 200 + i;
++++ ptr++;
++++ }
++++
++++
++++ // Now test index access with longs
++++ if (cptr [l] != 10){
++++ return 1;
++++ }
++++ if (cptr [ul] != 10)
++++ return 2;
++++ if (cptr [b] != 10)
++++ return 3;
++++
++++ //
++++ // Try to compile non-int values
++++ //
++++ byte* bptr = (byte*) 5;
++++ ushort us = 3;
++++ byte* ret = (byte*) (bptr + us);
++++
++++ Console.WriteLine ("Ok");
++++ return 0;
++++ }
++++}
++++
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++
++++using System;
++++
++++unsafe class X {
++++ static int Main () {
++++ int y = 20;
++++ byte* x = (byte*)0;
++++ x += (long)y;
++++ // x == 20;
++++ return (int)x - 20 * sizeof (byte);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++
++++// this tests making a pointer to a pointer
++++
++++using System;
++++
++++unsafe class Foo
++++{
++++ public static int Main ()
++++ {
++++ int a;
++++ int *b;
++++ int **c;
++++
++++ a = 42;
++++ b = &a;
++++ c = &b;
++++
++++ Console.WriteLine ("*c == b : {0}", *c == b);
++++ Console.WriteLine ("**c == a : {0}", **c == a);
++++
++++ if (*c == b && **c == a)
++++ {
++++ Console.WriteLine ("Test passed");
++++ return 0;
++++ }
++++ else
++++ {
++++ Console.WriteLine ("Test failed");
++++ return 1;
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++
++++unsafe class X {
++++ static int v;
++++ static int v_calls;
++++
++++ static int* get_v ()
++++ {
++++ v_calls++;
++++ fixed (int* ptr = &v)
++++ {
++++ return ptr;
++++ }
++++ }
++++
++++ static int Main ()
++++ {
++++ if ((*get_v ())++ != 0)
++++ return 1;
++++ if (v != 1)
++++ return 2;
++++ if (v_calls != 1)
++++ return 3;
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++
++++using System;
++++
++++namespace testapp{
++++ public unsafe class LibTestAPI{
++++
++++ struct LibTestStruct{
++++ void* pData;
++++ void* pTest1;
++++ }
++++
++++ LibTestStruct* the_struct;
++++
++++ public void Create(){
++++ IntPtr MyPtr = new IntPtr(0); // Usually created elsewhere
++++ the_struct = (LibTestStruct *) 0; // error CS1002
++++ }
++++ }
++++
++++ class TestApp{
++++ static void Main(string[] args){
++++ LibTestAPI myapi = new LibTestAPI();
++++ myapi.Create();
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++
++++//
++++// This tests excercises the compound assignment when the left side
++++// is an dereference operator.
++++//
++++using System;
++++namespace TestCase {
++++ public unsafe class Test {
++++ static int Main(string[] args) {
++++ uint[] uArr = {0, 200};
++++ uint[] uArr2 = {0, 200};
++++
++++ fixed (uint* u = uArr, u2 = uArr2) {
++++ if (DoOp (u) != 100)
++++ return 1;
++++
++++ if (uArr [0] != 100)
++++ return 2;
++++
++++ if (uArr [1] != 200)
++++ return 3;
++++
++++ if (DoOp2 (u2) != 100)
++++ return 4;
++++
++++ if (uArr2 [0] != 100)
++++ return 5;
++++
++++ if (uArr2 [1] != 200)
++++ return 6;
++++ }
++++
++++ return 0;
++++ }
++++
++++ private static uint DoOp (uint *u) {
++++ return *(u) += 100;
++++ }
++++
++++ private static uint DoOp2 (uint *u) {
++++ *(u) += 100;
++++ return *u;
++++ }
++++
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++
++++struct Obsolete {
++++ int a;
++++}
++++struct A {
++++ int a, b;
++++}
++++
++++class MainClass {
++++ unsafe public static void Main ()
++++ {
++++ System.Console.WriteLine (sizeof (Obsolete));
++++ }
++++}
++++
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++
++++unsafe class T {
++++ static int Main () {
++++ int len = 10;
++++ int* x = stackalloc int [len];
++++ return x [0];
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++
++++//
++++// Test for http://bugzilla.ximian.com/show_bug.cgi?id=62263
++++//
++++// We need to make sure that pointer arth uses the size of X
++++// not the size of X*
++++//
++++
++++using System;
++++unsafe struct X {
++++ int x, y, z;
++++
++++ static int Main ()
++++ {
++++ X* foo = null;
++++
++++ if ((int) (foo + 1) != sizeof (X))
++++ return 1;
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++namespace Q {
++++ public class A {
++++ public static new string ToString() {
++++ return "Hello world!";
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-410-lib.dll
++++
++++using System;
++++using Q;
++++
++++public class B {
++++ public static int Main() {
++++ return (A.ToString() == "Hello world!") ? 0 : 1;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++namespace Qt
++++{
++++ public class QtSupport
++++ {
++++ protected static event MousePressEvent mousePressEvent;
++++
++++ protected delegate void MousePressEvent ();
++++ }
++++
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-411-lib.dll
++++
++++namespace QtSamples
++++{
++++ using Qt;
++++
++++ public class QtClass: QtSupport
++++ {
++++ public QtClass()
++++ {
++++ mousePressEvent += new MousePressEvent( pressEvent );
++++ }
++++
++++ public void pressEvent() { }
++++ }
++++
++++
++++ public class Testing
++++ {
++++ public static int Main()
++++ {
++++ QtClass q = new QtClass();
++++
++++ return 0;
++++ }
++++ }
++++}
++++
++++
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++using System;
++++using System.Runtime.InteropServices;
++++
++++namespace Foo {
++++ public class Bar {
++++ public const CallingConvention CConv = CallingConvention.Cdecl;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-412-lib.dll
++++
++++using System;
++++using System.Runtime.InteropServices;
++++
++++namespace Foo {
++++ public class Baz {
++++ [DllImport("foo.so", CallingConvention=Bar.CConv)]
++++ public static extern void doFoo();
++++
++++ public static void Main ()
++++ { }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++namespace Foo {
++++namespace Bar {
++++ public class Baz {
++++ public class Inner {
++++ public static void Frob() { }
++++ }
++++ }
++++}
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-413-lib.dll
++++
++++using Inner = Foo.Bar.Baz.Inner;
++++public class Driver {
++++ public static void Main () {
++++ Inner.Frob();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++//
++++// First file of a 2-test file to check for #69361
++++//
++++public class AA
++++{
++++ internal protected virtual string Data {
++++ get { return null; }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-414-lib.dll
++++public class BB : AA
++++{
++++ protected override string Data {
++++ get { return null; }
++++ }
++++ public static void Main () {}
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++using System;
++++public abstract class MyTestAbstract
++++{
++++ protected abstract string GetName();
++++
++++ public MyTestAbstract()
++++ {
++++ }
++++
++++ public void PrintName()
++++ {
++++ Console.WriteLine("Name=" + GetName());
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-415-lib.dll
++++
++++using System;
++++public class MyTestExtended : MyTestAbstract
++++{
++++ public MyTestExtended() : base()
++++ {
++++ }
++++
++++ protected override string GetName() { return "foo"; }
++++ public static void Main(string[] args)
++++ {
++++ Console.WriteLine("Calling PrintName");
++++ MyTestExtended test = new MyTestExtended();
++++ test.PrintName();
++++ Console.WriteLine("Out of PrintName");
++++ }
++++
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:module\r
++++\r
++++namespace n1\r
++++{\r
++++ public class Adder\r
++++ {\r
++++ public int Add(int x, int y)\r
++++ {\r
++++ return x+y;\r
++++ }\r
++++ }\r
++++}\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -addmodule:test-416-mod.netmodule
++++
++++using n1;
++++using System;
++++
++++public class ModTest
++++{
++++
++++ public static void Main(string[] args)
++++ {
++++ Adder a=new Adder();
++++ Console.WriteLine(a.Add(2,3));
++++ }
++++
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++using System;
++++
++++namespace blah
++++{
++++
++++public delegate void MyFunnyDelegate(object sender, params object[] message);
++++
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-417-lib.dll
++++
++++using System;
++++using blah;
++++
++++namespace blah2
++++{
++++
++++public class MyClass
++++{
++++ public event MyFunnyDelegate DoSomething;
++++
++++ public void DoSomethingFunny()
++++ {
++++ if (DoSomething != null) DoSomething(this, "hello there", "my friend");
++++ }
++++
++++ public static void Main(string[] args)
++++ {
++++ MyClass mc = new MyClass();
++++ mc.DoSomethingFunny();
++++
++++ }
++++}
++++
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:module
++++
++++using System;
++++
++++public class M1 {
++++
++++ public string Foo;
++++
++++ public M1 (string foo) {
++++ this.Foo = foo;
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:module
++++
++++public class M2 {
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -addmodule:test-418-2-mod.netmodule -addmodule:test-418-3-mod.netmodule
++++
++++using System;
++++
++++public class M3 : M1 {
++++
++++ public M3 () : base ("FOO") {
++++ }
++++
++++ public static int Main () {
++++ if (new M3 ().Foo != "FOO")
++++ return 1;
++++ /* Test that the EXPORTEDTYPES table is correctly set up */
++++ if (typeof (M3).Assembly.GetTypes ().Length != 3)
++++ return 2;
++++ if (typeof (M3).Assembly.GetType ("M2") == null)
++++ return 3;
++++ if (typeof (M3).Assembly.GetType ("M2") != typeof (M2))
++++ return 3;
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++internal class Provider {
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -t:library
++++
++++public class Provider {
++++ public static void Main ()
++++ {
++++ }
++++}
++++
++++public class Foo {
++++ public static void Main ()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-419-2-lib.dll -r:test-419-3-lib.dll
++++
++++class Test {
++++ static void Main () {
++++ Provider p = new Provider ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -r:test-419-3-lib.dll -r:test-419-2-lib.dll
++++
++++class Test {
++++ static void Main () {
++++ Provider p = new Provider ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++delegate void S ();
++++
++++class X {
++++
++++ //
++++ // DO NOT ADD ANYTHING ELSE TO THIS TEST
++++ //
++++ static int Main ()
++++ {
++++ int a;
++++
++++ S b = delegate {
++++ a = 2;
++++ };
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// This test checks various uses of captured local variables
++++//
++++using System;
++++
++++delegate void S ();
++++
++++class X {
++++ static int Main ()
++++ {
++++ int a = 1;
++++ Console.WriteLine ("A is = " + a);
++++ int c = a;
++++ Console.WriteLine (c);
++++ if (a != 1){
++++ return 1;
++++ }
++++
++++ S b = delegate {
++++ if (a != 1)
++++ Environment.Exit (1);
++++ Console.WriteLine ("in Delegate");
++++ a = 2;
++++ if (a != 2)
++++ Environment.Exit (2);
++++ Console.WriteLine ("Inside = " + a);
++++ a = 3;
++++ Console.WriteLine ("After = " + a);
++++ };
++++ if (a != 1)
++++ return 3;
++++ b ();
++++ if (a != 3)
++++ return 4;
++++ Console.WriteLine ("Back, got " + a);
++++ Console.WriteLine ("Test is ok");
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Simple variable capturing
++++//
++++using System;
++++
++++delegate void S ();
++++
++++class X {
++++ static void Main ()
++++ {
++++ int a = 1;
++++ S b = delegate {
++++ a = 2;
++++ };
++++ b ();
++++ Console.WriteLine ("Back, got " + a);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Capturing test.
++++//
++++using System;
++++
++++delegate void S ();
++++
++++class X {
++++ static void Main ()
++++ {
++++ int a = 1;
++++ S b = delegate {
++++ float f = 1;
++++ Console.WriteLine (a);
++++ if (f == 2)
++++ return;
++++ };
++++ b ();
++++ Console.WriteLine ("Back, got " + a);
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Tests capturing of double nested variables
++++//
++++using System;
++++delegate void S ();
++++
++++class X {
++++ static int Main ()
++++ {
++++ int i;
++++ S b = null;
++++
++++ for (i = 0; i < 10; i++){
++++ int j = 0;
++++ b = delegate {
++++ Console.WriteLine ("i={0} j={1}", i, j);
++++ i = i + 1;
++++ j = j + 1;
++++ };
++++ }
++++ Console.WriteLine ("i = {0}", i);
++++ b ();
++++ Console.WriteLine ("i = {0}", i);
++++ if (!t (i, 11))
++++ return 1;
++++ b ();
++++ if (!t (i, 12))
++++ return 2;
++++ Console.WriteLine ("i = {0}", i);
++++ Console.WriteLine ("Test is OK");
++++ return 0;
++++ }
++++
++++ static bool t (int a, int b)
++++ {
++++ return a == b;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Tests capturing of variables
++++//
++++using System;
++++
++++delegate void S ();
++++
++++class X {
++++ static int Main ()
++++ {
++++ int a = 1;
++++ if (a != 1)
++++ return 1;
++++
++++ Console.WriteLine ("A is = " + a);
++++ S b= delegate {
++++ Console.WriteLine ("on delegate");
++++ a = 2;
++++ };
++++ if (a != 1)
++++ return 2;
++++ b();
++++ if (a != 2)
++++ return 3;
++++ Console.WriteLine ("OK");
++++ return 0;
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Tests havign more than one anonymous method that captures the same variable
++++//
++++using System;
++++
++++delegate void D ();
++++
++++class X {
++++ static int Main ()
++++ {
++++ int a = 0;
++++ D d1 = delegate {
++++ Console.WriteLine ("First");
++++ a = 1;
++++ };
++++
++++ D d2 = delegate {
++++ Console.WriteLine ("Second");
++++ a = 2;
++++ };
++++ if (!t (a, 0))
++++ return 1;
++++ d1 ();
++++ if (!t (a, 1))
++++ return 2;
++++ d2 ();
++++ if (!t (a, 2))
++++ return 3;
++++ Console.WriteLine ("Test passes OK");
++++ return 0;
++++ }
++++
++++ static bool t (int a, int b)
++++ {
++++ return a == b;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Tests assignment of a captured variable to another
++++// Do not add anything else to this test.
++++//
++++delegate void S ();
++++
++++class X {
++++
++++ //
++++ // DO NOT ADD ANYTHING ELSE TO THIS TEST
++++ //
++++ static int Main ()
++++ {
++++ int a = 2;
++++ int b = 1;
++++ S d = delegate {
++++ a = b;
++++ };
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Tests unary mutator operators on captured variables
++++//
++++using System;
++++
++++class X {
++++ delegate void D ();
++++
++++ static int gt, gj;
++++
++++ static int Main ()
++++ {
++++ int times = 0;
++++
++++ D d = delegate {
++++ int t = times++;
++++ int j = ++times;
++++
++++ gt = t;
++++ gj = j;
++++ };
++++ d ();
++++
++++ if (gt != 0)
++++ return 1;
++++ if (gj != 2)
++++ return 2;
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// This test exercises the access to a field instance from an instance
++++// method that has an anonymous method.
++++//
++++using System;
++++
++++class S {
++++ delegate void T ();
++++
++++ T t;
++++
++++ int f;
++++
++++ public void Test ()
++++ {
++++ // The loop just forces the creation of a helper class, so
++++ // that the anonymous method is not placed side-by-side this
++++ // method.
++++ int a = 1;
++++ for (int i = a; i < 10; i++){
++++ int j = i;
++++ t = delegate {
++++ Console.WriteLine ("Before: {0} {1} {2}", f, i, j);
++++ f = i;
++++ };
++++ }
++++ }
++++
++++ static int Main ()
++++ {
++++ S s = new S ();
++++ s.Test ();
++++ s.t ();
++++ if (s.f == 10)
++++ return 0;
++++ Console.WriteLine ("Failed:" + s.f);
++++ return 1;
++++ }
++++}
++++
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Parameter and return value compilation tests for anonymous methods
++++//
++++delegate void D (int x);
++++delegate void E (out int x);
++++
++++class X {
++++ static int Main ()
++++ {
++++ // This should create an AnonymousMethod with the implicit argument
++++ D d1 = delegate {};
++++ D d2 = delegate (int a) {};
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Collections;
++++
++++delegate bool predicate (object a);
++++
++++class X {
++++
++++ static int Main ()
++++ {
++++ ArrayList a = new ArrayList ();
++++ for (int i = 0; i < 10; i++)
++++ a.Add (i);
++++
++++ ArrayList even = Find (delegate (object arg) {
++++ return ((((int) arg) % 2) == 0);
++++ }, a);
++++
++++ Console.WriteLine ("Even numbers");
++++ foreach (object r in even){
++++ Console.WriteLine (r);
++++ }
++++ if (even.Count != 5)
++++ return 1;
++++ if (((int)even [0]) != 0 ||
++++ ((int)even [1]) != 2 ||
++++ ((int)even [2]) != 4 ||
++++ ((int)even [3]) != 6 ||
++++ ((int)even [4]) != 8)
++++ return 2;
++++
++++ return 0;
++++ }
++++
++++ static ArrayList Find (predicate p, ArrayList source)
++++ {
++++ ArrayList result = new ArrayList ();
++++
++++ foreach (object a in source){
++++ if (p (a))
++++ result.Add (a);
++++ }
++++
++++ return result;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++delegate void D ();
++++
++++class X {
++++ static void Main ()
++++ {
++++ X x = new X (1);
++++ X y = new X (100);
++++ D a = x.T ();
++++ D b = y.T ();
++++
++++ a ();
++++ b ();
++++ }
++++
++++ X (int start)
++++ {
++++ ins = start;
++++ }
++++
++++ int ins;
++++
++++ D T ()
++++ {
++++ D d = delegate () {
++++ Console.WriteLine ("My state is: " + CALL ());
++++ };
++++
++++ return d;
++++ }
++++ string CALL ()
++++ {
++++ return "GOOD";
++++ }
++++
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++//
++++// Anonymous method group conversions
++++//
++++
++++class X {
++++ delegate void T ();
++++ static event T Click;
++++
++++ static void Method ()
++++ {
++++ }
++++
++++ static void Main ()
++++ {
++++ T t;
++++
++++ // Method group assignment
++++ t = Method;
++++
++++ Click += Method;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++public class Foo {
++++ delegate Inner foo_fn(string s);
++++ public static void Main()
++++ {
++++ foo_fn f = delegate (string s) {
++++ return new Inner(s + s);
++++ };
++++ f ("Test");
++++ }
++++
++++ class Inner
++++ {
++++ public Inner (string s)
++++ { }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Instance access.
++++//
++++using System;
++++
++++delegate void D ();
++++
++++class X {
++++ static void Main ()
++++ {
++++ X x = new X (1);
++++ X y = new X (100);
++++ D a = x.T ();
++++ D b = y.T ();
++++
++++ a ();
++++ b ();
++++ }
++++
++++ X (int start)
++++ {
++++ ins = start;
++++ }
++++
++++ int ins;
++++
++++ D T ()
++++ {
++++ D d = delegate () {
++++ Console.WriteLine ("My state is: " + ins);
++++ };
++++
++++ return d;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Tests the syntax for delegates and events
++++//
++++using System;
++++
++++delegate void ClickEvent ();
++++
++++class Button {
++++ public event ClickEvent Clicked;
++++
++++ public void DoClick ()
++++ {
++++ Clicked ();
++++ }
++++
++++}
++++
++++class X {
++++ static bool called = false;
++++
++++ static int Main ()
++++ {
++++ Button b = new Button ();
++++
++++ b.Clicked += delegate {
++++ Console.WriteLine ("This worked!");
++++ called = true;
++++ };
++++
++++ b.DoClick ();
++++
++++ if (called)
++++ return 0;
++++ else
++++ return 1;
++++ }
++++
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++delegate void A ();
++++
++++class DelegateTest {
++++ static void Main (string[] argv)
++++ {
++++ Console.WriteLine ("Test");
++++
++++ foreach (string arg in argv) {
++++ Console.WriteLine ("OUT: {0}", arg);
++++ A a = delegate {
++++ Console.WriteLine ("arg: {0}", arg);
++++ };
++++ a ();
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Tests capturing of double nested variables
++++//
++++using System;
++++
++++delegate void S ();
++++
++++class X {
++++ static int Main ()
++++ {
++++ int i;
++++ int a = 0;
++++ S b = null;
++++
++++ for (i = 0; i < 10; i++){
++++ int j = 0;
++++ b = delegate {
++++ Console.WriteLine ("i={0} j={1}", i, j);
++++ i = i + 1;
++++ j = j + 1;
++++ a = j;
++++ };
++++ }
++++ b ();
++++ Console.WriteLine ("i = {0}", i);
++++ if (!t (i, 11))
++++ return 1;
++++ b ();
++++ if (!t (i, 12))
++++ return 2;
++++ Console.WriteLine ("i = {0}", i);
++++ Console.WriteLine ("a = {0}", a);
++++ if (!t (a, 2))
++++ return 3;
++++
++++ return 0;
++++ }
++++
++++ static bool t (int a, int b)
++++ {
++++ return a == b;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Nested anonymous methods tests and capturing of different variables.
++++//
++++using System;
++++
++++delegate void D ();
++++
++++class X {
++++ static D GlobalStoreDelegate;
++++
++++ static void Main ()
++++ {
++++ D d = MainHost ();
++++
++++ d ();
++++ GlobalStoreDelegate ();
++++ GlobalStoreDelegate ();
++++ }
++++
++++ static D MainHost ()
++++ {
++++ int toplevel_local = 0;
++++
++++ D d = delegate () {
++++ int anonymous_local = 1;
++++
++++ GlobalStoreDelegate = delegate {
++++ Console.WriteLine ("var1: {0} var2: {1}", toplevel_local, anonymous_local);
++++ anonymous_local = anonymous_local + 1;
++++ };
++++
++++ toplevel_local = toplevel_local + 1;
++++ };
++++
++++ return d;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++// Nested anonymous methods and capturing of variables test
++++//
++++using System;
++++
++++delegate void D ();
++++
++++class X {
++++
++++ static int Main ()
++++ {
++++ X x = new X();
++++ x.M ();
++++ e ();
++++ Console.WriteLine ("J should be 101= {0}", j);
++++ if (j != 101)
++++ return 3;
++++ Console.WriteLine ("OK");
++++ return 0;
++++ }
++++
++++ static int j = 0;
++++ static D e;
++++
++++ void M ()
++++ {
++++ int l = 100;
++++
++++ D d = delegate {
++++ int b;
++++ b = 1;
++++ Console.WriteLine ("Inside d");
++++ e = delegate {
++++ Console.WriteLine ("Inside e");
++++ j = l + b;
++++ Console.WriteLine ("j={0} l={1} b={2}", j, l, b);
++++ };
++++ };
++++ Console.WriteLine ("Calling d");
++++ d ();
++++ }
++++
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++//
++++using System;
++++
++++delegate void D ();
++++
++++class X {
++++ static D r;
++++
++++ static void Main ()
++++ {
++++ D d = T ();
++++
++++ d ();
++++ r ();
++++ r ();
++++ }
++++
++++ static D T ()
++++ {
++++ int var1 = 0;
++++
++++ D d = delegate () {
++++ int var2 = 1;
++++
++++ r = delegate {
++++ Console.WriteLine ("var1: {0} var2: {1}", var1, var2);
++++ var2 = var2 + 1;
++++ };
++++
++++ var1 = var1 + 1;
++++ };
++++
++++ return d;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++delegate void D ();
++++
++++class X {
++++
++++ static int Main ()
++++ {
++++ X x = new X();
++++ x.M ();
++++ e ();
++++ Console.WriteLine ("J should be 101= {0}", j);
++++ if (j != 101)
++++ return 3;
++++ Console.WriteLine ("OK");
++++ return 0;
++++ }
++++
++++ static int j;
++++ static D e;
++++
++++ void M ()
++++ {
++++ int l = 100;
++++
++++ D d = delegate {
++++ int b;
++++ b = 1;
++++ e = delegate {
++++ j = l + b;
++++ };
++++ };
++++ d ();
++++ }
++++
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++delegate int D ();
++++
++++class X {
++++
++++ static void Main ()
++++ {
++++ D x = T (1);
++++
++++ Console.WriteLine ("Should be 2={0}", x ());
++++ }
++++
++++ static D T (int a)
++++ {
++++ D d = delegate {
++++ a = a + 1;
++++ return a;
++++ };
++++
++++ return d;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++delegate int D (int arg);
++++
++++class X {
++++
++++ static int Main ()
++++ {
++++ D x = T (1);
++++
++++ int v = x (10);
++++ Console.WriteLine ("Should be 11={0}", v);
++++ return v == 11 ? 0 : 1;
++++ }
++++
++++ static D T (int a)
++++ {
++++ D d = delegate (int arg) {
++++ return arg + a;
++++ };
++++
++++ return d;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -unsafe
++++using System;
++++
++++delegate int D ();
++++
++++unsafe class X {
++++
++++ static int Main ()
++++ {
++++ D x = T (1);
++++
++++ int v = x ();
++++ Console.WriteLine ("Should be 2={0}", v);
++++ return v == 2 ? 0 : 1;
++++ }
++++
++++ static D T (int a)
++++ {
++++ D d = delegate {
++++ int *x = &a;
++++
++++ *x = *x + 1;
++++ return *x;
++++ };
++++
++++ return d;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++delegate void D ();
++++
++++class X {
++++
++++ static int Main ()
++++ {
++++ X x = new X();
++++ x.M (10);
++++ e ();
++++ Console.WriteLine ("J should be 11= {0}", j);
++++ e ();
++++ Console.WriteLine ("J should be 11= {0}", j);
++++ x.M (100);
++++ e ();
++++ Console.WriteLine ("J should be 101= {0}", j);
++++ if (j != 101)
++++ return 3;
++++ Console.WriteLine ("OK");
++++ return 0;
++++ }
++++
++++ static int j;
++++ static D e;
++++
++++ void M (int a)
++++ {
++++ Console.WriteLine ("A is=" + a);
++++ D d = delegate {
++++ int b;
++++ b = 1;
++++ e = delegate {
++++ Console.WriteLine ("IN NESTED DELEGATE: {0}", a);
++++ j = a + b;
++++ };
++++ };
++++ d ();
++++ }
++++
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++class Delegable {
++++ public event EventHandler MyDelegate;
++++}
++++
++++class DelegateTest {
++++ static void Main (string[] argv)
++++ {
++++ Console.WriteLine ("Test");
++++
++++ Delegable db = new Delegable ();
++++ db.MyDelegate += delegate (object o, EventArgs args) {
++++ Console.WriteLine ("{0}", argv);
++++ Console.WriteLine ("{0}", db);
++++ };
++++ }
++++}
++++
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Collections;
++++
++++public class X
++++{
++++ string[] ABC = { "A", "B", "C" };
++++ string [,] EFGH = { { "E", "F" }, { "G", "H"}};
++++
++++ delegate string Foo ();
++++ delegate void Bar (string s);
++++
++++ public string Hello ()
++++ {
++++ Foo foo = delegate {
++++ foreach (string s in ABC){
++++ Bar bar = delegate (string t) {
++++ Console.WriteLine (t);
++++ };
++++ bar (s);
++++ }
++++
++++ foreach (string s in EFGH){
++++ Bar bar = delegate (string t) {
++++ Console.WriteLine (t);
++++ };
++++ bar (s);
++++ }
++++
++++ return "Hello";
++++ };
++++ return foo ();
++++ }
++++
++++ public static void Main ()
++++ {
++++ X x = new X ();
++++ Console.WriteLine (x.Hello ());
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Reflection;
++++using System.ComponentModel;
++++
++++[assembly: CLSCompliant(true)]
++++[assembly: AssemblyTitle("")]
++++
++++public class CLSCLass_6 {
++++ private object disposedEvent = new object ();
++++ public EventHandlerList event_handlers;
++++
++++ public event Delegate Disposed {
++++ add { event_handlers.AddHandler (disposedEvent, value); }
++++ remove { event_handlers.RemoveHandler (disposedEvent, value); }
++++ }
++++}
++++
++++public delegate CLSDelegate Delegate ();
++++
++++[Serializable]
++++public class CLSDelegate {
++++}
++++
++++internal class CLSClass_5 {
++++ [CLSCompliant (true)]
++++ public uint Test () {
++++ return 1;
++++ }
++++}
++++
++++[CLSCompliant (true)]
++++public class CLSClass_4 {
++++ [CLSCompliant (false)]
++++ public uint Test () {
++++ return 1;
++++ }
++++}
++++
++++public class CLSClass_3 {
++++ [CLSCompliant (false)]
++++ public uint Test_3 () {
++++ return 6;
++++ }
++++}
++++
++++[CLSCompliant(false)]
++++public class CLSClass_2 {
++++ public sbyte XX {
++++ get { return -1; }
++++ }
++++}
++++
++++class CLSClass_1 {
++++ public UInt32 Valid() {
++++ return 5;
++++ }
++++}
++++
++++[CLSCompliant(true)]
++++public class CLSClass {
++++
++++ private class C1 {
++++
++++ [CLSCompliant(true)]
++++ public class C11 {
++++ protected ulong Foo3() {
++++ return 1;
++++ }
++++ }
++++
++++ protected long Foo2() {
++++ return 1;
++++ }
++++ }
++++
++++ [CLSCompliant(false)]
++++ protected internal class CLSClass_2 {
++++ public sbyte XX {
++++ get { return -1; }
++++ }
++++ }
++++
++++
++++ [CLSCompliant(true)]
++++ private ulong Valid() {
++++ return 1;
++++ }
++++
++++ [CLSCompliant(true)]
++++ public byte XX {
++++ get { return 5; }
++++ }
++++
++++// protected internal sbyte FooProtectedInternal() {
++++// return -4;
++++// }
++++
++++ internal UInt32 FooInternal() {
++++ return 1;
++++ }
++++
++++ private ulong Foo() {
++++ return 1;
++++ }
++++
++++
++++ public static void Main() {}
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class CLSClass {
++++
++++ public byte XX {
++++ get { return 5; }
++++ }
++++
++++ public static void Main() {}
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Reflection;
++++
++++[assembly: CLSCompliant (true)]
++++
++++public class CLSClass {
++++ [CLSCompliant(false)]
++++ public CLSClass(ulong l) {}
++++ internal CLSClass(uint i) {}
++++
++++ [CLSCompliant(false)]
++++ public ulong X_0 {
++++ set {}
++++ }
++++
++++ [CLSCompliant(false)]
++++ protected ulong this[ulong i] {
++++ set {}
++++ }
++++
++++ [CLSCompliant(false)]
++++ public ulong X_1;
++++
++++ internal ulong X_2;
++++
++++ public static void Main() {
++++ }
++++}
++++public class InnerTypeClasss {
++++ public struct Struct {
++++ }
++++
++++ public Struct Method () {
++++ return new Struct ();
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++[assembly:CLSCompliant(true)]
++++
++++public interface I1 {
++++}
++++
++++public class CLSClass {
++++ protected internal I1 Foo() {
++++ return null;
++++ }
++++
++++ static void Main() {}
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++[assembly:CLSCompliant(true)]
++++
++++class X1 {
++++ public bool AA;
++++ internal bool aa;
++++}
++++
++++class X2: X1 {
++++ public bool aA;
++++}
++++
++++public class X3 {
++++ internal void bb(bool arg) {}
++++ internal bool bB;
++++ public void BB() {}
++++}
++++
++++class X4 {
++++ public void method(int arg) {}
++++ public void method(bool arg) {}
++++ public bool method() { return false; }
++++}
++++
++++
++++public class BaseClass {
++++ //protected internal bool mEthod() { return false; }
++++}
++++
++++public class CLSClass: BaseClass {
++++ public CLSClass() {}
++++ public CLSClass(int arg) {}
++++
++++ //public int this[int index] { set {} }
++++ //protected int this[bool index] { set {} }
++++
++++ public bool setItem;
++++ static public implicit operator CLSClass(bool value) {
++++ return new CLSClass(2);
++++ }
++++
++++ static public implicit operator CLSClass(int value) {
++++ return new CLSClass(2);
++++ }
++++
++++ [CLSCompliant(false)]
++++ public void Method() {}
++++
++++ internal int Method(bool arg) { return 1; }
++++ internal void methoD() {}
++++
++++ public static void Main() {}
++++}
++++
++++public class oBject: Object {
++++}
++++
++++namespace A {
++++ public class C1 {
++++ }
++++}
++++
++++namespace B {
++++ public class c1 {
++++ }
++++}
++++
++++public class c1 {
++++}
++++// Test
++++[System.CLSCompliant (false)]
++++public interface I1 {
++++}
++++
++++public interface i1 {
++++}
++++
++++// Test
++++enum AB {
++++}
++++
++++[CLSCompliant (false)]
++++public enum aB {
++++}
++++
++++public interface ab {
++++}
++++
++++// Test
++++public class CLSClass_2 {
++++ [CLSCompliant (false)]
++++ public void Method () {}
++++ public void method () {}
++++}
++++
++++// Test
++++namespace System {
++++ public class sByte {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++[assembly:CLSCompliant(true)]
++++
++++[CLSCompliant(false)]
++++public delegate uint MyDelegate();
++++
++++[CLSCompliant(false)]
++++public interface IFake {
++++ [CLSCompliant(true)]
++++ long AA(long arg);
++++ [CLSCompliant(false)]
++++ ulong BB { get; }
++++ //[CLSCompliant(false)]
++++ //sbyte this[ulong I] { set; }
++++ [CLSCompliant(false)]
++++ event MyDelegate MyEvent;
++++}
++++
++++[CLSCompliant(false)]
++++internal interface I {
++++ [CLSCompliant(false)]
++++ void Foo();
++++
++++ [CLSCompliant(true)]
++++ ulong this[int indexA] { set; }
++++}
++++
++++interface I2 {
++++ int Test(int arg1, bool arg2);
++++}
++++
++++public class CLSClass {
++++ [CLSCompliant(false)]
++++ public delegate uint MyDelegate();
++++
++++ public static void Main() {}
++++}
++++public class CLSClass_2 {
++++ [CLSCompliant (false)]
++++ public CLSClass_2(int[,,] b) {
++++ }
++++
++++ public CLSClass_2(int[,] b) {
++++ }
++++
++++ public void Test (int[,] b, int i) {}
++++ public void Test (int[,,] b, bool b2) {}
++++}
++++
++++public class X1 {
++++ [CLSCompliant (false)]
++++ public void M2 (int i) {}
++++}
++++
++++public class X2: X1 {
++++ public void M2 (ref int i) {}
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++[assembly:CLSCompliant(true)]
++++
++++namespace aa {
++++ public class I1 {
++++ }
++++}
++++
++++namespace bb {
++++ public interface i1 {
++++ }
++++}
++++
++++public class CLSClass {
++++ public static void Main() {}
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++[assembly:CLSCompliant (true)]
++++
++++[CLSCompliant (false)]
++++public interface I {
++++ [CLSCompliant (false)]
++++ void Error (ulong arg);
++++}
++++
++++[CLSCompliant (false)]
++++public interface I2 {
++++ [CLSCompliant (true)]
++++ void Error (long arg);
++++}
++++
++++
++++public class MainClass {
++++ public static void Main () {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++[assembly:CLSCompliant (true)]
++++
++++[CLSCompliant (true)]
++++public abstract class CLSClass {
++++ [CLSCompliant (true)]
++++ public abstract void Test (IComparable arg);
++++}
++++
++++public abstract class CLSCLass_2 {
++++ public abstract void Test ();
++++}
++++
++++public class MainClass {
++++ public static void Main () {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++[module: CLSCompliant(true)]
++++[assembly: CLSCompliant(true)]
++++
++++public class MainClass {
++++ public static void Main () {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++
++++public class CLSClass {
++++ [CLSCompliant (false)]
++++ static public implicit operator CLSClass(byte value) {
++++ return new CLSClass();
++++ }
++++
++++ [CLSCompliant (true)]
++++ private void Error (bool arg) {
++++ }
++++}
++++
++++public class MainClass {
++++ public static void Main () {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++[assembly:CLSCompliant (true)]
++++
++++public class CLSAttribute_1: Attribute {
++++ public CLSAttribute_1(int[] array) {
++++ }
++++
++++ public CLSAttribute_1(int array) {
++++ }
++++}
++++
++++[CLSCompliant (false)]
++++public class CLSAttribute_2: Attribute {
++++ private CLSAttribute_2(int arg) {
++++ }
++++}
++++
++++internal class CLSAttribute_3: Attribute {
++++ public CLSAttribute_3(int[] array) {
++++ }
++++}
++++
++++[CLSCompliant (false)]
++++public class CLSAttribute_4: Attribute {
++++ private CLSAttribute_4(int[] args) {
++++ }
++++}
++++
++++public class ClassMain {
++++ public static void Main () {}
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++[assembly:CLSCompliant (true)]
++++
++++[CLSCompliant (false)]
++++[CLSAttribute (new bool [] {true, false})]
++++public class CLSAttribute: Attribute {
++++ public CLSAttribute(bool[] array) {
++++ }
++++}
++++
++++public class ClassMain {
++++ public static void Main () {}
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++using System;
++++using System.Collections;
++++
++++class X {
++++ static IEnumerator GetIt ()
++++ {
++++ yield return 1;
++++ yield return 2;
++++ yield return 3;
++++ }
++++
++++ static IEnumerable GetIt2 ()
++++ {
++++ yield return 1;
++++ yield return 2;
++++ yield return 3;
++++ }
++++
++++ static int Main ()
++++ {
++++ IEnumerator e = GetIt ();
++++ int total = 0;
++++
++++ while (e.MoveNext ()){
++++ Console.WriteLine ("Value=" + e.Current);
++++ total += (int) e.Current;
++++ }
++++
++++ if (total != 6)
++++ return 1;
++++
++++ total = 0;
++++ foreach (int i in GetIt2 ()){
++++ Console.WriteLine ("Value=" + i);
++++ total += i;
++++ }
++++ if (total != 6)
++++ return 2;
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++using System;
++++using System.Collections;
++++
++++class X {
++++ static int start, end;
++++ static int i;
++++
++++ static IEnumerator GetRange ()
++++ {
++++ yield return 1;
++++ for (i = start; i < end; i++)
++++ yield return i;
++++ yield return 100;
++++ }
++++
++++ static int Main ()
++++ {
++++ start = 10;
++++ end = 30;
++++
++++ int total = 0;
++++
++++ IEnumerator e = GetRange ();
++++ while (e.MoveNext ()){
++++ Console.WriteLine ("Value=" + e.Current);
++++ total += (int) e.Current;
++++ }
++++
++++ if (total != 491)
++++ return 1;
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++//
++++// Use
++++
++++using System;
++++using System.Collections;
++++
++++class X {
++++ static IEnumerable GetIt (int [] args)
++++ {
++++ foreach (int a in args)
++++ yield return a;
++++ }
++++
++++ static IEnumerable GetMulti (int [,] args)
++++ {
++++ foreach (int a in args)
++++ yield return a;
++++ }
++++
++++ static int Main ()
++++ {
++++ int total = 0;
++++ foreach (int i in GetIt (new int [] { 1, 2, 3})){
++++ Console.WriteLine ("Got: " + i);
++++ total += i;
++++ }
++++
++++ if (total != 6)
++++ return 1;
++++
++++ total = 0;
++++ foreach (int i in GetMulti (new int [,] { { 10, 20 }, { 30, 40}})){
++++ Console.WriteLine ("Got: " + i);
++++ total += i;
++++ }
++++ if (total != 100)
++++ return 2;
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++using System;
++++using System.Collections;
++++
++++class X {
++++ static IEnumerable GetRange (int start, int end)
++++ {
++++ for (int i = start; i < end; i++)
++++ yield return i;
++++ }
++++
++++ static void Main ()
++++ {
++++ Console.WriteLine ("GetRange 10..20");
++++
++++ foreach (int i in GetRange (10, 20)){
++++ Console.WriteLine ("i=" + i);
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++//
++++// Use
++++
++++using System;
++++using System.Collections;
++++
++++class X {
++++ static IEnumerable GetIt ()
++++ {
++++ List l = new List (3);
++++ l.Add (1);
++++ l.Add (2);
++++ l.Add (3);
++++
++++ foreach (int i in l)
++++ yield return i;
++++ }
++++
++++ static int Main ()
++++ {
++++ int total = 0;
++++ foreach (int i in GetIt ()) {
++++ Console.WriteLine ("Got: " + i);
++++ total += i;
++++ }
++++
++++ return total == 6 ? 0 : 1;
++++ }
++++}
++++
++++public class List : IEnumerable {
++++
++++ int pos = 0;
++++ int [] items;
++++
++++ public List (int i)
++++ {
++++ items = new int [i];
++++ }
++++
++++ public void Add (int value)
++++ {
++++ items [pos ++] = value;
++++ }
++++
++++ public MyEnumerator GetEnumerator ()
++++ {
++++ return new MyEnumerator(this);
++++ }
++++
++++ IEnumerator IEnumerable.GetEnumerator ()
++++ {
++++ return GetEnumerator ();
++++ }
++++
++++ public struct MyEnumerator : IEnumerator {
++++
++++ List l;
++++ int p;
++++
++++ public MyEnumerator (List l)
++++ {
++++ this.l = l;
++++ p = -1;
++++ }
++++
++++ public object Current {
++++ get {
++++ return l.items [p];
++++ }
++++ }
++++
++++ public bool MoveNext()
++++ {
++++ return ++p < l.pos;
++++ }
++++
++++ public void Reset()
++++ {
++++ p = 0;
++++ }
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++using System;
++++using System.Collections;
++++
++++struct S {
++++ int j;
++++
++++ public IEnumerable Get (int a)
++++ {
++++ Console.WriteLine ("Sending: " + a);
++++ yield return a;
++++ j = 10;
++++ Console.WriteLine ("Sending: " + j);
++++ yield return j;
++++ }
++++
++++ public static IEnumerable GetS (int a)
++++ {
++++ yield return 100;
++++ yield return a;
++++ yield return 1000;
++++ }
++++}
++++
++++class X {
++++ IEnumerable Get (int a)
++++ {
++++ yield return 1;
++++ yield return 2;
++++ yield return a;
++++ }
++++
++++ static IEnumerable GetS (int a)
++++ {
++++ yield return a;
++++ yield return a;
++++ yield return 1;
++++ }
++++
++++ static int Main ()
++++ {
++++ X y = new X ();
++++
++++ int total = 0;
++++ foreach (int x in y.Get (5)){
++++ total += x;
++++ }
++++ if (total != 8)
++++ return 1;
++++
++++ total = 0;
++++ foreach (int x in GetS (3)){
++++ total += x;
++++ }
++++ if (total != 7)
++++ return 2;
++++
++++ S s = new S();
++++ total = 0;
++++ foreach (int x in s.Get (100)){
++++ Console.WriteLine ("Got: " + x);
++++ total += x;
++++ }
++++ if (total != 110)
++++ return 3;
++++
++++ total = 0;
++++ foreach (int x in S.GetS (1)){
++++ total += x;
++++ }
++++ if (total != 1101)
++++ return 4;
++++
++++ Console.WriteLine ("OK");
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++using System;
++++using System.Collections;
++++
++++public class Test
++++{
++++ public IEnumerable Foo (int a)
++++ {
++++ try {
++++ try {
++++ yield return a;
++++ } finally {
++++ Console.WriteLine ("Hello World");
++++ }
++++
++++ Console.WriteLine ("Next block");
++++
++++ try {
++++ yield return a * a;
++++ } finally {
++++ Console.WriteLine ("Boston");
++++ }
++++ } finally {
++++ Console.WriteLine ("Outer finally");
++++ }
++++
++++ Console.WriteLine ("Outer block");
++++ yield break;
++++ }
++++}
++++
++++class X
++++{
++++ static int Main ()
++++ {
++++ Test test = new Test ();
++++
++++ ArrayList list = new ArrayList ();
++++ foreach (object o in test.Foo (5))
++++ list.Add (o);
++++
++++ if (list.Count != 2)
++++ return 1;
++++ if ((int) list [0] != 5)
++++ return 2;
++++ if ((int) list [1] != 25)
++++ return 3;
++++
++++ IEnumerable a = test.Foo (5);
++++
++++ IEnumerator b = a as IEnumerator;
++++ if (b != null) {
++++ if (b.MoveNext ())
++++ return 4;
++++ }
++++
++++ IEnumerator c = a.GetEnumerator ();
++++ if (!c.MoveNext ())
++++ return 5;
++++ if ((int) c.Current != 5)
++++ return 6;
++++ if (!c.MoveNext ())
++++ return 7;
++++ if ((int) c.Current != 25)
++++ return 8;
++++
++++ IEnumerator d = a.GetEnumerator ();
++++
++++ if ((int) c.Current != 25)
++++ return 9;
++++ if (!d.MoveNext ())
++++ return 10;
++++ if ((int) c.Current != 25)
++++ return 11;
++++ if ((int) d.Current != 5)
++++ return 12;
++++
++++ if (c.MoveNext ())
++++ return 13;
++++
++++ ((IDisposable) a).Dispose ();
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++using System;
++++using System.Collections;
++++
++++public class Foo : IDisposable
++++{
++++ public readonly int Data;
++++
++++ public Foo (int data)
++++ {
++++ this.Data = data;
++++ }
++++
++++ public bool disposed;
++++
++++ public void Dispose ()
++++ {
++++ disposed = true;
++++ }
++++}
++++
++++class X
++++{
++++ public static IEnumerable Test (int a, int b)
++++ {
++++ Foo foo3, foo4;
++++
++++ using (Foo foo1 = new Foo (a), foo2 = new Foo (b)) {
++++ yield return foo1.Data;
++++ yield return foo2.Data;
++++
++++ foo3 = foo1;
++++ foo4 = foo2;
++++ }
++++
++++ yield return foo3.disposed;
++++ yield return foo4.disposed;
++++ }
++++
++++ static int Main ()
++++ {
++++ ArrayList list = new ArrayList ();
++++ foreach (object data in Test (3, 5))
++++ list.Add (data);
++++
++++ if (list.Count != 4)
++++ return 1;
++++ if ((int) list [0] != 3)
++++ return 2;
++++ if ((int) list [1] != 5)
++++ return 3;
++++ if (!(bool) list [2])
++++ return 4;
++++ if (!(bool) list [3])
++++ return 5;
++++
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Collections;
++++
++++public class Tester
++++{
++++ string[] ABC = { "A", "B", "C" };
++++ // D
++++ string [,] EFGH = { { "E", "F" }, { "G", "H"}};
++++ // I
++++ ArrayList al = new ArrayList ();
++++
++++ public Tester ()
++++ {
++++ al.Add ("J");
++++ al.Add ("K");
++++ }
++++
++++ public System.Collections.IEnumerator GetEnumerator()
++++ {
++++ foreach (string s in ABC){
++++ if (s == null)
++++ throw new Exception ();
++++ else
++++ yield return s;
++++ }
++++
++++ yield return "D";
++++ foreach (string s in EFGH){
++++ if(s == null)
++++ throw new Exception ();
++++ else
++++ yield return s;
++++ }
++++
++++ yield return "I";
++++ foreach (string s in al){
++++ if (s == null)
++++ throw new Exception ();
++++ else
++++ yield return s;
++++ }
++++
++++ yield return "L";
++++ }
++++}
++++
++++
++++class Test
++++{
++++ public static int Main()
++++ {
++++ Tester tester = new Tester();
++++ string [] list = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L" };
++++ int top = 0;
++++
++++ foreach (string s in tester){
++++ if (s != list [top]){
++++ Console.WriteLine ("Failure, got {0} expected {1}", s, list [top]);
++++ return 1;
++++ }
++++ top++;
++++ }
++++ if (top != list.Length){
++++ Console.WriteLine ("Failure, expected {0} got {1}", list.Length, top);
++++ }
++++ Console.WriteLine ("Success");
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++namespace Foo
++++{
++++ public class Hello
++++ {
++++ public static int World = 8;
++++ }
++++}
++++
++++namespace Bar
++++{
++++ public class Hello
++++ {
++++ public static int World = 9;
++++ }
++++}
++++
++++namespace X
++++{
++++ using Foo;
++++
++++ public partial class Test
++++ {
++++ public static int FooWorld ()
++++ {
++++ return Hello.World;
++++ }
++++ }
++++}
++++
++++namespace X
++++{
++++ using Bar;
++++
++++ public partial class Test
++++ {
++++ public static int BarWorld ()
++++ {
++++ return Hello.World;
++++ }
++++ }
++++}
++++
++++class Y
++++{
++++ static int Main ()
++++ {
++++ if (X.Test.FooWorld () != 8)
++++ return 1;
++++ if (X.Test.BarWorld () != 9)
++++ return 2;
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++namespace Test1
++++{
++++ public class Base
++++ { }
++++
++++ public partial class Foo : Base
++++ { }
++++
++++ public partial class Foo : Base
++++ { }
++++}
++++
++++namespace Test2
++++{
++++ public interface Base
++++ { }
++++
++++ public partial class Foo : Base
++++ { }
++++
++++ public partial class Foo : Base
++++ { }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++public partial class Test
++++{
++++ public readonly Foo TheFoo;
++++
++++ public Test ()
++++ {
++++ this.TheFoo = new Foo ();
++++ }
++++
++++ public partial interface IFoo
++++ {
++++ int Hello (Test foo);
++++ }
++++
++++ public int TestFoo ()
++++ {
++++ return TheFoo.Hello (this);
++++ }
++++}
++++
++++public partial class Test
++++{
++++ public partial class Foo : IFoo
++++ {
++++ int IFoo.Hello (Test test)
++++ {
++++ return 2;
++++ }
++++
++++ public int Hello (Test test)
++++ {
++++ return 1;
++++ }
++++ }
++++
++++ public int TestIFoo (IFoo foo)
++++ {
++++ return foo.Hello (this);
++++ }
++++}
++++
++++class X
++++{
++++ static int Main ()
++++ {
++++ Test test = new Test ();
++++ if (test.TestFoo () != 1)
++++ return 1;
++++ if (test.TestIFoo (test.TheFoo) != 2)
++++ return 2;
++++ return 0;
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++namespace A
++++{
++++ interface IFoo
++++ {
++++ void Hello (IFoo foo);
++++ }
++++}
++++
++++namespace B
++++{
++++ partial class Test
++++ { }
++++}
++++
++++namespace B
++++{
++++ using A;
++++
++++ partial class Test : IFoo
++++ {
++++ void IFoo.Hello (IFoo foo)
++++ { }
++++ }
++++}
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++class B {
++++}
++++
++++interface iface {
++++}
++++
++++partial class A : B {
++++}
++++
++++partial class A : iface {
++++}
++++
++++class D { static void Main () {} }
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -langversion:default
++++
++++partial class Foo
++++{
++++ ~Foo ()
++++ { }
++++}
++++
++++partial class Foo
++++{ }
++++
++++class B { static void Main () {} }
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++using System;
++++using System.Runtime.InteropServices;
++++
++++[Obsolete]
++++public partial class Test
++++{ }
++++
++++class X
++++{
++++ static void Main ()
++++ { }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-001</name>\r
++++ </assembly>\r
++++ <members>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-001.xml
++++using System;
++++
++++/// <summary>
++++/// xml comment on namespace ... is not allowed.
++++/// </summary>
++++namespace Testing
++++{
++++ public class A
++++ {
++++ public static void Main ()
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-002</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Testing.Test">\r
++++ <summary>
++++ comment on class
++++ </summary>
++++ </member>\r
++++ <!-- Badly formed XML comment ignored for member "T:Testing.Test2" -->\r
++++ <member name="T:Testing.Test3">\r
++++ <summary>
++++ another Java-style documentation style
++++ </summary>
++++ </member>\r
++++ <member name="T:Testing.Test4">\r
++++ indentation level test <seealso
++++ cref="T:Testing.Test" />.
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-002.xml
++++using System;
++++
++++namespace Testing
++++{
++++ /// <summary>
++++ /// comment on class
++++ /// </summary>
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++ }
++++
++++ /// <summary>
++++ /// Incorrect comment markup. See <see cref="T:Testing.Test" /> too.
++++ /// </incorrect>
++++ public class Test2
++++ {
++++ }
++++
++++ /**
++++ <summary>
++++ another Java-style documentation style
++++ </summary>
++++ */
++++ public class Test3
++++ {
++++ }
++++
++++ /// indentation level test <seealso
++++ /// cref="T:Testing.Test" />.
++++public class Test4
++++{
++++}
++++
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-003</name>\r
++++ </assembly>\r
++++ <members>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-003.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ /// here is an extraneous comment
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-004</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Testing.StructTest">\r
++++ <summary>
++++ comment for struct
++++ </summary>
++++ </member>\r
++++ <!-- Badly formed XML comment ignored for member "T:Testing.StructTest2" -->\r
++++ <member name="T:Testing.StructTest3">\r
++++ <summary>
++++ Java style commet
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-004.xml
++++using System;
++++
++++namespace Testing
++++{
++++ /// <summary>
++++ /// comment for struct
++++ /// </summary>
++++ public struct StructTest
++++ {
++++ }
++++
++++ /// <summary>
++++ /// incorrect markup comment for struct
++++ /// </incorrect>
++++ public struct StructTest2
++++ {
++++ }
++++
++++ /**
++++ <summary>
++++ Java style commet
++++ </summary>
++++ */
++++ public struct StructTest3
++++ {
++++ }
++++
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-005</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Testing.InterfaceTest">\r
++++ <summary>
++++ comment for interface
++++ </summary>
++++ </member>\r
++++ <!-- Badly formed XML comment ignored for member "T:Testing.InterfaceTest2" -->\r
++++ <member name="T:Testing.InterfaceTest3">\r
++++ <summary>
++++ Java style comment for interface
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-005.xml
++++using System;
++++
++++namespace Testing
++++{
++++ /// <summary>
++++ /// comment for interface
++++ /// </summary>
++++ public interface InterfaceTest
++++ {
++++ }
++++
++++ /// <summary>
++++ /// incorrect markup comment for interface
++++ /// </incorrect>
++++ public interface InterfaceTest2
++++ {
++++ }
++++
++++ /**
++++ <summary>
++++ Java style comment for interface
++++ </summary>
++++ */
++++ public interface InterfaceTest3
++++ {
++++ }
++++
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-006</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Testing.EnumTest">\r
++++ <summary>
++++ comment for enum type
++++ </summary>
++++ </member>\r
++++ <!-- Badly formed XML comment ignored for member "T:Testing.EnumTest2" -->\r
++++ <member name="T:Testing.EnumTest3">\r
++++ <summary>
++++ Java style comment for enum type
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-006.xml
++++using System;
++++
++++namespace Testing
++++{
++++ /// <summary>
++++ /// comment for enum type
++++ /// </summary>
++++ public enum EnumTest
++++ {
++++ Foo,
++++ Bar,
++++ }
++++
++++ /// <summary>
++++ /// comment for enum type
++++ /// </incorrect>
++++ public enum EnumTest2
++++ {
++++ Foo,
++++ Bar,
++++ }
++++
++++ /**
++++ <summary>
++++ Java style comment for enum type
++++ </summary>
++++ */
++++ public enum EnumTest3
++++ {
++++ Foo,
++++ Bar,
++++ }
++++
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-007</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Testing.MyDelegate">\r
++++ <summary>
++++ comment for delegate type
++++ </summary>
++++ </member>\r
++++ <!-- Badly formed XML comment ignored for member "T:Testing.MyDelegate2" -->\r
++++ <member name="T:Testing.MyDelegate3">\r
++++ <summary>
++++ Javadoc comment for delegate type
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-007.xml
++++using System;
++++
++++namespace Testing
++++{
++++ /// <summary>
++++ /// comment for delegate type
++++ /// </summary>
++++ public delegate void MyDelegate (object o, EventArgs e);
++++
++++ /// <summary>
++++ /// comment for delegate type
++++ /// </incorrect>
++++ public delegate void MyDelegate2 (object o, EventArgs e);
++++
++++ /**
++++ <summary>
++++ Javadoc comment for delegate type
++++ </summary>
++++ */
++++ public delegate void MyDelegate3 (object o, EventArgs e);
++++
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-008</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Testing.Test">\r
++++ comment without markup on class - it is allowed
++++ </member>\r
++++ <!-- Badly formed XML comment ignored for member "T:Testing.Test2" -->\r
++++ <!-- Badly formed XML comment ignored for member "T:Testing.Test3" -->\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-008.xml
++++using System;
++++
++++namespace Testing
++++{
++++ /// comment without markup on class - it is allowed
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++ }
++++
++++ /// <6roken> broken markup
++++ public class Test2
++++ {
++++ }
++++
++++ /// <dont-forget-close-tag>
++++ public class Test3
++++ {
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-009</name>\r
++++ </assembly>\r
++++ <members>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-009.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ /// inside method - not allowed.
++++ }
++++ }
++++
++++ public class Test2
++++ {
++++ /// no target
++++ }
++++
++++ public class Test3
++++ {
++++ }
++++ /// no target case 2.
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-010</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="F:Testing.Test.Constant">\r
++++ <summary>
++++ comment for const declaration
++++ </summary>
++++ </member>\r
++++ <!-- Badly formed XML comment ignored for member "F:Testing.Test.Constant2" -->\r
++++ <member name="F:Testing.Test.Constant3">\r
++++ <summary>
++++ Javaism comment for const declaration
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-010.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ /// <summary>
++++ /// comment for const declaration
++++ /// </summary>
++++ const string Constant = "CONSTANT STRING";
++++
++++ /// <summary>
++++ /// invalid comment for const declaration
++++ /// </invalid>
++++ const string Constant2 = "CONSTANT STRING";
++++
++++ /**
++++ <summary>
++++ Javaism comment for const declaration
++++ </summary>
++++ */
++++ const string Constant3 = "CONSTANT STRING";
++++
++++ public static void Main ()
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-011</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="F:Testing.Test.PublicField">\r
++++ <summary>
++++ comment for public field
++++ </summary>
++++ </member>\r
++++ <!-- Badly formed XML comment ignored for member "F:Testing.Test.PublicField2" -->\r
++++ <member name="F:Testing.Test.PublicField3">\r
++++ <summary>
++++ Javadoc comment for public field
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-011.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ /// <summary>
++++ /// comment for public field
++++ /// </summary>
++++ public string PublicField;
++++
++++ /// <summary>
++++ /// comment for public field
++++ /// </invalid>
++++ public string PublicField2;
++++
++++ /**
++++ <summary>
++++ Javadoc comment for public field
++++ </summary>
++++ */
++++ public string PublicField3;
++++
++++ public static void Main ()
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-012</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="F:Testing.Test.PrivateField">\r
++++ <summary>
++++ comment for private field
++++ </summary>
++++ </member>\r
++++ <!-- Badly formed XML comment ignored for member "F:Testing.Test.PrivateField2" -->\r
++++ <member name="F:Testing.Test.PrivateField3">\r
++++ <summary>
++++ Javadoc comment for private field
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-012.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// <summary>
++++ /// comment for private field
++++ /// </summary>
++++ private string PrivateField;
++++
++++ /// <summary>
++++ /// incorrect markup comment for private field
++++ /// </incorrect>
++++ private string PrivateField2;
++++
++++ /**
++++ <summary>
++++ Javadoc comment for private field
++++ </summary>
++++ */
++++ private string PrivateField3;
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-013</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="P:Testing.Test.PublicProperty">\r
++++ <summary>
++++ comment for public property
++++ </summary>
++++ </member>\r
++++ <!-- Badly formed XML comment ignored for member "P:Testing.Test.PublicProperty2" -->\r
++++ <member name="P:Testing.Test.PublicProperty3">\r
++++ <summary>
++++ Javadoc comment for public property
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-013.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// <summary>
++++ /// comment for public property
++++ /// </summary>
++++ public string PublicProperty {
++++ /// <summary>
++++ /// On public getter - no effect
++++ /// </summary>
++++ get { return null; }
++++ /// <summary>
++++ /// On public setter - no effect
++++ /// </summary>
++++ set { }
++++ }
++++
++++ /// <summary>
++++ /// incorrect comment for public property
++++ /// </incorrect>
++++ public string PublicProperty2 {
++++ get { return null; }
++++ }
++++
++++ /**
++++ <summary>
++++ Javadoc comment for public property
++++ </summary>
++++ */
++++ public string PublicProperty3 {
++++ /**
++++ <summary>
++++ On public getter - no effect
++++ </summary>
++++ */
++++ get { return null; }
++++ /**
++++ <summary>
++++ On public setter - no effect
++++ </summary>
++++ */
++++ set { }
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-014</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="P:Testing.Test.PrivateProperty">\r
++++ <summary>
++++ comment for private property
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-014.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// <summary>
++++ /// comment for private property
++++ /// </summary>
++++ private string PrivateProperty {
++++ get { return null; }
++++ set { }
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-015</name>\r
++++ </assembly>\r
++++ <members>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-015.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ private string PrivateProperty {
++++ get { return null; }
++++ /// <summary>
++++ /// comment for private property setter - no effect
++++ /// </summary>
++++ set { }
++++ }
++++
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-016</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="E:Testing.Test.MyEvent">\r
++++ <summary>
++++ public event EventHandler MyEvent
++++ </summary>
++++ </member>\r
++++ <member name="E:Testing.Test.MyEvent2">\r
++++ private event EventHandler MyEvent; without markup - it is OK.
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-016.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// <summary>
++++ /// public event EventHandler MyEvent
++++ /// </summary>
++++ public event EventHandler MyEvent;
++++
++++ /// private event EventHandler MyEvent; without markup - it is OK.
++++ private event EventHandler MyEvent2;
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-017</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="M:Testing.Test.Foo">\r
++++ comment on method without parameter
++++ </member>\r
++++ <member name="M:Testing.Test.Foo(System.Int64,Testing.Test,System.Collections.ArrayList)">\r
++++ here is a documentation with parameters (and has same name)
++++ </member>\r
++++ <member name="M:Testing.Test.Foo(System.String[])">\r
++++ here is a documentation with parameters (and has same name)
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-017.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// comment on method without parameter
++++ public static void Foo ()
++++ {
++++ }
++++
++++ /// here is a documentation with parameters (and has same name)
++++ public static void Foo (long l, Test t, System.Collections.ArrayList al)
++++ {
++++ }
++++
++++ /// here is a documentation with parameters (and has same name)
++++ public static void Foo (params string [] param)
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-018</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="P:Testing.Test.Item(System.Int32)">\r
++++ <summary>
++++ comment for indexer
++++ </summary>
++++ </member>\r
++++ <member name="P:Testing.Test.Item(System.String)">\r
++++ <summary>
++++ comment for indexer
++++ </summary>
++++ </member>\r
++++ <member name="P:Testing.Test.Item(System.Int32,Testing.Test)">\r
++++ <summary>
++++ comment for indexer wit multiple parameters
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-018.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// <summary>
++++ /// comment for indexer
++++ /// </summary>
++++ public string this [int i] {
++++ get { return null; }
++++ }
++++
++++ /// <summary>
++++ /// comment for indexer
++++ /// </summary>
++++ public string this [string s] {
++++ get { return null; }
++++ }
++++
++++ /// <summary>
++++ /// comment for indexer wit multiple parameters
++++ /// </summary>
++++ public string this [int i, Test t] {
++++ get { return null; }
++++ }
++++
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-019</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="M:Testing.Test.op_LogicalNot(Testing.Test)">\r
++++ <summary>
++++ comment for unary operator
++++ </summary>
++++ </member>\r
++++ <member name="M:Testing.Test.op_Addition(Testing.Test,System.Int32)">\r
++++ <summary>
++++ comment for binary operator
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-019.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// <summary>
++++ /// comment for unary operator
++++ /// </summary>
++++ public static bool operator ! (Test t)
++++ {
++++ return false;
++++ }
++++
++++ /// <summary>
++++ /// comment for binary operator
++++ /// </summary>
++++ public static int operator + (Test t, int b)
++++ {
++++ return b;
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-020</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="M:Testing.Test.#ctor">\r
++++ comment for constructor
++++ </member>\r
++++ <member name="M:Testing.Test.Finalize">\r
++++ comment for destructor
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-020.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// comment for constructor
++++ public Test ()
++++ {
++++ }
++++
++++ /// comment for destructor
++++ ~Test ()
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-021</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Testing.Test.InternalClass">\r
++++ comment for internal class
++++ </member>\r
++++ <member name="T:Testing.Test.InternalStruct">\r
++++ comment for internal struct
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-021.xml
++++using System;
++++
++++namespace Testing
++++{
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// comment for internal class
++++ public class InternalClass
++++ {
++++ }
++++
++++ /// comment for internal struct
++++ public struct InternalStruct
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-022</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <!-- Badly formed XML comment ignored for member "T:Testing.Test2" -->\r
++++ <member name="M:Testing.Test2.Foo">\r
++++ another documentation style (Java-mimic)
++++ </member>\r
++++ <member name="T:Testing.StructTest">\r
++++ testing indentation <summary> test test ;-)
++++ comment for struct
++++ </summary>
++++ </member>\r
++++ <member name="T:Testing.InterfaceTest">\r
++++ <summary>
++++ comment for interface
++++ </summary>
++++ </member>\r
++++ <member name="T:Testing.EnumTest">\r
++++ <summary>
++++ comment for enum type
++++ </summary>
++++ </member>\r
++++ <member name="F:Testing.EnumTest.Foo">\r
++++ <summary>
++++ comment for enum field
++++ </summary>
++++ </member>\r
++++ <member name="T:Testing.Dummy">\r
++++ <summary>
++++ comment for dummy type
++++ </summary>
++++ </member>\r
++++ <member name="T:Testing.MyDelegate">\r
++++ <summary>
++++ comment for delegate type
++++ </summary>
++++ </member>\r
++++ <member name="T:Testing.Test">\r
++++ <summary>
++++ description for class Test
++++ </summary>
++++ </member>\r
++++ <member name="F:Testing.Test.Constant">\r
++++ comment for const declaration
++++ </member>\r
++++ <member name="F:Testing.Test.BadPublicField">\r
++++ comment for public field
++++ </member>\r
++++ <member name="F:Testing.Test.PrivateField">\r
++++ comment for private field
++++ </member>\r
++++ <member name="M:Testing.Test.Foo">\r
++++ here is a documentation!!!
++++ </member>\r
++++ <member name="M:Testing.Test.Foo(System.Int64,Testing.Test,System.Collections.ArrayList)">\r
++++ here is a documentation with parameters
++++ </member>\r
++++ <member name="M:Testing.Test.op_LogicalNot(Testing.Test)">\r
++++ <summary>
++++ comment for unary operator
++++ </summary>
++++ </member>\r
++++ <member name="M:Testing.Test.op_Addition(Testing.Test,System.Int32)">\r
++++ <summary>
++++ comment for binary operator
++++ </summary>
++++ </member>\r
++++ <member name="M:Testing.Test.Finalize">\r
++++ comment for destructor
++++ </member>\r
++++ <member name="M:Testing.Test.#ctor">\r
++++ comment for .ctor()
++++ </member>\r
++++ <member name="M:Testing.Test.#ctor(System.String,System.String[])">\r
++++ comment for .ctor(string arg, string [] args)
++++ </member>\r
++++ <member name="P:Testing.Test.PublicProperty">\r
++++ comment for public property
++++ </member>\r
++++ <member name="P:Testing.Test.PrivateProperty">\r
++++ comment for private property
++++ </member>\r
++++ <member name="E:Testing.Test.MyEvent">\r
++++ public event EventHandler MyEvent ;-)
++++ </member>\r
++++ <member name="P:Testing.Test.Item(System.Int32)">\r
++++ comment for indexer
++++ </member>\r
++++ <member name="P:Testing.Test.Item(System.Int32,Testing.Test)">\r
++++ comment for indexer wit multiple parameters
++++ </member>\r
++++ <member name="T:Testing.Test.InternalClass">\r
++++ comment for internal class
++++ </member>\r
++++ <member name="T:Testing.Test.InternalStruct">\r
++++ comment for internal struct
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-022.xml
++++//
++++// Combined tests (for detecting incorrect markup targeting).
++++//
++++using System;
++++
++++/// <summary>
++++/// xml comment is not allowed here.
++++/// </summary>
++++namespace Testing
++++{
++++ /// <summary>
++++ /// </incorrect>
++++ public class Test2
++++ {
++++ /**
++++ another documentation style (Java-mimic)
++++ */
++++ public static void Foo ()
++++ {
++++ /// here is an extraneous comment
++++ }
++++
++++ public static void Main ()
++++ {
++++ }
++++ }
++++
++++ /// testing indentation <summary> test test ;-)
++++ /// comment for struct
++++ /// </summary>
++++ public struct StructTest
++++ {
++++ }
++++
++++ /// <summary>
++++ /// comment for interface
++++ /// </summary>
++++ public interface InterfaceTest
++++ {
++++ }
++++
++++ /// <summary>
++++ /// comment for enum type
++++ /// </summary>
++++ public enum EnumTest
++++ {
++++ /// <summary>
++++ /// comment for enum field
++++ /// </summary>
++++ Foo,
++++ Bar,
++++ }
++++
++++ /// <summary>
++++ /// comment for dummy type
++++ /// </summary>
++++ public class Dummy {}
++++
++++ /// <summary>
++++ /// comment for delegate type
++++ /// </summary>
++++ public delegate void MyDelegate (object o, EventArgs e);
++++
++++ /// <summary>
++++ /// description for class Test
++++ /// </summary>
++++ public class Test
++++ {
++++ /// comment for const declaration
++++ const string Constant = "CONSTANT STRING";
++++
++++ /// comment for public field
++++ public string BadPublicField;
++++
++++ /// comment for private field
++++ private string PrivateField;
++++
++++ /// comment for public property
++++ public string PublicProperty {
++++ /// comment for private property getter
++++ get { return null; }
++++ }
++++
++++ /// comment for private property
++++ private string PrivateProperty {
++++ get { return null; }
++++ /// comment for private property setter
++++ set { }
++++ }
++++
++++ int x;
++++
++++ /// public event EventHandler MyEvent ;-)
++++ public event EventHandler MyEvent;
++++
++++ int y;
++++
++++ /// here is a documentation!!!
++++ public static void Foo ()
++++ {
++++ }
++++
++++ /// here is a documentation with parameters
++++ public static void Foo (long l, Test t, System.Collections.ArrayList al)
++++ {
++++ }
++++
++++ /// comment for indexer
++++ public string this [int i] {
++++ get { return null; }
++++ }
++++
++++ /// comment for indexer wit multiple parameters
++++ public string this [int i, Test t] {
++++ get { return null; }
++++ }
++++
++++ /// <summary>
++++ /// comment for unary operator
++++ /// </summary>
++++ public static bool operator ! (Test t)
++++ {
++++ return false;
++++ }
++++
++++ /// <summary>
++++ /// comment for binary operator
++++ /// </summary>
++++ public static int operator + (Test t, int b)
++++ {
++++ return b;
++++ }
++++
++++ /// comment for destructor
++++ ~Test ()
++++ {
++++ }
++++
++++ /// comment for .ctor()
++++ public Test ()
++++ {
++++ }
++++
++++ /// comment for .ctor(string arg, string [] args)
++++ public Test (string arg, string [] args)
++++ {
++++ }
++++
++++ /// comment for internal class
++++ public class InternalClass
++++ {
++++ }
++++
++++ /// comment for internal struct
++++ public struct InternalStruct
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-023</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="M:Test.Foo(Test.A,System.Int32)">\r
++++ here is a documentation
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-023.xml
++++ public class Test
++++ {
++++ public class A {}
++++
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// here is a documentation
++++ public static void Foo (A a, int x)
++++ {
++++ }
++++ }
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-024</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Testing.Test">\r
++++ <!-- Include tag is invalid --><include/>\r
++++ </member>\r
++++ <member name="M:Testing.Test.Main">\r
++++ <!-- Include tag is invalid --><include file="a"/>\r
++++ </member>\r
++++ <member name="M:Testing.Test.Bar(System.Int32)">\r
++++ <!-- Include tag is invalid --><include path="/foo/bar"/>\r
++++ </member>\r
++++ <member name="M:Testing.Test.Baz(System.Int32)">\r
++++ <!-- Badly formed XML file "c:\cygwin\home\_\cvs\mcs\tests\there-is-no-such-file" cannot be included -->\r
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-024.xml
++++
++++namespace Testing
++++{
++++ /// <include/>
++++ public class Test
++++ {
++++ // warning
++++ /// <include file='a' />
++++ public static void Main ()
++++ {
++++ }
++++
++++ // warning
++++ /// <include path='/foo/bar' />
++++ public void Bar (int x)
++++ {
++++ }
++++
++++ // warning
++++ /// <include file='there-is-no-such-file' path='/foo/bar' />
++++ public void Baz (int x)
++++ {
++++ }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-025</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Testing.Test">\r
++++ <!-- No matching elements were found for the following include tag --><include file="test-xml-025.inc" path="/foo"/>\r
++++ </member>\r
++++ <member name="F:Testing.Test.S1">\r
++++ <root attr="is attribute allowed?">\r
++++ includes XML markup.\r
++++ <child>test</child>\r
++++ <child>test2</child>\r
++++</root>\r
++++ </member>\r
++++ <member name="F:Testing.Test.S2">\r
++++ <child>test</child><child>test2</child>\r
++++ </member>\r
++++ <member name="F:Testing.Test.S3">\r
++++ <!-- Failed to insert some or all of included XML -->\r
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-025.xml
++++
++++namespace Testing
++++{
++++ /// <include file='test-xml-025.inc' path='/foo' />
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// <include file='test-xml-025.inc' path='/root'/>
++++ public string S1;
++++
++++ /// <include file='test-xml-025.inc' path='/root/child'/>
++++ public string S2;
++++
++++ /// <include file='test-xml-025.inc' path='/root/@attr'/>
++++ public string S3;
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<root attr='is attribute allowed?'>
++++ includes XML markup.
++++ <child>test</child>
++++ <child>test2</child>
++++</root>
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-026</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Testing.Test">\r
++++ test class
++++ </member>\r
++++ <member name="M:Testing.Test.Foo(System.Int32)">\r
++++ <param>anonymous</param>
++++ </member>\r
++++ <member name="M:Testing.Test.Bar(System.Int32)">\r
++++ <param name='i'>correct</param>
++++ <param name='i'>duplicate</param>
++++ </member>\r
++++ <member name="M:Testing.Test.Baz(System.Int32)">\r
++++ <param name='mismatch'>mismatch</param>
++++ </member>\r
++++ <member name="M:Testing.Test.Var(System.Int32[])">\r
++++ <param name='arr'>varargs</param>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-026.xml
++++namespace Testing
++++{
++++ /// test class
++++ public class Test
++++ {
++++ public static void Main ()
++++ {
++++ }
++++
++++ /// <param>anonymous</param>
++++ public void Foo (int i) {}
++++
++++ /// <param name='i'>correct</param>
++++ /// <param name='i'>duplicate</param>
++++ public void Bar (int i) {}
++++
++++ /// <param name='mismatch'>mismatch</param>
++++ public void Baz (int i) {}
++++
++++ /// <param name='arr'>varargs</param>
++++ public void Var (params int [] arr) {}
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-027</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Testing.Test">\r
++++ <summary>\r
++++ <see/>\r
++++ <see cref="!:!!!!!"/>\r
++++ <see cref="!:nonexist"/>\r
++++ <see cref="T:Testing.Test"/>\r
++++ <see cref="T:Testing.Test"/>\r
++++ <see cref="T:Test"/>\r
++++ <see cref="_:Test"/>\r
++++ <see cref="P:Bar"/>\r
++++ <see cref="F:Bar"/>\r
++++ <see cref="F:Testing.Test.Bar"/>\r
++++ <see cref="P:Baz"/>\r
++++ <see cref="F:Baz"/>\r
++++ <see cref="P:Testing.Test.Baz"/>\r
++++ <see cref="!:nonexist.Foo()"/>\r
++++ <see cref="M:Testing.Test.Foo"/>\r
++++ <see cref="M:Testing.Test.Foo"/>\r
++++ <see cref="!:Test.Bar()"/>\r
++++ <see cref="!:Test.Foo(System.Int32)"/>\r
++++ </summary>\r
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-027.xml
++++using ZZZ = Testing.Test;
++++
++++namespace Testing
++++{
++++ /// <summary>
++++ /// <see />
++++ /// <see cref='!!!!!' />
++++ /// <see cref='nonexist' />
++++ /// <see cref='Test' />
++++ /// <see cref='ZZZ' />
++++ /// <see cref='T:Test' />
++++ /// <see cref='_:Test' />
++++ /// <see cref='P:Bar' />
++++ /// <see cref='F:Bar' />
++++ /// <see cref='Bar' />
++++ /// <see cref='P:Baz' />
++++ /// <see cref='F:Baz' />
++++ /// <see cref='Baz' />
++++ /// <see cref='nonexist.Foo()' />
++++ /// <see cref='Test.Foo()' />
++++ /// <see cref='ZZZ.Foo()' />
++++ /// <see cref='Test.Bar()' />
++++ /// <see cref='Test.Foo(System.Int32)' />
++++ /// </summary>
++++ class Test
++++ {
++++ public static void Main () { System.Console.Error.WriteLine ("xml-027 is running fine ;-)"); }
++++
++++ // I don't put any documentation here, but cref still works.
++++ public void Foo () {}
++++
++++ public string Bar;
++++
++++ public string Baz { get { return ""; } }
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-028</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Test">\r
++++ <summary>\r
++++ Partial comment #2\r
++++ Partial comment #1\r
++++ </summary>\r
++++ </member>\r
++++ <member name="T:Test.Inner">\r
++++ <summary>\r
++++ Partial inner class!\r
++++ ... is still available.\r
++++ </summary>\r
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-028.xml
++++using System;
++++
++++/// <summary>
++++/// Partial comment #2
++++public partial class Test
++++{
++++ string Bar;
++++
++++ public static void Main () {}
++++
++++ /// <summary>
++++ /// Partial inner class!
++++ internal partial class Inner
++++ {
++++ public string Hoge;
++++ }
++++}
++++
++++/// Partial comment #1
++++/// </summary>
++++public partial class Test
++++{
++++ public string Foo;
++++
++++ /// ... is still available.
++++ /// </summary>
++++ internal partial class Inner
++++ {
++++ string Fuga;
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-029</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="M:Test1.Foo">\r
++++ <summary>
++++ Some test documentation
++++ </summary>
++++ </member>\r
++++ <member name="T:ITest2">\r
++++ <summary>
++++ Publicly available interface
++++ </summary>
++++ </member>\r
++++ <member name="M:ITest2.Foo">\r
++++ <summary>
++++ Some test documentation
++++ </summary>
++++ </member>\r
++++ <member name="P:ITest2.Bar">\r
++++ <summary>
++++ Some test documentation
++++ </summary>
++++ </member>\r
++++ <member name="E:ITest2.EventRaised">\r
++++ <summary>
++++ Some test documentation
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-029.xml
++++using System;
++++
++++class Test1 {
++++ /// <summary>
++++ /// Some test documentation
++++ /// </summary>
++++ void Foo(){}
++++
++++ public static void Main () {}
++++}
++++
++++/// <summary>
++++/// Publicly available interface
++++/// </summary>
++++public interface ITest2 {
++++
++++ /// <summary>
++++ /// Some test documentation
++++ /// </summary>
++++ void Foo();
++++
++++ /// <summary>
++++ /// Some test documentation
++++ /// </summary>
++++ long Bar { get; }
++++
++++ /// <summary>
++++ /// Some test documentation
++++ /// </summary>
++++ event EventHandler EventRaised;
++++}
++++
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-030</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="M:Test.foo2">\r
++++ <summary>\r
++++ some summary\r
++++ </summary>\r
++++ <value>\r
++++ <see cref="T:Test[]"/>\r
++++ <see cref="T:System.Text.RegularExpressions.Regex"/>\r
++++ <see cref="T:System.Text.RegularExpressions.Regex"/>\r
++++ <see cref="N:System.Text.RegularExpressions"/>\r
++++ <see cref="T:System.Text.RegularExpressions.Regex[]"/>\r
++++ </value>\r
++++ </member>\r
++++ <member name="M:Test.foo3(System.String,System.Object[])">\r
++++ <summary>\r
++++ <see cref="M:System.String.Format(System.String,System.Object[])"/>.\r
++++ <see cref="M:System.String.Format(System.String,System.Object[])"/>.\r
++++ <see cref="M:System.String.Format(System.String,System.Object[])"/>.\r
++++ <see cref="M:System.String.Format(System.String,System.Object[])"/>.\r
++++ </summary>\r
++++ <param name="line">The formatting string.</param>\r
++++ <param name="args">The object array to write into format string.</param>\r
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-030.xml -warn:4 -warnaserror
++++using System;
++++
++++class Test
++++{
++++ static void Main () {}
++++
++++ /// <summary>
++++ /// some summary
++++ /// </summary>
++++ /// <value>
++++ /// <see cref="T:Test[]"/>
++++ /// <see cref="T:System.Text.RegularExpressions.Regex"/>
++++ /// <see cref="System.Text.RegularExpressions.Regex"/>
++++ /// <see cref="System.Text.RegularExpressions"/>
++++ /// <see cref="T:System.Text.RegularExpressions.Regex[]"/>
++++ /// </value>
++++ //
++++ // <see cref="T:System.Text.RegularExpressions"/> .. csc incorrectly allows it
++++ // <see cref="System.Text.RegularExpressions.Regex[]"/> ... csc does not allow it.
++++ //
++++ public void foo2() {
++++ }
++++
++++ /// <summary>
++++ /// <see cref="String.Format(string, object[])" />.
++++ /// <see cref="string.Format(string, object[])" />.
++++ /// <see cref="String.Format(string, object [ ])" />.
++++ /// <see cref="string.Format(string, object [ ])" />.
++++ /// </summary>
++++ /// <param name="line">The formatting string.</param>
++++ /// <param name="args">The object array to write into format string.</param>
++++ public void foo3(string line, params object[] args) {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-031</name>\r
++++ </assembly>\r
++++ <members>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-031.xml -warn:4 -warnaserror
++++//// Some comment
++++////how about this line?
++++using System;
++++using System.IO;
++++
++++class Test
++++{
++++ public static void Main ()
++++ {
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-032</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="M:Test.#ctor(System.String)">\r
++++ <exception cref="T:System.ArgumentNullException"><paramref name="wrongref"/> is <see langword="null"/>.</exception>\r
++++ <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="wrongRefAgain"/> is a zero-length <see cref="T:System.String"/>.</exception>\r
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-032.xml -warn:4 -warnaserror
++++using System;
++++
++++class Test
++++{
++++ /// <exception cref="ArgumentNullException"><paramref name="wrongref" /> is <see langword="null" />.</exception>
++++ /// <exception cref="ArgumentOutOfRangeException"><paramref name="wrongRefAgain" /> is a zero-length <see cref="string" />.</exception>
++++ protected Test(string name)
++++ {
++++ }
++++
++++ static void Main () {}
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-033</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:MyClass">\r
++++ <summary>help text</summary>
++++ </member>\r
++++ <member name="M:MyClass.Main">\r
++++ <summary>help text</summary>
++++ </member>\r
++++ <member name="M:MyClass.op_Explicit(MyClass)~System.Int32">\r
++++ <summary>help text</summary>
++++ </member>\r
++++ <member name="M:MyClass.op_Implicit(MyClass)~System.Char">\r
++++ <summary>help text</summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-033.xml
++++
++++/// <summary>help text</summary>
++++public class MyClass
++++{
++++ /// <summary>help text</summary>
++++ public static void Main()
++++ {
++++ }
++++
++++ /// <summary>help text</summary>
++++ public static explicit operator int(MyClass f)
++++ {
++++ return 0;
++++ }
++++
++++ /// <summary>help text</summary>
++++ public static implicit operator char(MyClass f)
++++ {
++++ return ' ';
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-034</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Test">\r
++++ valid comment.
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-034.xml -warn:4 -warnaserror
++++using System;
++++
++++/// valid comment.
++++public class Test
++++{
++++ static void Main ()
++++ {
++++ }
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-035</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Test">\r
++++ <summary>\r
++++ <see cref="M:System.Data.DataSet.ReadXml(System.Xml.XmlReader,System.Data.XmlReadMode)"/>\r
++++ <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)"/>\r
++++ </summary>\r
++++ </member>\r
++++ <member name="M:Test.Main">\r
++++ <summary>\r
++++ <see cref="T:System.Environment.SpecialFolder"/>\r
++++ </summary>\r
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-035.xml -warn:4 -warnaserror -r:System.Data
++++using System;
++++using System.Data;
++++using System.Xml;
++++
++++/// <summary>
++++/// <see cref="DataSet.ReadXml(XmlReader,XmlReadMode)" />
++++/// <see cref="Environment.GetFolderPath(Environment.SpecialFolder)" />
++++/// </summary>
++++public class Test {
++++ /// <summary>
++++ /// <see cref="Environment.SpecialFolder" />
++++ /// </summary>
++++ public static void Main() {
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-036</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Test">\r
++++ <summary><see cref="F:Test.true"/>, <see cref="F:Test.true"/>, <see cref="F:Test.Whatever"/></summary>\r
++++ </member>\r
++++ <member name="F:Test.true">\r
++++ <summary>Yes</summary>\r
++++ </member>\r
++++ <member name="F:Test.false">\r
++++ <summary>Nope</summary>\r
++++ </member>\r
++++ <member name="F:Test.Whatever">\r
++++ <summary>Maybe</summary>\r
++++ </member>\r
++++ <member name="T:Foo">\r
++++ <summary><see cref="M:Foo.true"/></summary>\r
++++ </member>\r
++++ <member name="M:Foo.true">\r
++++ <summary>Foo</summary>\r
++++ </member>\r
++++ <member name="M:Foo.Main">\r
++++ main.\r
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-036.xml -warn:1 -warnaserror
++++/// <summary><see cref="@true" />, <see cref="Test.@true" />, <see cref="@Whatever" /></summary>
++++public enum Test {
++++ /// <summary>Yes</summary>
++++ @true,
++++ /// <summary>Nope</summary>
++++ @false,
++++ /// <summary>Maybe</summary>
++++ Whatever
++++}
++++
++++/// <summary><see cref="Foo.@true" /></summary>
++++public abstract class Foo {
++++ /// <summary>Foo</summary>
++++ public abstract void @true();
++++ /// main.
++++ public static void Main() {}
++++}
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-037</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Whatever">\r
++++ <summary>\r
++++ <see cref="E:System.AppDomain.AssemblyResolve"/>\r
++++ </summary>\r
++++ </member>\r
++++ <member name="M:Whatever.Main">\r
++++ <summary>
++++ </summary>
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-037.xml
++++using System;
++++using System.Reflection;
++++
++++/// <summary>
++++/// <see cref="AppDomain.AssemblyResolve" />
++++/// </summary>
++++public class Whatever {
++++ /// <summary>
++++ /// </summary>
++++ public static void Main() {
++++ foreach (MemberInfo mi in typeof (AppDomain).FindMembers (
++++ MemberTypes.All,
++++ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance,
++++ Type.FilterName,
++++ "AssemblyResolve"))
++++ Console.WriteLine (mi.GetType ());
++++ }
++++}
++++
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++<?xml version="1.0"?>\r
++++<doc>\r
++++ <assembly>\r
++++ <name>test-xml-038</name>\r
++++ </assembly>\r
++++ <members>\r
++++ <member name="T:Whatever">\r
++++ <summary>\r
++++ <see cref="E:System.AppDomain.AssemblyResolve"/>\r
++++ </summary>\r
++++ </member>\r
++++ <member name="M:Whatever.Main">\r
++++ <summary>\r
++++ </summary>\r
++++ </member>\r
++++ </members>\r
++++</doc>\r
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
++++// Compiler options: -doc:xml-038.xml
++++using System;
++++using System.Reflection;
++++using System.Xml;
++++
++++/// <summary>
++++/// <see cref="AppDomain.AssemblyResolve" />
++++/// </summary>
++++public class Whatever {
++++ /// <summary>
++++ /// </summary>
++++ public static void Main() {
++++ foreach (MemberInfo mi in typeof (XmlDocument).FindMembers (
++++ MemberTypes.All,
++++ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance,
++++ Type.FilterName,
++++ "NodeInserted"))
++++ Console.WriteLine (mi.GetType ());
++++ }
++++}
++++
+++ /dev/null
----class t {
----
---- void a ()
---- {
---- int b;
----
---- try {
---- b = 1;
---- } catch {
---- b = 2;
---- }
---- }
----
---- void b ()
---- {
---- int a;
----
---- try {
---- a = 1;
---- } catch (Exception) {
---- a = 2;
---- }
---- }
----
---- void c ()
---- {
---- int a;
----
---- try {
---- a = 2;
---- } catch (Exception e) {
---- a = 0x3;
---- } catch {
---- a = 0x1;
---- }
---- }
----
---- void d ()
---- {
---- int a;
----
---- try {
---- a = 2;
---- } catch (Exception e) {
---- a = 0x3;
---- } catch {
---- a = 0x1;
---- } finally {
---- a = 111;
---- }
---- }
----}
----
+++ /dev/null
----// Compiler options: -unsafe
----
----//
----// Tests unsafe operators. address-of, dereference, member access
----//
----using System;
----
----unsafe struct Y {
---- public int a;
---- public int s;
----}
----
----unsafe class X {
---- static int TestDereference ()
---- {
---- Y y;
---- Y *z;
---- Y a;
----
---- z = &y;
---- y.a = 1;
---- y.s = 2;
----
---- a.a = z->a;
---- a.s = z->s;
----
---- if (a.a != y.a)
---- return 1;
---- if (a.s != y.s)
---- return 2;
----
---- return 0;
---- }
----
---- static int TestPtrAdd ()
---- {
---- int [] a = new int [10];
---- int i;
----
---- for (i = 0; i < 10; i++)
---- a [i] = i;
----
---- i = 0;
---- fixed (int *b = &a [0]){
---- int *p = b;
----
---- for (i = 0; i < 10; i++){
---- if (*p != a [i])
---- return 10+i;
---- p++;
---- }
---- }
---- return 0;
---- }
----
---- static int i = 1;
---- static char c = 'a';
---- static long l = 123;
---- static double d = 1.2;
---- static float f = 1.3F;
---- static short s = 4;
----
---- static int TestPtrAssign ()
---- {
----
---- fixed (int *ii = &i){
---- *ii = 10;
---- }
----
---- fixed (char *cc = &c){
---- *cc = 'b';
---- }
----
---- fixed (long *ll = &l){
---- *ll = 100;
---- }
----
---- fixed (double *dd = &d){
---- *dd = 3.0;
---- }
----
---- fixed (float *ff = &f){
---- *ff = 1.2F;
---- }
----
---- fixed (short *ss = &s){
---- *ss = 102;
---- }
----
---- if (i != 10)
---- return 100;
---- if (c != 'b')
---- return 101;
---- if (l != 100)
---- return 102;
---- if (d != 3.0)
---- return 103;
---- if (f != 1.2F)
---- return 104;
---- if (s != 102)
---- return 105;
---- return 0;
---- }
----
---- static int TestPtrArithmetic ()
---- {
---- char [] array = new char [10];
---- char *pb;
----
---- array [5] = 'j';
---- fixed (char *pa = array){
---- pb = pa + 1;
----
----
---- //
---- // This one tests pointer element access
---- //
---- if (pa [5] != 'j')
---- return 199;
----
---- Console.WriteLine ("V: " + (pb - pa));
---- if ((pb - pa) != 1)
---- return 200;
----
---- pb++;
----
---- if (pb == pa)
---- return 201;
---- if (pb < pa)
---- return 202;
---- if (pa > pb)
---- return 203;
---- if (pa >= pb)
---- return 204;
---- if (pb <= pa)
---- return 205;
---- pb = pb - 2;
---- if (pb != pa){
---- Console.WriteLine ("VV: " + (pb - pa));
---- return 206;
---- }
---- }
----
---- return 0;
---- }
----
---- static int TestMultiple ()
---- {
---- char [] array = new char [10];
---- int count = 0;
----
---- fixed (char *pa = array, pb = array){
---- count++;
---- }
---- if (count != 1)
---- return 300;
---- return 0;
---- }
----
---- static int Main ()
---- {
---- int v;
----
---- if ((v = TestDereference ()) != 0)
---- return v;
----
---- if ((v = TestPtrAdd ()) != 0)
---- return v;
----
---- if ((v = TestPtrAssign ()) != 0)
---- return v;
----
---- if ((v = TestPtrArithmetic ()) != 0)
---- return v;
----
---- if ((v = TestMultiple ()) != 0)
---- return v;
----
---- Console.WriteLine ("Ok");
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -unsafe
----
----using System;
----
----unsafe class X {
---- static int Main () {
---- int y = 20;
---- byte* x = (byte*)0;
---- x += (long)y;
---- // x == 20;
---- return (int)x - 20 * sizeof (byte);
---- }
----}
+++ /dev/null
----// Compiler options: -unsafe
----
----//
----// This test excercises stackalloc, some pointer arithmetic,
----// and dereferences
----//
----using System;
----unsafe class X {
---- static int Main ()
---- {
---- char *ptr = stackalloc char [10];
---- char *cptr = ptr;
---- int i;
---- long l = 0;
---- ulong ul = 0;
---- byte b = 0;
----
---- for (i = 0; i < 10; i++)
---- ptr [i] = (char) (i + 10);
----
---- for (i = 0; i < 10; i++){
---- if (*ptr != (char) (i + 10))
---- return 200 + i;
---- ptr++;
---- }
----
----
---- // Now test index access with longs
---- if (cptr [l] != 10){
---- return 1;
---- }
---- if (cptr [ul] != 10)
---- return 2;
---- if (cptr [b] != 10)
---- return 3;
----
---- //
---- // Try to compile non-int values
---- //
---- byte* bptr = (byte*) 5;
---- ushort us = 3;
---- byte* ret = (byte*) (bptr + us);
----
---- Console.WriteLine ("Ok");
---- return 0;
---- }
----}
----
----
+++ /dev/null
----// Compiler options: -unsafe
----
----// this tests making a pointer to a pointer
----
----using System;
----
----unsafe class Foo
----{
---- public static int Main ()
---- {
---- int a;
---- int *b;
---- int **c;
----
---- a = 42;
---- b = &a;
---- c = &b;
----
---- Console.WriteLine ("*c == b : {0}", *c == b);
---- Console.WriteLine ("**c == a : {0}", **c == a);
----
---- if (*c == b && **c == a)
---- {
---- Console.WriteLine ("Test passed");
---- return 0;
---- }
---- else
---- {
---- Console.WriteLine ("Test failed");
---- return 1;
---- }
---- }
----}
+++ /dev/null
----// Compiler options: -unsafe
----
----unsafe class X {
---- static int v;
---- static int v_calls;
----
---- static int* get_v ()
---- {
---- v_calls++;
---- return &v;
---- }
----
---- static int Main ()
---- {
---- if ((*get_v ())++ != 0)
---- return 1;
---- if (v != 1)
---- return 2;
---- if (v_calls != 1)
---- return 3;
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -unsafe
----
----using System;
----
----namespace testapp{
---- public unsafe class LibTestAPI{
----
---- struct LibTestStruct{
---- void* pData;
---- void* pTest1;
---- }
----
---- LibTestStruct* the_struct;
----
---- public void Create(){
---- IntPtr MyPtr = new IntPtr(0); // Usually created elsewhere
---- the_struct = (LibTestStruct *) 0; // error CS1002
---- }
---- }
----
---- class TestApp{
---- static void Main(string[] args){
---- LibTestAPI myapi = new LibTestAPI();
---- myapi.Create();
---- }
---- }
----}
----
+++ /dev/null
----// Compiler options: -unsafe
----
----//
----// This tests excercises the compound assignment when the left side
----// is an dereference operator.
----//
----using System;
----namespace TestCase {
---- public unsafe class Test {
---- static int Main(string[] args) {
---- uint[] uArr = {0, 200};
---- uint[] uArr2 = {0, 200};
----
---- fixed (uint* u = uArr, u2 = uArr2) {
---- if (DoOp (u) != 100)
---- return 1;
----
---- if (uArr [0] != 100)
---- return 2;
----
---- if (uArr [1] != 200)
---- return 3;
----
---- if (DoOp2 (u2) != 100)
---- return 4;
----
---- if (uArr2 [0] != 100)
---- return 5;
----
---- if (uArr2 [1] != 200)
---- return 6;
---- }
----
---- return 0;
---- }
----
---- private static uint DoOp (uint *u) {
---- return *(u) += 100;
---- }
----
---- private static uint DoOp2 (uint *u) {
---- *(u) += 100;
---- return *u;
---- }
----
---- }
----}
----
+++ /dev/null
----// Compiler options: -unsafe
----
----struct Obsolete {
---- int a;
----}
----struct A {
---- int a, b;
----}
----
----class MainClass {
---- unsafe public static void Main ()
---- {
---- System.Console.WriteLine (sizeof (Obsolete));
---- }
----}
----
----
+++ /dev/null
----// Compiler options: -unsafe
----
----unsafe class T {
---- static int Main () {
---- int len = 10;
---- int* x = stackalloc int [len];
---- return x [0];
---- }
----}
+++ /dev/null
----// Compiler options: -unsafe
----
----//
----// Test for http://bugzilla.ximian.com/show_bug.cgi?id=62263
----//
----// We need to make sure that pointer arth uses the size of X
----// not the size of X*
----//
----
----using System;
----unsafe struct X {
---- int x, y, z;
----
---- static int Main ()
---- {
---- X* foo = null;
----
---- if ((int) (foo + 1) != sizeof (X))
---- return 1;
---- return 0;
---- }
----}
+++ /dev/null
----// Compiler options: -t:library
----
----using System;
----
----public struct Result {
---- public int res;
---- // big enough that it won't be returned in registers
---- double duh;
---- long bah;
----
---- public Result (int val) {
---- res = val;
---- bah = val;
---- duh = val;
---- }
----}
----
----public class Vararg
----{
---- public static int AddABunchOfInts (__arglist)
---- {
---- int result = 0;
----
---- System.ArgIterator iter = new System.ArgIterator (__arglist);
---- int argCount = iter.GetRemainingCount();
----
---- for (int i = 0; i < argCount; i++) {
---- System.TypedReference typedRef = iter.GetNextArg();
---- result += (int)TypedReference.ToObject( typedRef );
---- }
----
---- return result;
---- }
----
---- public static int AddASecondBunchOfInts (int a, __arglist)
---- {
---- int result = 0;
----
---- System.ArgIterator iter = new System.ArgIterator (__arglist);
---- int argCount = iter.GetRemainingCount();
----
---- for (int i = 0; i < argCount; i++) {
---- System.TypedReference typedRef = iter.GetNextArg();
---- result += (int)TypedReference.ToObject( typedRef );
---- }
----
---- return result;
---- }
----
---- public static Result VtAddABunchOfInts (__arglist)
---- {
---- int result = 0;
----
---- System.ArgIterator iter = new System.ArgIterator (__arglist);
---- int argCount = iter.GetRemainingCount();
----
---- for (int i = 0; i < argCount; i++) {
---- System.TypedReference typedRef = iter.GetNextArg();
---- result += (int)TypedReference.ToObject( typedRef );
---- }
----
---- return new Result (result);
---- }
----
---- public static Result VtAddASecondBunchOfInts (int a, __arglist)
---- {
---- int result = 0;
----
---- System.ArgIterator iter = new System.ArgIterator (__arglist);
---- int argCount = iter.GetRemainingCount();
----
---- for (int i = 0; i < argCount; i++) {
---- System.TypedReference typedRef = iter.GetNextArg();
---- result += (int)TypedReference.ToObject( typedRef );
---- }
----
---- return new Result (result);
---- }
----
---- public int InstAddABunchOfInts (__arglist)
---- {
---- int result = 0;
----
---- System.ArgIterator iter = new System.ArgIterator (__arglist);
---- int argCount = iter.GetRemainingCount();
----
---- for (int i = 0; i < argCount; i++) {
---- System.TypedReference typedRef = iter.GetNextArg();
---- result += (int)TypedReference.ToObject( typedRef );
---- }
----
---- return result;
---- }
----
---- public int InstAddASecondBunchOfInts (int a, __arglist)
---- {
---- int result = 0;
----
---- System.ArgIterator iter = new System.ArgIterator (__arglist);
---- int argCount = iter.GetRemainingCount();
----
---- for (int i = 0; i < argCount; i++) {
---- System.TypedReference typedRef = iter.GetNextArg();
---- result += (int)TypedReference.ToObject( typedRef );
---- }
----
---- return result;
---- }
----
---- public Result InstVtAddABunchOfInts (__arglist)
---- {
---- int result = 0;
----
---- System.ArgIterator iter = new System.ArgIterator (__arglist);
---- int argCount = iter.GetRemainingCount();
----
---- for (int i = 0; i < argCount; i++) {
---- System.TypedReference typedRef = iter.GetNextArg();
---- result += (int)TypedReference.ToObject( typedRef );
---- }
----
---- return new Result (result);
---- }
----
---- public Result InstVtAddASecondBunchOfInts (int a, __arglist)
---- {
---- int result = 0;
----
---- System.ArgIterator iter = new System.ArgIterator (__arglist);
---- int argCount = iter.GetRemainingCount();
----
---- for (int i = 0; i < argCount; i++) {
---- System.TypedReference typedRef = iter.GetNextArg();
---- result += (int)TypedReference.ToObject( typedRef );
---- }
----
---- return new Result (result);
---- }
----}
+++ /dev/null
----// Compiler options: -r:vararg-dll.dll
----
----using System;
----
----class TestVararg
----{
---- static int Main ()
---- {
---- int result = Vararg.AddABunchOfInts (__arglist ( 2, 3, 4 ));
---- Console.WriteLine ("Answer: {0}", result);
----
---- if (result != 9)
---- return 1;
----
---- result = Vararg.AddASecondBunchOfInts (16, __arglist ( 2, 3, 4 ));
---- Console.WriteLine ("Answer: {0}", result);
----
---- if (result != 9)
---- return 2;
----
---- Vararg s = new Vararg ();
----
---- result = s.InstAddABunchOfInts (__arglist ( 2, 3, 4, 5 ));
---- Console.WriteLine ("Answer: {0}", result);
----
---- if (result != 14)
---- return 3;
----
---- result = s.InstAddASecondBunchOfInts (16, __arglist ( 2, 3, 4, 5, 6 ));
---- Console.WriteLine ("Answer: {0}", result);
----
---- if (result != 20)
---- return 4;
----
---- result = s.InstVtAddABunchOfInts (__arglist ( 2, 3, 4, 5 )).res;
---- Console.WriteLine ("Answer: {0}", result);
----
---- if (result != 14)
---- return 5;
----
---- result = s.InstVtAddASecondBunchOfInts (16, __arglist ( 2, 3, 4, 5, 6 )).res;
---- Console.WriteLine ("Answer: {0}", result);
----
---- if (result != 20)
---- return 6;
----
---- result = Vararg.VtAddABunchOfInts (__arglist ( 2, 3, 4, 5, 1 )).res;
---- Console.WriteLine ("Answer: {0}", result);
----
---- if (result != 15)
---- return 7;
----
---- result = Vararg.VtAddASecondBunchOfInts (16, __arglist ( 2, 3, 4, 5, 6, 1 )).res;
---- Console.WriteLine ("Answer: {0}", result);
----
---- if (result != 21)
---- return 8;
----
---- return 0;
---- }
----}
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-001</name>\r
---- </assembly>\r
---- <members>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-001.xml
----using System;
----
----/// <summary>
----/// xml comment on namespace ... is not allowed.
----/// </summary>
----namespace Testing
----{
---- public class A
---- {
---- public static void Main ()
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-002</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Testing.Test">\r
---- <summary>
---- comment on class
---- </summary>
---- </member>\r
---- <!-- Badly formed XML comment ignored for member "T:Testing.Test2" -->\r
---- <member name="T:Testing.Test3">\r
---- <summary>
---- another Java-style documentation style
---- </summary>
---- </member>\r
---- <member name="T:Testing.Test4">\r
---- indentation level test <seealso
---- cref="T:Testing.Test" />.
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-002.xml
----using System;
----
----namespace Testing
----{
---- /// <summary>
---- /// comment on class
---- /// </summary>
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
---- }
----
---- /// <summary>
---- /// Incorrect comment markup. See <see cref="T:Testing.Test" /> too.
---- /// </incorrect>
---- public class Test2
---- {
---- }
----
---- /**
---- <summary>
---- another Java-style documentation style
---- </summary>
---- */
---- public class Test3
---- {
---- }
----
---- /// indentation level test <seealso
---- /// cref="T:Testing.Test" />.
----public class Test4
----{
----}
----
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-003</name>\r
---- </assembly>\r
---- <members>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-003.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- /// here is an extraneous comment
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-004</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Testing.StructTest">\r
---- <summary>
---- comment for struct
---- </summary>
---- </member>\r
---- <!-- Badly formed XML comment ignored for member "T:Testing.StructTest2" -->\r
---- <member name="T:Testing.StructTest3">\r
---- <summary>
---- Java style commet
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-004.xml
----using System;
----
----namespace Testing
----{
---- /// <summary>
---- /// comment for struct
---- /// </summary>
---- public struct StructTest
---- {
---- }
----
---- /// <summary>
---- /// incorrect markup comment for struct
---- /// </incorrect>
---- public struct StructTest2
---- {
---- }
----
---- /**
---- <summary>
---- Java style commet
---- </summary>
---- */
---- public struct StructTest3
---- {
---- }
----
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-005</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Testing.InterfaceTest">\r
---- <summary>
---- comment for interface
---- </summary>
---- </member>\r
---- <!-- Badly formed XML comment ignored for member "T:Testing.InterfaceTest2" -->\r
---- <member name="T:Testing.InterfaceTest3">\r
---- <summary>
---- Java style comment for interface
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-005.xml
----using System;
----
----namespace Testing
----{
---- /// <summary>
---- /// comment for interface
---- /// </summary>
---- public interface InterfaceTest
---- {
---- }
----
---- /// <summary>
---- /// incorrect markup comment for interface
---- /// </incorrect>
---- public interface InterfaceTest2
---- {
---- }
----
---- /**
---- <summary>
---- Java style comment for interface
---- </summary>
---- */
---- public interface InterfaceTest3
---- {
---- }
----
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-006</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Testing.EnumTest">\r
---- <summary>
---- comment for enum type
---- </summary>
---- </member>\r
---- <!-- Badly formed XML comment ignored for member "T:Testing.EnumTest2" -->\r
---- <member name="T:Testing.EnumTest3">\r
---- <summary>
---- Java style comment for enum type
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-006.xml
----using System;
----
----namespace Testing
----{
---- /// <summary>
---- /// comment for enum type
---- /// </summary>
---- public enum EnumTest
---- {
---- Foo,
---- Bar,
---- }
----
---- /// <summary>
---- /// comment for enum type
---- /// </incorrect>
---- public enum EnumTest2
---- {
---- Foo,
---- Bar,
---- }
----
---- /**
---- <summary>
---- Java style comment for enum type
---- </summary>
---- */
---- public enum EnumTest3
---- {
---- Foo,
---- Bar,
---- }
----
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-007</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Testing.MyDelegate">\r
---- <summary>
---- comment for delegate type
---- </summary>
---- </member>\r
---- <!-- Badly formed XML comment ignored for member "T:Testing.MyDelegate2" -->\r
---- <member name="T:Testing.MyDelegate3">\r
---- <summary>
---- Javadoc comment for delegate type
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-007.xml
----using System;
----
----namespace Testing
----{
---- /// <summary>
---- /// comment for delegate type
---- /// </summary>
---- public delegate void MyDelegate (object o, EventArgs e);
----
---- /// <summary>
---- /// comment for delegate type
---- /// </incorrect>
---- public delegate void MyDelegate2 (object o, EventArgs e);
----
---- /**
---- <summary>
---- Javadoc comment for delegate type
---- </summary>
---- */
---- public delegate void MyDelegate3 (object o, EventArgs e);
----
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-008</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Testing.Test">\r
---- comment without markup on class - it is allowed
---- </member>\r
---- <!-- Badly formed XML comment ignored for member "T:Testing.Test2" -->\r
---- <!-- Badly formed XML comment ignored for member "T:Testing.Test3" -->\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-008.xml
----using System;
----
----namespace Testing
----{
---- /// comment without markup on class - it is allowed
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
---- }
----
---- /// <6roken> broken markup
---- public class Test2
---- {
---- }
----
---- /// <dont-forget-close-tag>
---- public class Test3
---- {
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-009</name>\r
---- </assembly>\r
---- <members>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-009.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- /// inside method - not allowed.
---- }
---- }
----
---- public class Test2
---- {
---- /// no target
---- }
----
---- public class Test3
---- {
---- }
---- /// no target case 2.
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-010</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="F:Testing.Test.Constant">\r
---- <summary>
---- comment for const declaration
---- </summary>
---- </member>\r
---- <!-- Badly formed XML comment ignored for member "F:Testing.Test.Constant2" -->\r
---- <member name="F:Testing.Test.Constant3">\r
---- <summary>
---- Javaism comment for const declaration
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-010.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- /// <summary>
---- /// comment for const declaration
---- /// </summary>
---- const string Constant = "CONSTANT STRING";
----
---- /// <summary>
---- /// invalid comment for const declaration
---- /// </invalid>
---- const string Constant2 = "CONSTANT STRING";
----
---- /**
---- <summary>
---- Javaism comment for const declaration
---- </summary>
---- */
---- const string Constant3 = "CONSTANT STRING";
----
---- public static void Main ()
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-011</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="F:Testing.Test.PublicField">\r
---- <summary>
---- comment for public field
---- </summary>
---- </member>\r
---- <!-- Badly formed XML comment ignored for member "F:Testing.Test.PublicField2" -->\r
---- <member name="F:Testing.Test.PublicField3">\r
---- <summary>
---- Javadoc comment for public field
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-011.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- /// <summary>
---- /// comment for public field
---- /// </summary>
---- public string PublicField;
----
---- /// <summary>
---- /// comment for public field
---- /// </invalid>
---- public string PublicField2;
----
---- /**
---- <summary>
---- Javadoc comment for public field
---- </summary>
---- */
---- public string PublicField3;
----
---- public static void Main ()
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-012</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="F:Testing.Test.PrivateField">\r
---- <summary>
---- comment for private field
---- </summary>
---- </member>\r
---- <!-- Badly formed XML comment ignored for member "F:Testing.Test.PrivateField2" -->\r
---- <member name="F:Testing.Test.PrivateField3">\r
---- <summary>
---- Javadoc comment for private field
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-012.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- /// <summary>
---- /// comment for private field
---- /// </summary>
---- private string PrivateField;
----
---- /// <summary>
---- /// incorrect markup comment for private field
---- /// </incorrect>
---- private string PrivateField2;
----
---- /**
---- <summary>
---- Javadoc comment for private field
---- </summary>
---- */
---- private string PrivateField3;
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-013</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="P:Testing.Test.PublicProperty">\r
---- <summary>
---- comment for public property
---- </summary>
---- </member>\r
---- <!-- Badly formed XML comment ignored for member "P:Testing.Test.PublicProperty2" -->\r
---- <member name="P:Testing.Test.PublicProperty3">\r
---- <summary>
---- Javadoc comment for public property
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-013.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- /// <summary>
---- /// comment for public property
---- /// </summary>
---- public string PublicProperty {
---- /// <summary>
---- /// On public getter - no effect
---- /// </summary>
---- get { return null; }
---- /// <summary>
---- /// On public setter - no effect
---- /// </summary>
---- set { }
---- }
----
---- /// <summary>
---- /// incorrect comment for public property
---- /// </incorrect>
---- public string PublicProperty2 {
---- get { return null; }
---- }
----
---- /**
---- <summary>
---- Javadoc comment for public property
---- </summary>
---- */
---- public string PublicProperty3 {
---- /**
---- <summary>
---- On public getter - no effect
---- </summary>
---- */
---- get { return null; }
---- /**
---- <summary>
---- On public setter - no effect
---- </summary>
---- */
---- set { }
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-014</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="P:Testing.Test.PrivateProperty">\r
---- <summary>
---- comment for private property
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-014.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- /// <summary>
---- /// comment for private property
---- /// </summary>
---- private string PrivateProperty {
---- get { return null; }
---- set { }
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-015</name>\r
---- </assembly>\r
---- <members>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-015.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- private string PrivateProperty {
---- get { return null; }
---- /// <summary>
---- /// comment for private property setter - no effect
---- /// </summary>
---- set { }
---- }
----
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-016</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="E:Testing.Test.MyEvent">\r
---- <summary>
---- public event EventHandler MyEvent
---- </summary>
---- </member>\r
---- <member name="E:Testing.Test.MyEvent2">\r
---- private event EventHandler MyEvent; without markup - it is OK.
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-016.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- /// <summary>
---- /// public event EventHandler MyEvent
---- /// </summary>
---- public event EventHandler MyEvent;
----
---- /// private event EventHandler MyEvent; without markup - it is OK.
---- private event EventHandler MyEvent2;
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-017</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="M:Testing.Test.Foo">\r
---- comment on method without parameter
---- </member>\r
---- <member name="M:Testing.Test.Foo(System.Int64,Testing.Test,System.Collections.ArrayList)">\r
---- here is a documentation with parameters (and has same name)
---- </member>\r
---- <member name="M:Testing.Test.Foo(System.String[])">\r
---- here is a documentation with parameters (and has same name)
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-017.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- /// comment on method without parameter
---- public static void Foo ()
---- {
---- }
----
---- /// here is a documentation with parameters (and has same name)
---- public static void Foo (long l, Test t, System.Collections.ArrayList al)
---- {
---- }
----
---- /// here is a documentation with parameters (and has same name)
---- public static void Foo (params string [] param)
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-018</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="P:Testing.Test.Item(System.Int32)">\r
---- <summary>
---- comment for indexer
---- </summary>
---- </member>\r
---- <member name="P:Testing.Test.Item(System.String)">\r
---- <summary>
---- comment for indexer
---- </summary>
---- </member>\r
---- <member name="P:Testing.Test.Item(System.Int32,Testing.Test)">\r
---- <summary>
---- comment for indexer wit multiple parameters
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-018.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- /// <summary>
---- /// comment for indexer
---- /// </summary>
---- public string this [int i] {
---- get { return null; }
---- }
----
---- /// <summary>
---- /// comment for indexer
---- /// </summary>
---- public string this [string s] {
---- get { return null; }
---- }
----
---- /// <summary>
---- /// comment for indexer wit multiple parameters
---- /// </summary>
---- public string this [int i, Test t] {
---- get { return null; }
---- }
----
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-019</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="M:Testing.Test.op_LogicalNot(Testing.Test)">\r
---- <summary>
---- comment for unary operator
---- </summary>
---- </member>\r
---- <member name="M:Testing.Test.op_Addition(Testing.Test,System.Int32)">\r
---- <summary>
---- comment for binary operator
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-019.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- /// <summary>
---- /// comment for unary operator
---- /// </summary>
---- public static bool operator ! (Test t)
---- {
---- return false;
---- }
----
---- /// <summary>
---- /// comment for binary operator
---- /// </summary>
---- public static int operator + (Test t, int b)
---- {
---- return b;
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-020</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="M:Testing.Test.#ctor">\r
---- comment for constructor
---- </member>\r
---- <member name="M:Testing.Test.Finalize">\r
---- comment for destructor
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-020.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- /// comment for constructor
---- public Test ()
---- {
---- }
----
---- /// comment for destructor
---- ~Test ()
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-021</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Testing.Test.InternalClass">\r
---- comment for internal class
---- </member>\r
---- <member name="T:Testing.Test.InternalStruct">\r
---- comment for internal struct
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-021.xml
----using System;
----
----namespace Testing
----{
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- /// comment for internal class
---- public class InternalClass
---- {
---- }
----
---- /// comment for internal struct
---- public struct InternalStruct
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-022</name>\r
---- </assembly>\r
---- <members>\r
---- <!-- Badly formed XML comment ignored for member "T:Testing.Test2" -->\r
---- <member name="M:Testing.Test2.Foo">\r
---- another documentation style (Java-mimic)
---- </member>\r
---- <member name="T:Testing.StructTest">\r
---- testing indentation <summary> test test ;-)
---- comment for struct
---- </summary>
---- </member>\r
---- <member name="T:Testing.InterfaceTest">\r
---- <summary>
---- comment for interface
---- </summary>
---- </member>\r
---- <member name="T:Testing.EnumTest">\r
---- <summary>
---- comment for enum type
---- </summary>
---- </member>\r
---- <member name="F:Testing.EnumTest.Foo">\r
---- <summary>
---- comment for enum field
---- </summary>
---- </member>\r
---- <member name="T:Testing.Dummy">\r
---- <summary>
---- comment for dummy type
---- </summary>
---- </member>\r
---- <member name="T:Testing.MyDelegate">\r
---- <summary>
---- comment for delegate type
---- </summary>
---- </member>\r
---- <member name="T:Testing.Test">\r
---- <summary>
---- description for class Test
---- </summary>
---- </member>\r
---- <member name="F:Testing.Test.Constant">\r
---- comment for const declaration
---- </member>\r
---- <member name="F:Testing.Test.BadPublicField">\r
---- comment for public field
---- </member>\r
---- <member name="F:Testing.Test.PrivateField">\r
---- comment for private field
---- </member>\r
---- <member name="M:Testing.Test.Foo">\r
---- here is a documentation!!!
---- </member>\r
---- <member name="M:Testing.Test.Foo(System.Int64,Testing.Test,System.Collections.ArrayList)">\r
---- here is a documentation with parameters
---- </member>\r
---- <member name="M:Testing.Test.op_LogicalNot(Testing.Test)">\r
---- <summary>
---- comment for unary operator
---- </summary>
---- </member>\r
---- <member name="M:Testing.Test.op_Addition(Testing.Test,System.Int32)">\r
---- <summary>
---- comment for binary operator
---- </summary>
---- </member>\r
---- <member name="M:Testing.Test.Finalize">\r
---- comment for destructor
---- </member>\r
---- <member name="M:Testing.Test.#ctor">\r
---- comment for .ctor()
---- </member>\r
---- <member name="M:Testing.Test.#ctor(System.String,System.String[])">\r
---- comment for .ctor(string arg, string [] args)
---- </member>\r
---- <member name="P:Testing.Test.PublicProperty">\r
---- comment for public property
---- </member>\r
---- <member name="P:Testing.Test.PrivateProperty">\r
---- comment for private property
---- </member>\r
---- <member name="E:Testing.Test.MyEvent">\r
---- public event EventHandler MyEvent ;-)
---- </member>\r
---- <member name="P:Testing.Test.Item(System.Int32)">\r
---- comment for indexer
---- </member>\r
---- <member name="P:Testing.Test.Item(System.Int32,Testing.Test)">\r
---- comment for indexer wit multiple parameters
---- </member>\r
---- <member name="T:Testing.Test.InternalClass">\r
---- comment for internal class
---- </member>\r
---- <member name="T:Testing.Test.InternalStruct">\r
---- comment for internal struct
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-022.xml
----//
----// Combined tests (for detecting incorrect markup targeting).
----//
----using System;
----
----/// <summary>
----/// xml comment is not allowed here.
----/// </summary>
----namespace Testing
----{
---- /// <summary>
---- /// </incorrect>
---- public class Test2
---- {
---- /**
---- another documentation style (Java-mimic)
---- */
---- public static void Foo ()
---- {
---- /// here is an extraneous comment
---- }
----
---- public static void Main ()
---- {
---- }
---- }
----
---- /// testing indentation <summary> test test ;-)
---- /// comment for struct
---- /// </summary>
---- public struct StructTest
---- {
---- }
----
---- /// <summary>
---- /// comment for interface
---- /// </summary>
---- public interface InterfaceTest
---- {
---- }
----
---- /// <summary>
---- /// comment for enum type
---- /// </summary>
---- public enum EnumTest
---- {
---- /// <summary>
---- /// comment for enum field
---- /// </summary>
---- Foo,
---- Bar,
---- }
----
---- /// <summary>
---- /// comment for dummy type
---- /// </summary>
---- public class Dummy {}
----
---- /// <summary>
---- /// comment for delegate type
---- /// </summary>
---- public delegate void MyDelegate (object o, EventArgs e);
----
---- /// <summary>
---- /// description for class Test
---- /// </summary>
---- public class Test
---- {
---- /// comment for const declaration
---- const string Constant = "CONSTANT STRING";
----
---- /// comment for public field
---- public string BadPublicField;
----
---- /// comment for private field
---- private string PrivateField;
----
---- /// comment for public property
---- public string PublicProperty {
---- /// comment for private property getter
---- get { return null; }
---- }
----
---- /// comment for private property
---- private string PrivateProperty {
---- get { return null; }
---- /// comment for private property setter
---- set { }
---- }
----
---- int x;
----
---- /// public event EventHandler MyEvent ;-)
---- public event EventHandler MyEvent;
----
---- int y;
----
---- /// here is a documentation!!!
---- public static void Foo ()
---- {
---- }
----
---- /// here is a documentation with parameters
---- public static void Foo (long l, Test t, System.Collections.ArrayList al)
---- {
---- }
----
---- /// comment for indexer
---- public string this [int i] {
---- get { return null; }
---- }
----
---- /// comment for indexer wit multiple parameters
---- public string this [int i, Test t] {
---- get { return null; }
---- }
----
---- /// <summary>
---- /// comment for unary operator
---- /// </summary>
---- public static bool operator ! (Test t)
---- {
---- return false;
---- }
----
---- /// <summary>
---- /// comment for binary operator
---- /// </summary>
---- public static int operator + (Test t, int b)
---- {
---- return b;
---- }
----
---- /// comment for destructor
---- ~Test ()
---- {
---- }
----
---- /// comment for .ctor()
---- public Test ()
---- {
---- }
----
---- /// comment for .ctor(string arg, string [] args)
---- public Test (string arg, string [] args)
---- {
---- }
----
---- /// comment for internal class
---- public class InternalClass
---- {
---- }
----
---- /// comment for internal struct
---- public struct InternalStruct
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-023</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="M:Test.Foo(Test.A,System.Int32)">\r
---- here is a documentation
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-023.xml
---- public class Test
---- {
---- public class A {}
----
---- public static void Main ()
---- {
---- }
----
---- /// here is a documentation
---- public static void Foo (A a, int x)
---- {
---- }
---- }
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-024</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Testing.Test">\r
---- <!-- Include tag is invalid --><include/>\r
---- </member>\r
---- <member name="M:Testing.Test.Main">\r
---- <!-- Include tag is invalid --><include file="a"/>\r
---- </member>\r
---- <member name="M:Testing.Test.Bar(System.Int32)">\r
---- <!-- Include tag is invalid --><include path="/foo/bar"/>\r
---- </member>\r
---- <member name="M:Testing.Test.Baz(System.Int32)">\r
---- <!-- Badly formed XML file "c:\cygwin\home\_\cvs\mcs\tests\there-is-no-such-file" cannot be included -->\r
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-024.xml
----
----namespace Testing
----{
---- /// <include/>
---- public class Test
---- {
---- // warning
---- /// <include file='a' />
---- public static void Main ()
---- {
---- }
----
---- // warning
---- /// <include path='/foo/bar' />
---- public void Bar (int x)
---- {
---- }
----
---- // warning
---- /// <include file='there-is-no-such-file' path='/foo/bar' />
---- public void Baz (int x)
---- {
---- }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-025</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Testing.Test">\r
---- <!-- No matching elements were found for the following include tag --><include file="xml-025.inc" path="/foo"/>\r
---- </member>\r
---- <member name="F:Testing.Test.S1">\r
---- <root attr="is attribute allowed?">\r
---- includes XML markup.\r
---- <child>test</child>\r
---- <child>test2</child>\r
----</root>\r
---- </member>\r
---- <member name="F:Testing.Test.S2">\r
---- <child>test</child><child>test2</child>\r
---- </member>\r
---- <member name="F:Testing.Test.S3">\r
---- <!-- Failed to insert some or all of included XML -->\r
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-025.xml
----
----namespace Testing
----{
---- /// <include file='xml-025.inc' path='/foo' />
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- /// <include file='xml-025.inc' path='/root'/>
---- public string S1;
----
---- /// <include file='xml-025.inc' path='/root/child'/>
---- public string S2;
----
---- /// <include file='xml-025.inc' path='/root/@attr'/>
---- public string S3;
---- }
----}
----
+++ /dev/null
----<root attr='is attribute allowed?'>
---- includes XML markup.
---- <child>test</child>
---- <child>test2</child>
----</root>
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-026</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Testing.Test">\r
---- test class
---- </member>\r
---- <member name="M:Testing.Test.Foo(System.Int32)">\r
---- <param>anonymous</param>
---- </member>\r
---- <member name="M:Testing.Test.Bar(System.Int32)">\r
---- <param name='i'>correct</param>
---- <param name='i'>duplicate</param>
---- </member>\r
---- <member name="M:Testing.Test.Baz(System.Int32)">\r
---- <param name='mismatch'>mismatch</param>
---- </member>\r
---- <member name="M:Testing.Test.Var(System.Int32[])">\r
---- <param name='arr'>varargs</param>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-026.xml
----namespace Testing
----{
---- /// test class
---- public class Test
---- {
---- public static void Main ()
---- {
---- }
----
---- /// <param>anonymous</param>
---- public void Foo (int i) {}
----
---- /// <param name='i'>correct</param>
---- /// <param name='i'>duplicate</param>
---- public void Bar (int i) {}
----
---- /// <param name='mismatch'>mismatch</param>
---- public void Baz (int i) {}
----
---- /// <param name='arr'>varargs</param>
---- public void Var (params int [] arr) {}
---- }
----}
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-027</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Testing.Test">\r
---- <summary>\r
---- <see/>\r
---- <see cref="!:!!!!!"/>\r
---- <see cref="!:nonexist"/>\r
---- <see cref="T:Testing.Test"/>\r
---- <see cref="T:Testing.Test"/>\r
---- <see cref="T:Test"/>\r
---- <see cref="_:Test"/>\r
---- <see cref="P:Bar"/>\r
---- <see cref="F:Bar"/>\r
---- <see cref="F:Testing.Test.Bar"/>\r
---- <see cref="P:Baz"/>\r
---- <see cref="F:Baz"/>\r
---- <see cref="P:Testing.Test.Baz"/>\r
---- <see cref="!:nonexist.Foo()"/>\r
---- <see cref="M:Testing.Test.Foo"/>\r
---- <see cref="M:Testing.Test.Foo"/>\r
---- <see cref="!:Test.Bar()"/>\r
---- <see cref="!:Test.Foo(System.Int32)"/>\r
---- </summary>\r
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-027.xml
----using ZZZ = Testing.Test;
----
----namespace Testing
----{
---- /// <summary>
---- /// <see />
---- /// <see cref='!!!!!' />
---- /// <see cref='nonexist' />
---- /// <see cref='Test' />
---- /// <see cref='ZZZ' />
---- /// <see cref='T:Test' />
---- /// <see cref='_:Test' />
---- /// <see cref='P:Bar' />
---- /// <see cref='F:Bar' />
---- /// <see cref='Bar' />
---- /// <see cref='P:Baz' />
---- /// <see cref='F:Baz' />
---- /// <see cref='Baz' />
---- /// <see cref='nonexist.Foo()' />
---- /// <see cref='Test.Foo()' />
---- /// <see cref='ZZZ.Foo()' />
---- /// <see cref='Test.Bar()' />
---- /// <see cref='Test.Foo(System.Int32)' />
---- /// </summary>
---- class Test
---- {
---- public static void Main () { System.Console.Error.WriteLine ("xml-027 is running fine ;-)"); }
----
---- // I don't put any documentation here, but cref still works.
---- public void Foo () {}
----
---- public string Bar;
----
---- public string Baz { get { return ""; } }
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-028</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Test">\r
---- <summary>\r
---- Partial comment #2\r
---- Partial comment #1\r
---- </summary>\r
---- </member>\r
---- <member name="T:Test.Inner">\r
---- <summary>\r
---- Partial inner class!\r
---- ... is still available.\r
---- </summary>\r
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-028.xml
----using System;
----
----/// <summary>
----/// Partial comment #2
----public partial class Test
----{
---- string Bar;
----
---- public static void Main () {}
----
---- /// <summary>
---- /// Partial inner class!
---- internal partial class Inner
---- {
---- public string Hoge;
---- }
----}
----
----/// Partial comment #1
----/// </summary>
----public partial class Test
----{
---- public string Foo;
----
---- /// ... is still available.
---- /// </summary>
---- internal partial class Inner
---- {
---- string Fuga;
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-029</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="M:Test1.Foo">\r
---- <summary>
---- Some test documentation
---- </summary>
---- </member>\r
---- <member name="T:ITest2">\r
---- <summary>
---- Publicly available interface
---- </summary>
---- </member>\r
---- <member name="M:ITest2.Foo">\r
---- <summary>
---- Some test documentation
---- </summary>
---- </member>\r
---- <member name="P:ITest2.Bar">\r
---- <summary>
---- Some test documentation
---- </summary>
---- </member>\r
---- <member name="E:ITest2.EventRaised">\r
---- <summary>
---- Some test documentation
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-029.xml
----using System;
----
----class Test1 {
---- /// <summary>
---- /// Some test documentation
---- /// </summary>
---- void Foo(){}
----
---- public static void Main () {}
----}
----
----/// <summary>
----/// Publicly available interface
----/// </summary>
----public interface ITest2 {
----
---- /// <summary>
---- /// Some test documentation
---- /// </summary>
---- void Foo();
----
---- /// <summary>
---- /// Some test documentation
---- /// </summary>
---- long Bar { get; }
----
---- /// <summary>
---- /// Some test documentation
---- /// </summary>
---- event EventHandler EventRaised;
----}
----
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-030</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="M:Test.foo2">\r
---- <summary>\r
---- some summary\r
---- </summary>\r
---- <value>\r
---- <see cref="T:Test[]"/>\r
---- <see cref="T:System.Text.RegularExpressions.Regex"/>\r
---- <see cref="T:System.Text.RegularExpressions.Regex"/>\r
---- <see cref="N:System.Text.RegularExpressions"/>\r
---- <see cref="T:System.Text.RegularExpressions.Regex[]"/>\r
---- </value>\r
---- </member>\r
---- <member name="M:Test.foo3(System.String,System.Object[])">\r
---- <summary>\r
---- <see cref="M:System.String.Format(System.String,System.Object[])"/>.\r
---- <see cref="M:System.String.Format(System.String,System.Object[])"/>.\r
---- <see cref="M:System.String.Format(System.String,System.Object[])"/>.\r
---- <see cref="M:System.String.Format(System.String,System.Object[])"/>.\r
---- </summary>\r
---- <param name="line">The formatting string.</param>\r
---- <param name="args">The object array to write into format string.</param>\r
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-030.xml -warn:4 -warnaserror
----using System;
----
----class Test
----{
---- static void Main () {}
----
---- /// <summary>
---- /// some summary
---- /// </summary>
---- /// <value>
---- /// <see cref="T:Test[]"/>
---- /// <see cref="T:System.Text.RegularExpressions.Regex"/>
---- /// <see cref="System.Text.RegularExpressions.Regex"/>
---- /// <see cref="System.Text.RegularExpressions"/>
---- /// <see cref="T:System.Text.RegularExpressions.Regex[]"/>
---- /// </value>
---- //
---- // <see cref="T:System.Text.RegularExpressions"/> .. csc incorrectly allows it
---- // <see cref="System.Text.RegularExpressions.Regex[]"/> ... csc does not allow it.
---- //
---- public void foo2() {
---- }
----
---- /// <summary>
---- /// <see cref="String.Format(string, object[])" />.
---- /// <see cref="string.Format(string, object[])" />.
---- /// <see cref="String.Format(string, object [ ])" />.
---- /// <see cref="string.Format(string, object [ ])" />.
---- /// </summary>
---- /// <param name="line">The formatting string.</param>
---- /// <param name="args">The object array to write into format string.</param>
---- public void foo3(string line, params object[] args) {
---- }
----}
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-031</name>\r
---- </assembly>\r
---- <members>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-031.xml -warn:4 -warnaserror
----//// Some comment
----////how about this line?
----using System;
----using System.IO;
----
----class Test
----{
---- public static void Main ()
---- {
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-032</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="M:Test.#ctor(System.String)">\r
---- <exception cref="T:System.ArgumentNullException"><paramref name="wrongref"/> is <see langword="null"/>.</exception>\r
---- <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="wrongRefAgain"/> is a zero-length <see cref="T:System.String"/>.</exception>\r
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-032.xml -warn:4 -warnaserror
----using System;
----
----class Test
----{
---- /// <exception cref="ArgumentNullException"><paramref name="wrongref" /> is <see langword="null" />.</exception>
---- /// <exception cref="ArgumentOutOfRangeException"><paramref name="wrongRefAgain" /> is a zero-length <see cref="string" />.</exception>
---- protected Test(string name)
---- {
---- }
----
---- static void Main () {}
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-033</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:MyClass">\r
---- <summary>help text</summary>
---- </member>\r
---- <member name="M:MyClass.Main">\r
---- <summary>help text</summary>
---- </member>\r
---- <member name="M:MyClass.op_Explicit(MyClass)~System.Int32">\r
---- <summary>help text</summary>
---- </member>\r
---- <member name="M:MyClass.op_Implicit(MyClass)~System.Char">\r
---- <summary>help text</summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-033.xml
----
----/// <summary>help text</summary>
----public class MyClass
----{
---- /// <summary>help text</summary>
---- public static void Main()
---- {
---- }
----
---- /// <summary>help text</summary>
---- public static explicit operator int(MyClass f)
---- {
---- return 0;
---- }
----
---- /// <summary>help text</summary>
---- public static implicit operator char(MyClass f)
---- {
---- return ' ';
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-034</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Test">\r
---- valid comment.
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-034.xml -warn:4 -warnaserror
----using System;
----
----/// valid comment.
----public class Test
----{
---- static void Main ()
---- {
---- }
----}
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-035</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Test">\r
---- <summary>\r
---- <see cref="M:System.Data.DataSet.ReadXml(System.Xml.XmlReader,System.Data.XmlReadMode)"/>\r
---- <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)"/>\r
---- </summary>\r
---- </member>\r
---- <member name="M:Test.Main">\r
---- <summary>\r
---- <see cref="T:System.Environment.SpecialFolder"/>\r
---- </summary>\r
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-035.xml -warn:4 -warnaserror -r:System.Data
----using System;
----using System.Data;
----using System.Xml;
----
----/// <summary>
----/// <see cref="DataSet.ReadXml(XmlReader,XmlReadMode)" />
----/// <see cref="Environment.GetFolderPath(Environment.SpecialFolder)" />
----/// </summary>
----public class Test {
---- /// <summary>
---- /// <see cref="Environment.SpecialFolder" />
---- /// </summary>
---- public static void Main() {
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-036</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Test">\r
---- <summary><see cref="F:Test.true"/>, <see cref="F:Test.true"/>, <see cref="F:Test.Whatever"/></summary>\r
---- </member>\r
---- <member name="F:Test.true">\r
---- <summary>Yes</summary>\r
---- </member>\r
---- <member name="F:Test.false">\r
---- <summary>Nope</summary>\r
---- </member>\r
---- <member name="F:Test.Whatever">\r
---- <summary>Maybe</summary>\r
---- </member>\r
---- <member name="T:Foo">\r
---- <summary><see cref="M:Foo.true"/></summary>\r
---- </member>\r
---- <member name="M:Foo.true">\r
---- <summary>Foo</summary>\r
---- </member>\r
---- <member name="M:Foo.Main">\r
---- main.\r
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-036.xml -warn:1 -warnaserror
----/// <summary><see cref="@true" />, <see cref="Test.@true" />, <see cref="@Whatever" /></summary>
----public enum Test {
---- /// <summary>Yes</summary>
---- @true,
---- /// <summary>Nope</summary>
---- @false,
---- /// <summary>Maybe</summary>
---- Whatever
----}
----
----/// <summary><see cref="Foo.@true" /></summary>
----public abstract class Foo {
---- /// <summary>Foo</summary>
---- public abstract void @true();
---- /// main.
---- public static void Main() {}
----}
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-037</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Whatever">\r
---- <summary>\r
---- <see cref="E:System.AppDomain.AssemblyResolve"/>\r
---- </summary>\r
---- </member>\r
---- <member name="M:Whatever.Main">\r
---- <summary>
---- </summary>
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-037.xml
----using System;
----using System.Reflection;
----
----/// <summary>
----/// <see cref="AppDomain.AssemblyResolve" />
----/// </summary>
----public class Whatever {
---- /// <summary>
---- /// </summary>
---- public static void Main() {
---- foreach (MemberInfo mi in typeof (AppDomain).FindMembers (
---- MemberTypes.All,
---- BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance,
---- Type.FilterName,
---- "AssemblyResolve"))
---- Console.WriteLine (mi.GetType ());
---- }
----}
----
+++ /dev/null
----<?xml version="1.0"?>\r
----<doc>\r
---- <assembly>\r
---- <name>xml-038</name>\r
---- </assembly>\r
---- <members>\r
---- <member name="T:Whatever">\r
---- <summary>\r
---- <see cref="E:System.AppDomain.AssemblyResolve"/>\r
---- </summary>\r
---- </member>\r
---- <member name="M:Whatever.Main">\r
---- <summary>\r
---- </summary>\r
---- </member>\r
---- </members>\r
----</doc>\r
+++ /dev/null
----// Compiler options: -doc:xml-038.xml
----using System;
----using System.Reflection;
----using System.Xml;
----
----/// <summary>
----/// <see cref="AppDomain.AssemblyResolve" />
----/// </summary>
----public class Whatever {
---- /// <summary>
---- /// </summary>
---- public static void Main() {
---- foreach (MemberInfo mi in typeof (XmlDocument).FindMembers (
---- MemberTypes.All,
---- BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance,
---- Type.FilterName,
---- "NodeInserted"))
---- Console.WriteLine (mi.GetType ());
---- }
----}
----
+++ /dev/null
----using System;
----using System.Collections;
----using System.Xml;
----
----public class Test
----{
---- public class ComparisonException : Exception
---- {
---- public ComparisonException (string message)
---- : base (message)
---- {
---- }
---- }
----
---- static bool debug = false;
---- static bool error = false;
----
---- public static void Main (string [] args)
---- {
---- if (args.Length < 2) {
---- Console.Error.WriteLine ("Usage: xmldocdiff [reference_output.xml] [actual_output.xml]");
---- return;
---- }
---- if (args.Length > 2 && args [2].EndsWith ("-debug"))
---- debug = true;
----
---- try {
---- Run (args);
---- } catch (Exception ex) {
---- Console.WriteLine ("FAIL: " + args [1]);
---- throw ex;
---- }
---- Console.WriteLine ("PASS: " + args [1]);
---- }
----
---- private static void Run (string [] args)
---- {
---- XmlDocument doc1 = new XmlDocument ();
---- doc1.Load (args [0]);
---- XmlDocument doc2 = new XmlDocument ();
---- doc2.Load (args [1]);
----
---- XmlNodeList memberList1 = doc1.SelectNodes ("/doc/members/member");
---- XmlNodeList memberList2 = doc2.SelectNodes ("/doc/members/member");
----
---- Hashtable namedItems = new Hashtable ();
----
---- foreach (XmlElement el in memberList1)
---- namedItems.Add (el.GetAttribute ("name"), el);
---- foreach (XmlElement el2 in memberList2) {
---- string name = el2.GetAttribute ("name");
---- XmlElement el1 = namedItems [name] as XmlElement;
---- if (el1 == null) {
---- Report ("Extraneous element found. Name is '{0}'", name);
---- continue;
---- }
---- namedItems.Remove (name);
----
---- CompareNodes (el1, el2);
----
---- }
---- foreach (string name in namedItems.Keys)
---- Report ("Expected comment was not found. Name is {0}, XML is {1}", name, ((XmlElement) namedItems [name]).OuterXml);
----
---- // finally, check other nodes than members
---- doc1.SelectSingleNode ("/doc/members").RemoveAll ();
---- doc2.SelectSingleNode ("/doc/members").RemoveAll ();
---- string xml1 = doc1.OuterXml.Replace ("\r", "").Trim ();
---- string xml2 = doc2.OuterXml.Replace ("\r", "").Trim ();
---- if (xml1 != xml2)
---- Report (@"Either of doc, assembly, name, members elements are different.
----doc1: {0}
----doc2: {1}", xml1, xml2);
---- }
----
---- private static void CompareNodes (XmlNode n1, XmlNode n2)
---- {
---- if (n2 == null) {
---- Report (@"Nodes does not exist:
----Node1: {0}", n1.OuterXml);
---- return;
---- }
---- if (n1.NodeType != n2.NodeType) {
---- Report (@"Nodes differ:
----Node1: {0}
----Node2: {1}", n1.OuterXml, n2.OuterXml);
---- return;
---- }
---- if (n1.Name != n2.Name) {
---- Report (@"Node names differ:
----Node1: {0}
----Node2: {1}", n1.OuterXml, n2.OuterXml);
---- return;
---- }
---- if (n1 is XmlElement) {
---- for (int i = 0; i < n1.Attributes.Count; i++)
---- CompareNodes (n1.Attributes [i],
---- n2.Attributes [i]);
---- for (int i = 0; i < n1.ChildNodes.Count; i++)
---- CompareNodes (n1.ChildNodes [i],
---- n2.ChildNodes [i]);
---- }
---- if (n1.NodeType != XmlNodeType.Comment && n1.Value != null) {
---- string v1 = n1.Value.Trim ().Replace ("\r", "");
---- string v2 = n2.Value.Trim ().Replace ("\r", "");
---- if (v1 != v2)
---- Report (@"Node values differ:
----Node1: {0}
----Node2: {1}", v1, v2);
---- }
---- }
----
---- static void Report (string format, params object [] args)
---- {
---- error = true;
---- if (debug)
---- Console.WriteLine (format, args);
---- else
---- throw new ComparisonException (String.Format (format, args));
---- }
----}
----