[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mcs / tests / test-iter-08.cs
1 // Compiler options: -langversion:default
2
3 using System;
4 using System.Collections;
5
6 public class Foo : IDisposable
7 {
8         public readonly int Data;
9
10         public Foo (int data)
11         {
12                 this.Data = data;
13         }
14
15         public bool disposed;
16
17         public void Dispose ()
18         {
19                 disposed = true;
20         }
21 }
22
23 class X
24 {
25         public static IEnumerable Test (int a, int b)
26         {
27                 Foo foo3, foo4;
28
29                 using (Foo foo1 = new Foo (a), foo2 = new Foo (b)) {
30                         yield return foo1.Data;
31                         yield return foo2.Data;
32
33                         foo3 = foo1;
34                         foo4 = foo2;
35                 }
36
37                 yield return foo3.disposed;
38                 yield return foo4.disposed;
39         }
40
41         public static int Main ()
42         {
43                 ArrayList list = new ArrayList ();
44                 foreach (object data in Test (3, 5))
45                         list.Add (data);
46
47                 if (list.Count != 4)
48                         return 1;
49                 if ((int) list [0] != 3)
50                         return 2;
51                 if ((int) list [1] != 5)
52                         return 3;
53                 if (!(bool) list [2])
54                         return 4;
55                 if (!(bool) list [3])
56                         return 5;
57
58                 return 0;
59         }
60 }