| 1 | const A = struct { |
| 2 | x: i32, |
| 3 | y: i32, |
| 4 | z: i32, |
| 5 | }; |
| 6 | export fn f() void { |
| 7 | const a = A{ |
| 8 | .z = 4, |
| 9 | .y = 2, |
| 10 | .foo = 42, |
| 11 | }; |
| 12 | _ = a; |
| 13 | } |
| 14 | |
| 15 | const Object = struct { |
| 16 | field_1: u32, |
| 17 | field_2: u32, |
| 18 | }; |
| 19 | fn dump(_: Object) void {} |
| 20 | pub export fn entry() void { |
| 21 | dump(.{ .field_1 = 123, .field_3 = 456 }); |
| 22 | } |
| 23 | |
| 24 | pub export fn entry1() void { |
| 25 | const x = Object{ |
| 26 | .abc = 1, |
| 27 | }; |
| 28 | _ = x; |
| 29 | } |
| 30 | |
| 31 | // error |
| 32 | // |
| 33 | // :10:10: error: no field named 'foo' in struct 'tmp.A' |
| 34 | // :1:11: note: struct declared here |
| 35 | // :21:30: error: no field named 'field_3' in struct 'tmp.Object' |
| 36 | // :15:16: note: struct declared here |
| 37 | // :26:10: error: no field named 'abc' in struct 'tmp.Object' |
| 38 | // :15:16: note: struct declared here |