Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-anon-158.cs
1 // Compiler options: -r:test-anon-158-lib.dll
2
3 using System;
4
5 public class Test
6 {
7         public X Foo<X> (bool b)
8         {
9                 Call<X> foo = new Call<X> ();
10                 if (b) {
11                         Func<X> f = () => foo.Field;
12                         return f ();
13                 }
14                 
15                 throw null;
16         }
17         
18         public X FooNested<X> (bool b)
19         {
20                 Call<Call<X>> foo = new Call<Call<X>> ();
21                 foo.Field = new Call<X> ();
22                 if (b) {
23                         Func<Call<X>> f = () => foo.Field;
24                         return f ().Field;
25                 }
26                 
27                 throw null;
28         }       
29         
30         public static int Main ()
31         {
32                 var v = new Test ();
33                 if (v.Foo<int>(true) != 0)
34                         return 1;
35                         
36                 if (v.FooNested<int>(true) != 0)
37                         return 2;
38                 
39                 return 0;
40         }
41 }