2010-05-31 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-040.cs
blobdefa47999f6a1e1434a2d8e5a2b366a0d76d67e6
1 public interface INode<T>
3 void Hello (T t);
6 public class Stack<T>
8 public T TheData;
9 public readonly Foo<T> TheFoo;
11 public Stack (T t)
13 this.TheData = t;
14 this.TheFoo = new Foo<T> (t);
17 public INode<T> GetNode ()
19 return new Node (this);
22 public Foo<T> GetFoo (T t)
24 return new Foo<T> (t);
27 public Bar<T> GetBar (T t)
29 return new Bar<T> (t);
32 protected class Node : INode<T>
34 public readonly Stack<T> Stack;
36 public Node (Stack<T> stack)
38 this.Stack = stack;
41 public void Hello (T t)
46 public class Foo<T>
48 public readonly T Data;
50 public Bar<T> GetBar ()
52 return new Bar<T> (Data);
55 public Foo (T t)
57 this.Data = t;
61 public class Bar<U>
63 public readonly U Data;
65 public Bar (U u)
67 this.Data = u;
70 public Foo<T> GetFoo (Stack<T> stack)
72 return stack.TheFoo;
75 public class Baz<V>
77 public readonly V Data;
79 public Foo<T> GetFoo (Stack<T> stack)
81 return new Foo<T> (stack.TheData);
84 public Bar<V> GetBar ()
86 return new Bar<V> (Data);
89 public Baz (V v)
91 this.Data = v;
96 public void Test ()
98 Stack<T>.Foo<T> foo1 = GetFoo (TheData);
99 Foo<T> foo2 = GetFoo (TheData);
101 Stack<long>.Foo<T> foo3 = new Stack<long>.Foo<T> (TheData);
102 Stack<long>.Foo<float> foo4 = new Stack<long>.Foo<float> (3.14F);
104 Foo<double> foo5 = new Foo<double> (3.14);
108 class A<U>
110 public class Test<T>
112 public static Nested<T> Foo ()
114 return null;
117 public class Nested<X>
123 class X
125 static int Main ()
127 Stack<int> stack = new Stack<int> (1);
128 INode<int> node = stack.GetNode ();
129 Stack<int>.Foo<int> foo = stack.GetFoo (7);
130 Stack<int>.Bar<int> bar = stack.GetBar (8);
132 A<bool>.Test<string>.Nested<string> v = A<bool>.Test<string>.Foo ();
133 return 0;