authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-01-14 12:50:46+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-01-17 20:28:43+02:00
log94be9dcc7f2ff81c3433cd2f8bb32f7ea53ba7cf
treeeb67ac3a71c5fda6ac38271c5e8d02598fda867d
parent6e067dc0506c8d5342ddaa0934770f7339619d36

enable passing compile error test


1 files changed, 10 insertions(+), 9 deletions(-)

test/cases/compile_errors/invalid_store_to_comptime_field.zig+10-9
......@@ -44,15 +44,15 @@ pub export fn entry5() void {
4444 comptime var y = .{ 1, 2 };
4545 y = .{ 3, 4 };
4646}
47// pub export fn entry5() void {
48// var x: u32 = 15;
49// const T = @TypeOf(.{ @as(i32, -1234), @as(u32, 5678), x });
50// const S = struct {
51// fn foo(_: T) void {}
52// };
53// _ = S.foo(.{ -1234, 5679, x });
54// }
5547pub export fn entry6() void {
48 var x: u32 = 15;
49 const T = @TypeOf(.{ @as(i32, -1234), @as(u32, 5678), x });
50 const S = struct {
51 fn foo(_: T) void {}
52 };
53 _ = S.foo(.{ -1234, 5679, x });
54}
55pub export fn entry7() void {
5656 const State = struct {
5757 comptime id: bool = true,
5858 fn init(comptime id: bool) @This() {
......@@ -61,7 +61,7 @@ pub export fn entry6() void {
6161 };
6262 _ = State.init(false);
6363}
64pub export fn entry7() void {
64pub export fn entry8() void {
6565 const list1 = .{ "sss", 1, 2, 3 };
6666 const list2 = @TypeOf(list1){ .@"0" = "xxx", .@"1" = 4, .@"2" = 5, .@"3" = 6 };
6767 _ = list2;
......@@ -73,6 +73,7 @@ pub export fn entry7() void {
7373//
7474// :6:19: error: value stored in comptime field does not match the default value of the field
7575// :14:19: error: value stored in comptime field does not match the default value of the field
76// :53:16: error: value stored in comptime field does not match the default value of the field
7677// :19:38: error: value stored in comptime field does not match the default value of the field
7778// :31:19: error: value stored in comptime field does not match the default value of the field
7879// :25:29: note: default value set here