diff options
| author | Veikka Tuominen <git@vexu.eu> | 2023-10-15 21:28:36 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-10-16 14:00:18 +0300 |
| commit | 14efbf5ed1731058a616582d81223e23f43af128 (patch) | |
| tree | 6cf1d08c33dbe1874bc83016df90cc1fbcfd9ede /test/cases/compile_errors | |
| parent | 78855bd21866b515018259a2194e036e4b3120df (diff) | |
| download | zig-14efbf5ed1731058a616582d81223e23f43af128.tar.gz zig-14efbf5ed1731058a616582d81223e23f43af128.zip | |
Sema: fix missing check for tuple default initializers
Closes #17525
Diffstat (limited to 'test/cases/compile_errors')
| -rw-r--r-- | test/cases/compile_errors/tuple_init_edge_cases.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/cases/compile_errors/tuple_init_edge_cases.zig b/test/cases/compile_errors/tuple_init_edge_cases.zig index 2ac275f2b7..aae7370851 100644 --- a/test/cases/compile_errors/tuple_init_edge_cases.zig +++ b/test/cases/compile_errors/tuple_init_edge_cases.zig @@ -45,6 +45,20 @@ pub export fn entry5() void { var b = T{ .@"0" = 123, .@"2" = 123, .@"1" = 123 }; _ = b; } +pub const Consideration = struct { + curve: Curve, + pub const Curve = union(enum) { + logistic: Parameters, + + pub const Parameters = struct { f32, f32, f32, f32 }; + }; +}; +pub export fn entry6() void { + const cons: []Consideration = &.{ + .{ .curve = .{ .logistic = .{ -7, 1.0, 0 } } }, + }; + _ = cons; +} // error // backend=stage2 @@ -54,3 +68,5 @@ pub export fn entry5() void { // :23:14: error: missing tuple field with index 1 // :39:14: error: expected at most 2 tuple fields; found 3 // :45:30: error: index '2' out of bounds of tuple 'struct{comptime comptime_int = 123, u32}' +// :58:37: error: missing tuple field with index 3 +// :53:32: note: struct declared here |
