()
| 130 | } |
| 131 | |
| 132 | // --- Canonical struct literals --- |
| 133 | |
| 134 | #[test] |
| 135 | fn named_and_contextual_literals_execute() { |
| 136 | // Named literal (reordered fields) and a contextual literal from the |
| 137 | // annotation. 1 + 2 + 3 + 4 = 10. |
| 138 | assert_exit( |
| 139 | r#" |
| 140 | struct Point { |
| 141 | x: i32 |
| 142 | y: i32 |
| 143 | } |
| 144 | |
| 145 | main: () -> i32 { |
| 146 | named := Point { .y = 2, .x = 1 } |
| 147 | contextual: Point = { .x = 3, .y = 4 } |
| 148 | return named.x + named.y + contextual.x + contextual.y |
nothing calls this directly
no test coverage detected