Open perillo opened 10 months ago
0.12.0-dev.1821+a38af5f54
test { const array: [3:.{ 1, 2 }]i32 = undefined; _ = array; } test { const tuple = .{ 1, 2 }; const array: [3:tuple]i32 = undefined; _ = array; }
zig test test.zig test.zig:2:22: error: type 'i32' does not support array initialization syntax const array: [3:.{ 1, 2 }]i32 = undefined; ~^~~~~~~~ test.zig:8:21: error: expected type 'i32', found 'struct{comptime comptime_int = 1, comptime comptime_int = 2}' const array: [3:tuple]i32 = undefined; ^~~~~
The two error messages should be the same. The first error message is not incorrect, but it may be confusing to the user.
See also: https://github.com/ziglang/zig/blob/225fe6d/test/cases/compile_errors/array_init_not_supported_on_result_type.zig.
"remove non-scalar sentinels from the language".
Ironically, I wrote the example after reading that comment, because I have never seen a non scalar sentinel.
Thanks.
Zig Version
0.12.0-dev.1821+a38af5f54
Steps to Reproduce and Observed Output
Expected Output
The two error messages should be the same. The first error message is not incorrect, but it may be confusing to the user.
See also: https://github.com/ziglang/zig/blob/225fe6d/test/cases/compile_errors/array_init_not_supported_on_result_type.zig.