Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-async-89.cs
1 using System;
2 using System.Threading.Tasks;
3
4 class X
5 {
6         public static void Main ()
7         {
8                 new X ().Test ();
9         }
10
11         void Test ()
12         {
13                 object v1 = null;
14
15                 Action a = () =>
16                 {
17                         if (v1 == null)
18                         {
19                                 object v2 = null;
20
21                                 Action a2 = () =>
22                                 {
23                                         Console.WriteLine (v2);
24                                 };
25                                 
26                                 Action a3 = async () =>
27                                 {
28                                         // This scope needs to access to Scope which can do ldftn on instance method
29                                         {
30                                         Func<Task> a4 = async () =>
31                                         {
32                                                 await Foo ();
33                                         };
34                                         }
35
36                                         await Task.Yield ();
37                                 };
38
39                                 a3 ();
40                         }
41                 };
42
43                 a ();
44         }
45
46         async Task Foo ()
47         {
48                 await Task.FromResult (1);
49         }
50
51 }