/ tests / tests / compiler / futures / async_function_three.adl
async_function_three.adl
 1  
 2  // Ensure Future types are correctly found through
 3  // two layers of dependencies.
 4  
 5  program dependent.alpha {
 6      async function finalize(x: u8) {
 7          assert_eq(1u8, 1u8);
 8      }
 9  
10      async transition t1() -> Future {
11          let f: Future = finalize(1u8);
12          return f;
13      }
14  }
15  
16  // --- Next Program --- //
17  
18  import dependent.alpha;
19  
20  program dependent2.alpha {
21      async function finalize(f: Future) {
22          f.await();
23      }
24  
25      async transition t1() -> Future {
26          let f: Future = dependent.alpha/t1();
27          return finalize(f);
28      }
29  }
30  
31  // --- Next Program --- //
32  
33  import dependent2.alpha;
34  
35  program test.alpha {
36      async function finalize(f: Future) {
37          f.await();
38      }
39  
40      async transition t1() -> Future {
41          let f: Future = dependent2.alpha/t1();
42          assert_eq(1u8, f.0.0);
43          return finalize(f);
44      }
45  }