Merge pull request #186 from QuickJack/master
[mono.git] / mcs / tests / test-async-08.cs
1 // Compiler options: -langversion:future
2
3 using System;
4 using System.Threading.Tasks;
5
6 class AsyncTypeInference
7 {
8         public static int Main ()
9         {
10                 Test (async l => await Task.Factory.StartNew (() => 1));
11                 Test (async l => { return await Task.Factory.StartNew (() => 1); });
12                 Test2 (async l => { await TT (); } );
13                 Test2 (async l => { TT (); } );
14                 return 0;
15         }
16         
17         static Task TT ()
18         {
19                 return Task.Factory.StartNew (() => 2);
20         }
21
22         static void Test<T> (Func<int, Task<T>> arg)
23         {
24                 arg (0);
25         }
26         
27         static void Test2<T> (Func<int, T> arg)
28         {
29                 arg (0);
30         }
31 }