| ... | @@ -44,15 +44,15 @@ pub export fn entry5() void { | ... | @@ -44,15 +44,15 @@ pub export fn entry5() void { |
| 44 | comptime var y = .{ 1, 2 }; | 44 | comptime var y = .{ 1, 2 }; |
| 45 | y = .{ 3, 4 }; | 45 | y = .{ 3, 4 }; |
| 46 | } | 46 | } |
| 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 | // } | | |
| 55 | pub export fn entry6() void { | 47 | pub 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 | } |
| | 55 | pub export fn entry7() void { |
| 56 | const State = struct { | 56 | const State = struct { |
| 57 | comptime id: bool = true, | 57 | comptime id: bool = true, |
| 58 | fn init(comptime id: bool) @This() { | 58 | fn init(comptime id: bool) @This() { |
| ... | @@ -61,7 +61,7 @@ pub export fn entry6() void { | ... | @@ -61,7 +61,7 @@ pub export fn entry6() void { |
| 61 | }; | 61 | }; |
| 62 | _ = State.init(false); | 62 | _ = State.init(false); |
| 63 | } | 63 | } |
| 64 | pub export fn entry7() void { | 64 | pub export fn entry8() void { |
| 65 | const list1 = .{ "sss", 1, 2, 3 }; | 65 | const list1 = .{ "sss", 1, 2, 3 }; |
| 66 | const list2 = @TypeOf(list1){ .@"0" = "xxx", .@"1" = 4, .@"2" = 5, .@"3" = 6 }; | 66 | const list2 = @TypeOf(list1){ .@"0" = "xxx", .@"1" = 4, .@"2" = 5, .@"3" = 6 }; |
| 67 | _ = list2; | 67 | _ = list2; |
| ... | @@ -73,6 +73,7 @@ pub export fn entry7() void { | ... | @@ -73,6 +73,7 @@ pub export fn entry7() void { |
| 73 | // | 73 | // |
| 74 | // :6:19: error: value stored in comptime field does not match the default value of the field | 74 | // :6:19: error: value stored in comptime field does not match the default value of the field |
| 75 | // :14:19: error: value stored in comptime field does not match the default value of the field | 75 | // :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 |
| 76 | // :19:38: error: value stored in comptime field does not match the default value of the field | 77 | // :19:38: error: value stored in comptime field does not match the default value of the field |
| 77 | // :31:19: error: value stored in comptime field does not match the default value of the field | 78 | // :31:19: error: value stored in comptime field does not match the default value of the field |
| 78 | // :25:29: note: default value set here | 79 | // :25:29: note: default value set here |