/ tests / tests / compiler / async_blocks / non_async_before_complex_async_fail.adl
non_async_before_complex_async_fail.adl
 1  program inner.alpha {
 2      mapping foo: u32 => u32;
 3  
 4      async transition inner(a: u32) -> Future {
 5          return async {
 6              Mapping::set(foo, 0u32, a);
 7          };
 8      }
 9  }
10  
11  // --- Next Program --- //
12  
13  import inner.alpha;
14  program mid.alpha {
15      async transition mid(a: u32) -> Future {
16          let f1: Future = inner.alpha/inner(0u32);
17          let f2: Future = inner.alpha/inner(1u32);
18          let f:Future = async {
19              f2.await();
20              f1.await();
21          };
22          return f;
23      }
24  
25      transition dummy() {}
26  }
27  
28  // --- Next Program --- //
29  
30  import inner.alpha;
31  import mid.alpha;
32  program outer.alpha {
33      async transition outer_1(a: u32) -> Future {
34          mid.alpha/dummy();
35          let f1: Future = mid.alpha/mid(0u32);
36          let f2: Future = mid.alpha/mid(1u32);
37          let f:Future = async {
38              f1.await();
39              f2.await();
40          };
41          return f;
42      }
43  
44      async transition outer_2(a: u32) -> Future {
45          let f1: Future = mid.alpha/mid(0u32);
46          mid.alpha/dummy();
47          let f2: Future = mid.alpha/mid(1u32);
48          let f:Future = async {
49              f1.await();
50              f2.await();
51          };
52          return f;
53      }
54  }