[mono/tests] Fix out of tree build.
[mono-project.git] / mcs / tests / test-async-22.cs
blobe715d1a4598cd3d4fe5d26a5e90624e99bd2f113
1 using System;
2 using System.Threading.Tasks;
4 // contextual async, parser tests
5 class A : Iasync
7 async Task<int> async ()
9 int async;
10 throw new NotImplementedException ();
13 async Task async (int async)
15 throw new NotImplementedException ();
18 async void CastTest ()
20 var res = (int) await async ();
21 var res2 = (Int32) await async ();
24 async void Iasync.async ()
28 public static int Main ()
30 return 0;
34 interface Iasync
36 void async ();
39 class B
41 class async
43 async (async arg)
49 class C
51 static void Test (bool async)
53 var a = async ? Prop : 2;
56 static int Prop {
57 get {
58 return 3;
63 class D
65 enum E {}
67 async Task M ()
72 class async
74 async (async arg)
76 int await = 0;
80 class await
82 await (await arg)
87 [async]
88 class asyncAttribute: Attribute
90 delegate async async (async async);
93 namespace AsyncNS
95 class Classes
97 class async
101 void M ()
103 async local;
107 namespace Namespaces
109 namespace async { }
113 namespace AwaitNS
115 class Formals
117 delegate void D (int x);
118 static void M1 ()
120 D d1 = await => { };
121 D d2 = (int await) => { };
122 D d3 = delegate (int await) { };
126 class Methods
128 void await () { }
129 void M (Methods m)
131 m.await ();
132 this.await ();
133 // FIXME: await ();
137 class Classes
139 class await { }
140 void M ()
142 // FIXME: @await local = new @await ();
146 class AnonTypes
148 static void M ()
150 var x = new { await = 1 };
151 var y = x.await;
152 int await = 2;
153 var x2 = new { await };
157 class Initializer
159 int await;
161 static void M ()
163 var a = new Initializer () {
164 await = 2
169 class MemberAccess
171 static void M ()
173 var await = new string[0];
174 var l = await.Length;
178 class TypeChecks
180 static void M (object await)
182 var b = await is Exception;
183 var c = await as Exception;