/ tests / tests / compiler / async_blocks / okay_assign_in_async_block.adl
okay_assign_in_async_block.adl
 1  program test.alpha {
 2      struct Foo { x: u32, y: u32 }
 3  
 4      async transition foo(p: u32, q: u8) -> Future {
 5          let f = async {
 6              let y = (1u32, 2u8, 3u16);
 7              let a = [1u32, 2u32];
 8              let x = 0u32;
 9              let s = Foo { x: 9, y: 4 };
10  
11              // All of these are okay since the variables are declared inside the block
12              y = (1u32, 2u8, 3u16);
13              y.0 = 1u32;
14              a = [1u32, 2u32];
15              a[0] = 3;
16              x = 2;
17              s.x = 99;
18  
19              let w = 0u32;
20              {
21                  w = 1;
22              }
23  
24              {
25                  let b = 0u32;
26                  {
27                      b = 1;
28                  }
29              }
30  
31              {
32                  {
33                      let c = 0u32;
34                      c = 1;
35                  }
36              }
37  
38              for i in 0u32..2u32 {
39                  let d = 0u32;
40                  d = 1;
41              }
42          };
43          return f;
44      }
45  }
46