/ tests / tests / compiler / futures / misplaced_future_fail.adl
misplaced_future_fail.adl
 1  
 2  program child.alpha {
 3      async transition foo() -> Future {
 4          return finalize_foo(0u32);
 5      }
 6  
 7      async function finalize_foo(x: u32) {
 8          assert_eq(1u32, 1u32);
 9      }
10  
11      async transition boo() -> (u32, Future) {
12          return (1u32, finalize_boo(0u32));
13      }
14  
15      async function finalize_boo(x: u32) {
16          assert_eq(1u32, 1u32);
17      }
18   }
19  
20  // --- Next Program --- //
21  
22  import child.alpha;
23  
24  program parent.alpha {
25  
26      async transition foo() -> Future {
27          let f0: Future = child.alpha/foo();
28  
29          child.alpha/foo();
30  
31          child.alpha/boo();
32  
33          return finalize_foo(f0);
34      }
35  
36      async function finalize_foo(f0: Future) {
37          f0.await();
38      }
39  }