[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mcs / tests / test-anon-154.cs
1 using System;
2
3 public class Class
4 {
5         string Property { get { return " Property"; } }
6
7         string Method ()
8         {
9                 string methodVariable = "method variable";
10
11                 Func<string> outerAction = () => {
12                         // If methodVariable is not accessed here, the compiler does not crash
13                         string unused = methodVariable;
14
15                         string innerVariable = "inner variable";
16
17                         Func<string, string> middleAction = lambdaParameter => {
18                                 // If any of the variables referenced are removed, the compiler does not crash.
19                                 Func<string> innerFunc = () => lambdaParameter + innerVariable + Property;
20                                 return innerFunc ();
21                         };
22
23                         return middleAction ("> ");
24                 };
25
26                 return outerAction ();
27         }
28
29         public static int Main ()
30         {
31                 Class c = new Class ();
32                 string s = c.Method ();
33                 Console.WriteLine (s);
34                 if (s != "> inner variable Property")
35                         return 1;
36
37                 return 0;
38         }
39 }
40