authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-13 14:53:41-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-06-13 14:53:41-07:00
log38fc826a5a82bbe11a893be11d3cc1439c477ee8
treea6f1d07274887a20818b8e9f0798f1f74c318de5
parent700ea694b293565ececb7571e4d9613d2c143ca6
parentd884d7050e061c620324aaaabfba507e08cb40f4
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #15957 from BratishkaErik/deprecated-

std.*: remove stuff that was deprecated in older versions

83 files changed, 1091 insertions(+), 1045 deletions(-)

doc/langref.html.in+11-11
...@@ -3306,7 +3306,7 @@ const Divided = packed struct {...@@ -3306,7 +3306,7 @@ const Divided = packed struct {
33063306
3307test "@bitCast between packed structs" {3307test "@bitCast between packed structs" {
3308 try doTheTest();3308 try doTheTest();
3309 comptime try doTheTest();3309 try comptime doTheTest();
3310}3310}
33113311
3312fn doTheTest() !void {3312fn doTheTest() !void {
...@@ -5815,10 +5815,10 @@ test "error union" {...@@ -5815,10 +5815,10 @@ test "error union" {
5815 foo = error.SomeError;5815 foo = error.SomeError;
58165816
5817 // Use compile-time reflection to access the payload type of an error union:5817 // Use compile-time reflection to access the payload type of an error union:
5818 comptime try expect(@typeInfo(@TypeOf(foo)).ErrorUnion.payload == i32);5818 try comptime expect(@typeInfo(@TypeOf(foo)).ErrorUnion.payload == i32);
58195819
5820 // Use compile-time reflection to access the error set type of an error union:5820 // Use compile-time reflection to access the error set type of an error union:
5821 comptime try expect(@typeInfo(@TypeOf(foo)).ErrorUnion.error_set == anyerror);5821 try comptime expect(@typeInfo(@TypeOf(foo)).ErrorUnion.error_set == anyerror);
5822}5822}
5823 {#code_end#}5823 {#code_end#}
5824 {#header_open|Merging Error Sets#}5824 {#header_open|Merging Error Sets#}
...@@ -6199,7 +6199,7 @@ test "optional type" {...@@ -6199,7 +6199,7 @@ test "optional type" {
6199 foo = 1234;6199 foo = 1234;
62006200
6201 // Use compile-time reflection to access the child type of the optional:6201 // Use compile-time reflection to access the child type of the optional:
6202 comptime try expect(@typeInfo(@TypeOf(foo)).Optional.child == i32);6202 try comptime expect(@typeInfo(@TypeOf(foo)).Optional.child == i32);
6203}6203}
6204 {#code_end#}6204 {#code_end#}
6205 {#header_close#}6205 {#header_close#}
...@@ -6632,8 +6632,8 @@ test "peer resolve int widening" {...@@ -6632,8 +6632,8 @@ test "peer resolve int widening" {
6632test "peer resolve arrays of different size to const slice" {6632test "peer resolve arrays of different size to const slice" {
6633 try expect(mem.eql(u8, boolToStr(true), "true"));6633 try expect(mem.eql(u8, boolToStr(true), "true"));
6634 try expect(mem.eql(u8, boolToStr(false), "false"));6634 try expect(mem.eql(u8, boolToStr(false), "false"));
6635 comptime try expect(mem.eql(u8, boolToStr(true), "true"));6635 try comptime expect(mem.eql(u8, boolToStr(true), "true"));
6636 comptime try expect(mem.eql(u8, boolToStr(false), "false"));6636 try comptime expect(mem.eql(u8, boolToStr(false), "false"));
6637}6637}
6638fn boolToStr(b: bool) []const u8 {6638fn boolToStr(b: bool) []const u8 {
6639 return if (b) "true" else "false";6639 return if (b) "true" else "false";
...@@ -6641,7 +6641,7 @@ fn boolToStr(b: bool) []const u8 {...@@ -6641,7 +6641,7 @@ fn boolToStr(b: bool) []const u8 {
66416641
6642test "peer resolve array and const slice" {6642test "peer resolve array and const slice" {
6643 try testPeerResolveArrayConstSlice(true);6643 try testPeerResolveArrayConstSlice(true);
6644 comptime try testPeerResolveArrayConstSlice(true);6644 try comptime testPeerResolveArrayConstSlice(true);
6645}6645}
6646fn testPeerResolveArrayConstSlice(b: bool) !void {6646fn testPeerResolveArrayConstSlice(b: bool) !void {
6647 const value1 = if (b) "aoeu" else @as([]const u8, "zz");6647 const value1 = if (b) "aoeu" else @as([]const u8, "zz");
...@@ -9184,7 +9184,7 @@ const expect = std.testing.expect;...@@ -9184,7 +9184,7 @@ const expect = std.testing.expect;
9184test "vector @splat" {9184test "vector @splat" {
9185 const scalar: u32 = 5;9185 const scalar: u32 = 5;
9186 const result = @splat(4, scalar);9186 const result = @splat(4, scalar);
9187 comptime try expect(@TypeOf(result) == @Vector(4, u32));9187 try comptime expect(@TypeOf(result) == @Vector(4, u32));
9188 try expect(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 }));9188 try expect(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 }));
9189}9189}
9190 {#code_end#}9190 {#code_end#}
...@@ -9228,9 +9228,9 @@ test "vector @reduce" {...@@ -9228,9 +9228,9 @@ test "vector @reduce" {
9228 const value = @Vector(4, i32){ 1, -1, 1, -1 };9228 const value = @Vector(4, i32){ 1, -1, 1, -1 };
9229 const result = value > @splat(4, @as(i32, 0));9229 const result = value > @splat(4, @as(i32, 0));
9230 // result is { true, false, true, false };9230 // result is { true, false, true, false };
9231 comptime try expect(@TypeOf(result) == @Vector(4, bool));9231 try comptime expect(@TypeOf(result) == @Vector(4, bool));
9232 const is_all_true = @reduce(.And, result);9232 const is_all_true = @reduce(.And, result);
9233 comptime try expect(@TypeOf(is_all_true) == bool);9233 try comptime expect(@TypeOf(is_all_true) == bool);
9234 try expect(is_all_true == false);9234 try expect(is_all_true == false);
9235}9235}
9236 {#code_end#}9236 {#code_end#}
...@@ -9571,7 +9571,7 @@ const expect = std.testing.expect;...@@ -9571,7 +9571,7 @@ const expect = std.testing.expect;
9571test "no runtime side effects" {9571test "no runtime side effects" {
9572 var data: i32 = 0;9572 var data: i32 = 0;
9573 const T = @TypeOf(foo(i32, &data));9573 const T = @TypeOf(foo(i32, &data));
9574 comptime try expect(T == i32);9574 try comptime expect(T == i32);
9575 try expect(data == 0);9575 try expect(data == 0);
9576}9576}
95779577
lib/compiler_rt/powiXf2_test.zig+235-230
...@@ -32,17 +32,18 @@ fn test__powixf2(a: f80, b: i32, expected: f80) !void {...@@ -32,17 +32,18 @@ fn test__powixf2(a: f80, b: i32, expected: f80) !void {
32}32}
3333
34test "powihf2" {34test "powihf2" {
35 const inf_f16 = math.inf(f16);
35 try test__powisf2(0, 0, 1);36 try test__powisf2(0, 0, 1);
36 try test__powihf2(1, 0, 1);37 try test__powihf2(1, 0, 1);
37 try test__powihf2(1.5, 0, 1);38 try test__powihf2(1.5, 0, 1);
38 try test__powihf2(2, 0, 1);39 try test__powihf2(2, 0, 1);
39 try test__powihf2(math.inf_f16, 0, 1);40 try test__powihf2(inf_f16, 0, 1);
4041
41 try test__powihf2(-0.0, 0, 1);42 try test__powihf2(-0.0, 0, 1);
42 try test__powihf2(-1, 0, 1);43 try test__powihf2(-1, 0, 1);
43 try test__powihf2(-1.5, 0, 1);44 try test__powihf2(-1.5, 0, 1);
44 try test__powihf2(-2, 0, 1);45 try test__powihf2(-2, 0, 1);
45 try test__powihf2(-math.inf_f16, 0, 1);46 try test__powihf2(-inf_f16, 0, 1);
4647
47 try test__powihf2(0, 1, 0);48 try test__powihf2(0, 1, 0);
48 try test__powihf2(0, 2, 0);49 try test__powihf2(0, 2, 0);
...@@ -65,35 +66,35 @@ test "powihf2" {...@@ -65,35 +66,35 @@ test "powihf2" {
65 try test__powihf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);66 try test__powihf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);
66 try test__powihf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);67 try test__powihf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);
6768
68 try test__powihf2(math.inf_f16, 1, math.inf_f16);69 try test__powihf2(inf_f16, 1, inf_f16);
69 try test__powihf2(math.inf_f16, 2, math.inf_f16);70 try test__powihf2(inf_f16, 2, inf_f16);
70 try test__powihf2(math.inf_f16, 3, math.inf_f16);71 try test__powihf2(inf_f16, 3, inf_f16);
71 try test__powihf2(math.inf_f16, 4, math.inf_f16);72 try test__powihf2(inf_f16, 4, inf_f16);
72 try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f16);73 try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f16);
73 try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f16);74 try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f16);
7475
75 try test__powihf2(-math.inf_f16, 1, -math.inf_f16);76 try test__powihf2(-inf_f16, 1, -inf_f16);
76 try test__powihf2(-math.inf_f16, 2, math.inf_f16);77 try test__powihf2(-inf_f16, 2, inf_f16);
77 try test__powihf2(-math.inf_f16, 3, -math.inf_f16);78 try test__powihf2(-inf_f16, 3, -inf_f16);
78 try test__powihf2(-math.inf_f16, 4, math.inf_f16);79 try test__powihf2(-inf_f16, 4, inf_f16);
79 try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f16);80 try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f16);
80 try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f16);81 try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f16);
81 //82 //
82 try test__powihf2(0, -1, math.inf_f16);83 try test__powihf2(0, -1, inf_f16);
83 try test__powihf2(0, -2, math.inf_f16);84 try test__powihf2(0, -2, inf_f16);
84 try test__powihf2(0, -3, math.inf_f16);85 try test__powihf2(0, -3, inf_f16);
85 try test__powihf2(0, -4, math.inf_f16);86 try test__powihf2(0, -4, inf_f16);
86 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f16); // 0 ^ anything = +inf87 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f16); // 0 ^ anything = +inf
87 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f16);88 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f16);
88 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f16);89 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f16);
8990
90 try test__powihf2(-0.0, -1, -math.inf_f16);91 try test__powihf2(-0.0, -1, -inf_f16);
91 try test__powihf2(-0.0, -2, math.inf_f16);92 try test__powihf2(-0.0, -2, inf_f16);
92 try test__powihf2(-0.0, -3, -math.inf_f16);93 try test__powihf2(-0.0, -3, -inf_f16);
93 try test__powihf2(-0.0, -4, math.inf_f16);94 try test__powihf2(-0.0, -4, inf_f16);
94 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f16); // -0 ^ anything even = +inf95 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f16); // -0 ^ anything even = +inf
95 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f16); // -0 ^ anything odd = -inf96 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f16); // -0 ^ anything odd = -inf
96 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f16);97 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f16);
9798
98 try test__powihf2(1, -1, 1);99 try test__powihf2(1, -1, 1);
99 try test__powihf2(1, -2, 1);100 try test__powihf2(1, -2, 1);
...@@ -103,21 +104,21 @@ test "powihf2" {...@@ -103,21 +104,21 @@ test "powihf2" {
103 try test__powihf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);104 try test__powihf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);
104 try test__powihf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);105 try test__powihf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);
105106
106 try test__powihf2(math.inf_f16, -1, 0);107 try test__powihf2(inf_f16, -1, 0);
107 try test__powihf2(math.inf_f16, -2, 0);108 try test__powihf2(inf_f16, -2, 0);
108 try test__powihf2(math.inf_f16, -3, 0);109 try test__powihf2(inf_f16, -3, 0);
109 try test__powihf2(math.inf_f16, -4, 0);110 try test__powihf2(inf_f16, -4, 0);
110 try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x80000002)), 0);111 try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x80000002)), 0);
111 try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x80000001)), 0);112 try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x80000001)), 0);
112 try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x80000000)), 0);113 try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x80000000)), 0);
113 //114 //
114 try test__powihf2(-math.inf_f16, -1, -0.0);115 try test__powihf2(-inf_f16, -1, -0.0);
115 try test__powihf2(-math.inf_f16, -2, 0);116 try test__powihf2(-inf_f16, -2, 0);
116 try test__powihf2(-math.inf_f16, -3, -0.0);117 try test__powihf2(-inf_f16, -3, -0.0);
117 try test__powihf2(-math.inf_f16, -4, 0);118 try test__powihf2(-inf_f16, -4, 0);
118 try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x80000002)), 0);119 try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x80000002)), 0);
119 try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x80000001)), -0.0);120 try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x80000001)), -0.0);
120 try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x80000000)), 0);121 try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x80000000)), 0);
121122
122 try test__powihf2(2, 10, 1024.0);123 try test__powihf2(2, 10, 1024.0);
123 try test__powihf2(-2, 10, 1024.0);124 try test__powihf2(-2, 10, 1024.0);
...@@ -128,8 +129,8 @@ test "powihf2" {...@@ -128,8 +129,8 @@ test "powihf2" {
128 try test__powihf2(-2, 14, 16384.0);129 try test__powihf2(-2, 14, 16384.0);
129 try test__powihf2(2, 15, 32768.0);130 try test__powihf2(2, 15, 32768.0);
130 try test__powihf2(-2, 15, -32768.0);131 try test__powihf2(-2, 15, -32768.0);
131 try test__powihf2(2, 16, math.inf_f16);132 try test__powihf2(2, 16, inf_f16);
132 try test__powihf2(-2, 16, math.inf_f16);133 try test__powihf2(-2, 16, inf_f16);
133134
134 try test__powihf2(2, -13, 1.0 / 8192.0);135 try test__powihf2(2, -13, 1.0 / 8192.0);
135 try test__powihf2(-2, -13, -1.0 / 8192.0);136 try test__powihf2(-2, -13, -1.0 / 8192.0);
...@@ -140,17 +141,18 @@ test "powihf2" {...@@ -140,17 +141,18 @@ test "powihf2" {
140}141}
141142
142test "powisf2" {143test "powisf2" {
144 const inf_f32 = math.inf(f32);
143 try test__powisf2(0, 0, 1);145 try test__powisf2(0, 0, 1);
144 try test__powisf2(1, 0, 1);146 try test__powisf2(1, 0, 1);
145 try test__powisf2(1.5, 0, 1);147 try test__powisf2(1.5, 0, 1);
146 try test__powisf2(2, 0, 1);148 try test__powisf2(2, 0, 1);
147 try test__powisf2(math.inf_f32, 0, 1);149 try test__powisf2(inf_f32, 0, 1);
148150
149 try test__powisf2(-0.0, 0, 1);151 try test__powisf2(-0.0, 0, 1);
150 try test__powisf2(-1, 0, 1);152 try test__powisf2(-1, 0, 1);
151 try test__powisf2(-1.5, 0, 1);153 try test__powisf2(-1.5, 0, 1);
152 try test__powisf2(-2, 0, 1);154 try test__powisf2(-2, 0, 1);
153 try test__powisf2(-math.inf_f32, 0, 1);155 try test__powisf2(-inf_f32, 0, 1);
154156
155 try test__powisf2(0, 1, 0);157 try test__powisf2(0, 1, 0);
156 try test__powisf2(0, 2, 0);158 try test__powisf2(0, 2, 0);
...@@ -173,35 +175,35 @@ test "powisf2" {...@@ -173,35 +175,35 @@ test "powisf2" {
173 try test__powisf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);175 try test__powisf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);
174 try test__powisf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);176 try test__powisf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);
175177
176 try test__powisf2(math.inf_f32, 1, math.inf_f32);178 try test__powisf2(inf_f32, 1, inf_f32);
177 try test__powisf2(math.inf_f32, 2, math.inf_f32);179 try test__powisf2(inf_f32, 2, inf_f32);
178 try test__powisf2(math.inf_f32, 3, math.inf_f32);180 try test__powisf2(inf_f32, 3, inf_f32);
179 try test__powisf2(math.inf_f32, 4, math.inf_f32);181 try test__powisf2(inf_f32, 4, inf_f32);
180 try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f32);182 try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f32);
181 try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f32);183 try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f32);
182184
183 try test__powisf2(-math.inf_f32, 1, -math.inf_f32);185 try test__powisf2(-inf_f32, 1, -inf_f32);
184 try test__powisf2(-math.inf_f32, 2, math.inf_f32);186 try test__powisf2(-inf_f32, 2, inf_f32);
185 try test__powisf2(-math.inf_f32, 3, -math.inf_f32);187 try test__powisf2(-inf_f32, 3, -inf_f32);
186 try test__powisf2(-math.inf_f32, 4, math.inf_f32);188 try test__powisf2(-inf_f32, 4, inf_f32);
187 try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f32);189 try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f32);
188 try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f32);190 try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f32);
189191
190 try test__powisf2(0, -1, math.inf_f32);192 try test__powisf2(0, -1, inf_f32);
191 try test__powisf2(0, -2, math.inf_f32);193 try test__powisf2(0, -2, inf_f32);
192 try test__powisf2(0, -3, math.inf_f32);194 try test__powisf2(0, -3, inf_f32);
193 try test__powisf2(0, -4, math.inf_f32);195 try test__powisf2(0, -4, inf_f32);
194 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f32);196 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f32);
195 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f32);197 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f32);
196 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f32);198 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f32);
197199
198 try test__powisf2(-0.0, -1, -math.inf_f32);200 try test__powisf2(-0.0, -1, -inf_f32);
199 try test__powisf2(-0.0, -2, math.inf_f32);201 try test__powisf2(-0.0, -2, inf_f32);
200 try test__powisf2(-0.0, -3, -math.inf_f32);202 try test__powisf2(-0.0, -3, -inf_f32);
201 try test__powisf2(-0.0, -4, math.inf_f32);203 try test__powisf2(-0.0, -4, inf_f32);
202 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f32);204 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f32);
203 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f32);205 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f32);
204 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f32);206 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f32);
205207
206 try test__powisf2(1, -1, 1);208 try test__powisf2(1, -1, 1);
207 try test__powisf2(1, -2, 1);209 try test__powisf2(1, -2, 1);
...@@ -211,21 +213,21 @@ test "powisf2" {...@@ -211,21 +213,21 @@ test "powisf2" {
211 try test__powisf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);213 try test__powisf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);
212 try test__powisf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);214 try test__powisf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);
213215
214 try test__powisf2(math.inf_f32, -1, 0);216 try test__powisf2(inf_f32, -1, 0);
215 try test__powisf2(math.inf_f32, -2, 0);217 try test__powisf2(inf_f32, -2, 0);
216 try test__powisf2(math.inf_f32, -3, 0);218 try test__powisf2(inf_f32, -3, 0);
217 try test__powisf2(math.inf_f32, -4, 0);219 try test__powisf2(inf_f32, -4, 0);
218 try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0);220 try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0);
219 try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x80000001)), 0);221 try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x80000001)), 0);
220 try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0);222 try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0);
221223
222 try test__powisf2(-math.inf_f32, -1, -0.0);224 try test__powisf2(-inf_f32, -1, -0.0);
223 try test__powisf2(-math.inf_f32, -2, 0);225 try test__powisf2(-inf_f32, -2, 0);
224 try test__powisf2(-math.inf_f32, -3, -0.0);226 try test__powisf2(-inf_f32, -3, -0.0);
225 try test__powisf2(-math.inf_f32, -4, 0);227 try test__powisf2(-inf_f32, -4, 0);
226 try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0);228 try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0);
227 try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x80000001)), -0.0);229 try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x80000001)), -0.0);
228 try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0);230 try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0);
229231
230 try test__powisf2(2.0, 10, 1024.0);232 try test__powisf2(2.0, 10, 1024.0);
231 try test__powisf2(-2, 10, 1024.0);233 try test__powisf2(-2, 10, 1024.0);
...@@ -244,17 +246,18 @@ test "powisf2" {...@@ -244,17 +246,18 @@ test "powisf2" {
244}246}
245247
246test "powidf2" {248test "powidf2" {
249 const inf_f64 = math.inf(f64);
247 try test__powidf2(0, 0, 1);250 try test__powidf2(0, 0, 1);
248 try test__powidf2(1, 0, 1);251 try test__powidf2(1, 0, 1);
249 try test__powidf2(1.5, 0, 1);252 try test__powidf2(1.5, 0, 1);
250 try test__powidf2(2, 0, 1);253 try test__powidf2(2, 0, 1);
251 try test__powidf2(math.inf_f64, 0, 1);254 try test__powidf2(inf_f64, 0, 1);
252255
253 try test__powidf2(-0.0, 0, 1);256 try test__powidf2(-0.0, 0, 1);
254 try test__powidf2(-1, 0, 1);257 try test__powidf2(-1, 0, 1);
255 try test__powidf2(-1.5, 0, 1);258 try test__powidf2(-1.5, 0, 1);
256 try test__powidf2(-2, 0, 1);259 try test__powidf2(-2, 0, 1);
257 try test__powidf2(-math.inf_f64, 0, 1);260 try test__powidf2(-inf_f64, 0, 1);
258261
259 try test__powidf2(0, 1, 0);262 try test__powidf2(0, 1, 0);
260 try test__powidf2(0, 2, 0);263 try test__powidf2(0, 2, 0);
...@@ -277,35 +280,35 @@ test "powidf2" {...@@ -277,35 +280,35 @@ test "powidf2" {
277 try test__powidf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);280 try test__powidf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);
278 try test__powidf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);281 try test__powidf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);
279282
280 try test__powidf2(math.inf_f64, 1, math.inf_f64);283 try test__powidf2(inf_f64, 1, inf_f64);
281 try test__powidf2(math.inf_f64, 2, math.inf_f64);284 try test__powidf2(inf_f64, 2, inf_f64);
282 try test__powidf2(math.inf_f64, 3, math.inf_f64);285 try test__powidf2(inf_f64, 3, inf_f64);
283 try test__powidf2(math.inf_f64, 4, math.inf_f64);286 try test__powidf2(inf_f64, 4, inf_f64);
284 try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f64);287 try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f64);
285 try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f64);288 try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f64);
286289
287 try test__powidf2(-math.inf_f64, 1, -math.inf_f64);290 try test__powidf2(-inf_f64, 1, -inf_f64);
288 try test__powidf2(-math.inf_f64, 2, math.inf_f64);291 try test__powidf2(-inf_f64, 2, inf_f64);
289 try test__powidf2(-math.inf_f64, 3, -math.inf_f64);292 try test__powidf2(-inf_f64, 3, -inf_f64);
290 try test__powidf2(-math.inf_f64, 4, math.inf_f64);293 try test__powidf2(-inf_f64, 4, inf_f64);
291 try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f64);294 try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f64);
292 try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f64);295 try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f64);
293296
294 try test__powidf2(0, -1, math.inf_f64);297 try test__powidf2(0, -1, inf_f64);
295 try test__powidf2(0, -2, math.inf_f64);298 try test__powidf2(0, -2, inf_f64);
296 try test__powidf2(0, -3, math.inf_f64);299 try test__powidf2(0, -3, inf_f64);
297 try test__powidf2(0, -4, math.inf_f64);300 try test__powidf2(0, -4, inf_f64);
298 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f64);301 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f64);
299 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f64);302 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f64);
300 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f64);303 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f64);
301304
302 try test__powidf2(-0.0, -1, -math.inf_f64);305 try test__powidf2(-0.0, -1, -inf_f64);
303 try test__powidf2(-0.0, -2, math.inf_f64);306 try test__powidf2(-0.0, -2, inf_f64);
304 try test__powidf2(-0.0, -3, -math.inf_f64);307 try test__powidf2(-0.0, -3, -inf_f64);
305 try test__powidf2(-0.0, -4, math.inf_f64);308 try test__powidf2(-0.0, -4, inf_f64);
306 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f64);309 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f64);
307 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f64);310 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f64);
308 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f64);311 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f64);
309312
310 try test__powidf2(1, -1, 1);313 try test__powidf2(1, -1, 1);
311 try test__powidf2(1, -2, 1);314 try test__powidf2(1, -2, 1);
...@@ -315,21 +318,21 @@ test "powidf2" {...@@ -315,21 +318,21 @@ test "powidf2" {
315 try test__powidf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);318 try test__powidf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);
316 try test__powidf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);319 try test__powidf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);
317320
318 try test__powidf2(math.inf_f64, -1, 0);321 try test__powidf2(inf_f64, -1, 0);
319 try test__powidf2(math.inf_f64, -2, 0);322 try test__powidf2(inf_f64, -2, 0);
320 try test__powidf2(math.inf_f64, -3, 0);323 try test__powidf2(inf_f64, -3, 0);
321 try test__powidf2(math.inf_f64, -4, 0);324 try test__powidf2(inf_f64, -4, 0);
322 try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0);325 try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0);
323 try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x80000001)), 0);326 try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x80000001)), 0);
324 try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0);327 try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0);
325328
326 try test__powidf2(-math.inf_f64, -1, -0.0);329 try test__powidf2(-inf_f64, -1, -0.0);
327 try test__powidf2(-math.inf_f64, -2, 0);330 try test__powidf2(-inf_f64, -2, 0);
328 try test__powidf2(-math.inf_f64, -3, -0.0);331 try test__powidf2(-inf_f64, -3, -0.0);
329 try test__powidf2(-math.inf_f64, -4, 0);332 try test__powidf2(-inf_f64, -4, 0);
330 try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0);333 try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0);
331 try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x80000001)), -0.0);334 try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x80000001)), -0.0);
332 try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0);335 try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0);
333336
334 try test__powidf2(2, 10, 1024.0);337 try test__powidf2(2, 10, 1024.0);
335 try test__powidf2(-2, 10, 1024.0);338 try test__powidf2(-2, 10, 1024.0);
...@@ -348,17 +351,18 @@ test "powidf2" {...@@ -348,17 +351,18 @@ test "powidf2" {
348}351}
349352
350test "powitf2" {353test "powitf2" {
354 const inf_f128 = math.inf(f128);
351 try test__powitf2(0, 0, 1);355 try test__powitf2(0, 0, 1);
352 try test__powitf2(1, 0, 1);356 try test__powitf2(1, 0, 1);
353 try test__powitf2(1.5, 0, 1);357 try test__powitf2(1.5, 0, 1);
354 try test__powitf2(2, 0, 1);358 try test__powitf2(2, 0, 1);
355 try test__powitf2(math.inf_f128, 0, 1);359 try test__powitf2(inf_f128, 0, 1);
356360
357 try test__powitf2(-0.0, 0, 1);361 try test__powitf2(-0.0, 0, 1);
358 try test__powitf2(-1, 0, 1);362 try test__powitf2(-1, 0, 1);
359 try test__powitf2(-1.5, 0, 1);363 try test__powitf2(-1.5, 0, 1);
360 try test__powitf2(-2, 0, 1);364 try test__powitf2(-2, 0, 1);
361 try test__powitf2(-math.inf_f128, 0, 1);365 try test__powitf2(-inf_f128, 0, 1);
362366
363 try test__powitf2(0, 1, 0);367 try test__powitf2(0, 1, 0);
364 try test__powitf2(0, 2, 0);368 try test__powitf2(0, 2, 0);
...@@ -381,35 +385,35 @@ test "powitf2" {...@@ -381,35 +385,35 @@ test "powitf2" {
381 try test__powitf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);385 try test__powitf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);
382 try test__powitf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);386 try test__powitf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);
383387
384 try test__powitf2(math.inf_f128, 1, math.inf_f128);388 try test__powitf2(inf_f128, 1, inf_f128);
385 try test__powitf2(math.inf_f128, 2, math.inf_f128);389 try test__powitf2(inf_f128, 2, inf_f128);
386 try test__powitf2(math.inf_f128, 3, math.inf_f128);390 try test__powitf2(inf_f128, 3, inf_f128);
387 try test__powitf2(math.inf_f128, 4, math.inf_f128);391 try test__powitf2(inf_f128, 4, inf_f128);
388 try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f128);392 try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f128);
389 try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f128);393 try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f128);
390394
391 try test__powitf2(-math.inf_f128, 1, -math.inf_f128);395 try test__powitf2(-inf_f128, 1, -inf_f128);
392 try test__powitf2(-math.inf_f128, 2, math.inf_f128);396 try test__powitf2(-inf_f128, 2, inf_f128);
393 try test__powitf2(-math.inf_f128, 3, -math.inf_f128);397 try test__powitf2(-inf_f128, 3, -inf_f128);
394 try test__powitf2(-math.inf_f128, 4, math.inf_f128);398 try test__powitf2(-inf_f128, 4, inf_f128);
395 try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f128);399 try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f128);
396 try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f128);400 try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f128);
397401
398 try test__powitf2(0, -1, math.inf_f128);402 try test__powitf2(0, -1, inf_f128);
399 try test__powitf2(0, -2, math.inf_f128);403 try test__powitf2(0, -2, inf_f128);
400 try test__powitf2(0, -3, math.inf_f128);404 try test__powitf2(0, -3, inf_f128);
401 try test__powitf2(0, -4, math.inf_f128);405 try test__powitf2(0, -4, inf_f128);
402 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f128);406 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f128);
403 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f128);407 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f128);
404 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f128);408 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f128);
405409
406 try test__powitf2(-0.0, -1, -math.inf_f128);410 try test__powitf2(-0.0, -1, -inf_f128);
407 try test__powitf2(-0.0, -2, math.inf_f128);411 try test__powitf2(-0.0, -2, inf_f128);
408 try test__powitf2(-0.0, -3, -math.inf_f128);412 try test__powitf2(-0.0, -3, -inf_f128);
409 try test__powitf2(-0.0, -4, math.inf_f128);413 try test__powitf2(-0.0, -4, inf_f128);
410 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f128);414 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f128);
411 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f128);415 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f128);
412 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f128);416 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f128);
413417
414 try test__powitf2(1, -1, 1);418 try test__powitf2(1, -1, 1);
415 try test__powitf2(1, -2, 1);419 try test__powitf2(1, -2, 1);
...@@ -419,21 +423,21 @@ test "powitf2" {...@@ -419,21 +423,21 @@ test "powitf2" {
419 try test__powitf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);423 try test__powitf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);
420 try test__powitf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);424 try test__powitf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);
421425
422 try test__powitf2(math.inf_f128, -1, 0);426 try test__powitf2(inf_f128, -1, 0);
423 try test__powitf2(math.inf_f128, -2, 0);427 try test__powitf2(inf_f128, -2, 0);
424 try test__powitf2(math.inf_f128, -3, 0);428 try test__powitf2(inf_f128, -3, 0);
425 try test__powitf2(math.inf_f128, -4, 0);429 try test__powitf2(inf_f128, -4, 0);
426 try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0);430 try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0);
427 try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x80000001)), 0);431 try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x80000001)), 0);
428 try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0);432 try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0);
429433
430 try test__powitf2(-math.inf_f128, -1, -0.0);434 try test__powitf2(-inf_f128, -1, -0.0);
431 try test__powitf2(-math.inf_f128, -2, 0);435 try test__powitf2(-inf_f128, -2, 0);
432 try test__powitf2(-math.inf_f128, -3, -0.0);436 try test__powitf2(-inf_f128, -3, -0.0);
433 try test__powitf2(-math.inf_f128, -4, 0);437 try test__powitf2(-inf_f128, -4, 0);
434 try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0);438 try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0);
435 try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x80000001)), -0.0);439 try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x80000001)), -0.0);
436 try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0);440 try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0);
437441
438 try test__powitf2(2, 10, 1024.0);442 try test__powitf2(2, 10, 1024.0);
439 try test__powitf2(-2, 10, 1024.0);443 try test__powitf2(-2, 10, 1024.0);
...@@ -452,17 +456,18 @@ test "powitf2" {...@@ -452,17 +456,18 @@ test "powitf2" {
452}456}
453457
454test "powixf2" {458test "powixf2" {
459 const inf_f80 = math.inf(f80);
455 try test__powixf2(0, 0, 1);460 try test__powixf2(0, 0, 1);
456 try test__powixf2(1, 0, 1);461 try test__powixf2(1, 0, 1);
457 try test__powixf2(1.5, 0, 1);462 try test__powixf2(1.5, 0, 1);
458 try test__powixf2(2, 0, 1);463 try test__powixf2(2, 0, 1);
459 try test__powixf2(math.inf_f80, 0, 1);464 try test__powixf2(inf_f80, 0, 1);
460465
461 try test__powixf2(-0.0, 0, 1);466 try test__powixf2(-0.0, 0, 1);
462 try test__powixf2(-1, 0, 1);467 try test__powixf2(-1, 0, 1);
463 try test__powixf2(-1.5, 0, 1);468 try test__powixf2(-1.5, 0, 1);
464 try test__powixf2(-2, 0, 1);469 try test__powixf2(-2, 0, 1);
465 try test__powixf2(-math.inf_f80, 0, 1);470 try test__powixf2(-inf_f80, 0, 1);
466471
467 try test__powixf2(0, 1, 0);472 try test__powixf2(0, 1, 0);
468 try test__powixf2(0, 2, 0);473 try test__powixf2(0, 2, 0);
...@@ -485,35 +490,35 @@ test "powixf2" {...@@ -485,35 +490,35 @@ test "powixf2" {
485 try test__powixf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);490 try test__powixf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);
486 try test__powixf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);491 try test__powixf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);
487492
488 try test__powixf2(math.inf_f80, 1, math.inf_f80);493 try test__powixf2(inf_f80, 1, inf_f80);
489 try test__powixf2(math.inf_f80, 2, math.inf_f80);494 try test__powixf2(inf_f80, 2, inf_f80);
490 try test__powixf2(math.inf_f80, 3, math.inf_f80);495 try test__powixf2(inf_f80, 3, inf_f80);
491 try test__powixf2(math.inf_f80, 4, math.inf_f80);496 try test__powixf2(inf_f80, 4, inf_f80);
492 try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f80);497 try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f80);
493 try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f80);498 try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f80);
494499
495 try test__powixf2(-math.inf_f80, 1, -math.inf_f80);500 try test__powixf2(-inf_f80, 1, -inf_f80);
496 try test__powixf2(-math.inf_f80, 2, math.inf_f80);501 try test__powixf2(-inf_f80, 2, inf_f80);
497 try test__powixf2(-math.inf_f80, 3, -math.inf_f80);502 try test__powixf2(-inf_f80, 3, -inf_f80);
498 try test__powixf2(-math.inf_f80, 4, math.inf_f80);503 try test__powixf2(-inf_f80, 4, inf_f80);
499 try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f80);504 try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f80);
500 try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f80);505 try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f80);
501506
502 try test__powixf2(0, -1, math.inf_f80);507 try test__powixf2(0, -1, inf_f80);
503 try test__powixf2(0, -2, math.inf_f80);508 try test__powixf2(0, -2, inf_f80);
504 try test__powixf2(0, -3, math.inf_f80);509 try test__powixf2(0, -3, inf_f80);
505 try test__powixf2(0, -4, math.inf_f80);510 try test__powixf2(0, -4, inf_f80);
506 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f80);511 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f80);
507 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f80);512 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f80);
508 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f80);513 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f80);
509514
510 try test__powixf2(-0.0, -1, -math.inf_f80);515 try test__powixf2(-0.0, -1, -inf_f80);
511 try test__powixf2(-0.0, -2, math.inf_f80);516 try test__powixf2(-0.0, -2, inf_f80);
512 try test__powixf2(-0.0, -3, -math.inf_f80);517 try test__powixf2(-0.0, -3, -inf_f80);
513 try test__powixf2(-0.0, -4, math.inf_f80);518 try test__powixf2(-0.0, -4, inf_f80);
514 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f80);519 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f80);
515 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f80);520 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f80);
516 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f80);521 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f80);
517522
518 try test__powixf2(1, -1, 1);523 try test__powixf2(1, -1, 1);
519 try test__powixf2(1, -2, 1);524 try test__powixf2(1, -2, 1);
...@@ -523,21 +528,21 @@ test "powixf2" {...@@ -523,21 +528,21 @@ test "powixf2" {
523 try test__powixf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);528 try test__powixf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);
524 try test__powixf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);529 try test__powixf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);
525530
526 try test__powixf2(math.inf_f80, -1, 0);531 try test__powixf2(inf_f80, -1, 0);
527 try test__powixf2(math.inf_f80, -2, 0);532 try test__powixf2(inf_f80, -2, 0);
528 try test__powixf2(math.inf_f80, -3, 0);533 try test__powixf2(inf_f80, -3, 0);
529 try test__powixf2(math.inf_f80, -4, 0);534 try test__powixf2(inf_f80, -4, 0);
530 try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0);535 try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0);
531 try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x80000001)), 0);536 try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x80000001)), 0);
532 try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0);537 try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0);
533538
534 try test__powixf2(-math.inf_f80, -1, -0.0);539 try test__powixf2(-inf_f80, -1, -0.0);
535 try test__powixf2(-math.inf_f80, -2, 0);540 try test__powixf2(-inf_f80, -2, 0);
536 try test__powixf2(-math.inf_f80, -3, -0.0);541 try test__powixf2(-inf_f80, -3, -0.0);
537 try test__powixf2(-math.inf_f80, -4, 0);542 try test__powixf2(-inf_f80, -4, 0);
538 try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0);543 try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0);
539 try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x80000001)), -0.0);544 try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x80000001)), -0.0);
540 try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0);545 try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0);
541546
542 try test__powixf2(2, 10, 1024.0);547 try test__powixf2(2, 10, 1024.0);
543 try test__powixf2(-2, 10, 1024.0);548 try test__powixf2(-2, 10, 1024.0);
lib/std/Build/Step/Compile.zig-5
...@@ -1032,11 +1032,6 @@ pub fn addObject(self: *Compile, obj: *Compile) void {...@@ -1032,11 +1032,6 @@ pub fn addObject(self: *Compile, obj: *Compile) void {
1032 self.linkLibraryOrObject(obj);1032 self.linkLibraryOrObject(obj);
1033}1033}
10341034
1035pub const addSystemIncludeDir = @compileError("deprecated; use addSystemIncludePath");
1036pub const addIncludeDir = @compileError("deprecated; use addIncludePath");
1037pub const addLibPath = @compileError("deprecated, use addLibraryPath");
1038pub const addFrameworkDir = @compileError("deprecated, use addFrameworkPath");
1039
1040pub fn addSystemIncludePath(self: *Compile, path: []const u8) void {1035pub fn addSystemIncludePath(self: *Compile, path: []const u8) void {
1041 const b = self.step.owner;1036 const b = self.step.owner;
1042 self.include_dirs.append(IncludeDir{ .raw_path_system = b.dupe(path) }) catch @panic("OOM");1037 self.include_dirs.append(IncludeDir{ .raw_path_system = b.dupe(path) }) catch @panic("OOM");
lib/std/base64.zig+2-2
...@@ -302,7 +302,7 @@ pub const Base64DecoderWithIgnore = struct {...@@ -302,7 +302,7 @@ pub const Base64DecoderWithIgnore = struct {
302test "base64" {302test "base64" {
303 @setEvalBranchQuota(8000);303 @setEvalBranchQuota(8000);
304 try testBase64();304 try testBase64();
305 comptime try testAllApis(standard, "comptime", "Y29tcHRpbWU=");305 try comptime testAllApis(standard, "comptime", "Y29tcHRpbWU=");
306}306}
307307
308test "base64 padding dest overflow" {308test "base64 padding dest overflow" {
...@@ -322,7 +322,7 @@ test "base64 padding dest overflow" {...@@ -322,7 +322,7 @@ test "base64 padding dest overflow" {
322test "base64 url_safe_no_pad" {322test "base64 url_safe_no_pad" {
323 @setEvalBranchQuota(8000);323 @setEvalBranchQuota(8000);
324 try testBase64UrlSafeNoPad();324 try testBase64UrlSafeNoPad();
325 comptime try testAllApis(url_safe_no_pad, "comptime", "Y29tcHRpbWU");325 try comptime testAllApis(url_safe_no_pad, "comptime", "Y29tcHRpbWU");
326}326}
327327
328fn testBase64() !void {328fn testBase64() !void {
lib/std/builtin.zig-3
...@@ -221,7 +221,6 @@ pub const SourceLocation = struct {...@@ -221,7 +221,6 @@ pub const SourceLocation = struct {
221};221};
222222
223pub const TypeId = std.meta.Tag(Type);223pub const TypeId = std.meta.Tag(Type);
224pub const TypeInfo = @compileError("deprecated; use Type");
225224
226/// This data structure is used by the Zig language code generation and225/// This data structure is used by the Zig language code generation and
227/// therefore must be kept in sync with the compiler implementation.226/// therefore must be kept in sync with the compiler implementation.
...@@ -388,8 +387,6 @@ pub const Type = union(enum) {...@@ -388,8 +387,6 @@ pub const Type = union(enum) {
388 decls: []const Declaration,387 decls: []const Declaration,
389 };388 };
390389
391 pub const FnArg = @compileError("deprecated; use Fn.Param");
392
393 /// This data structure is used by the Zig language code generation and390 /// This data structure is used by the Zig language code generation and
394 /// therefore must be kept in sync with the compiler implementation.391 /// therefore must be kept in sync with the compiler implementation.
395 pub const Fn = struct {392 pub const Fn = struct {
lib/std/crypto/25519/ed25519.zig-6
...@@ -480,13 +480,7 @@ pub const Ed25519 = struct {...@@ -480,13 +480,7 @@ pub const Ed25519 = struct {
480 hx.final(&blind_h);480 hx.final(&blind_h);
481 return blind_h;481 return blind_h;
482 }482 }
483
484 pub const sign = @compileError("deprecated; use BlindKeyPair.sign instead");
485 pub const unblindPublicKey = @compileError("deprecated; use BlindPublicKey.unblind instead");
486 };483 };
487
488 pub const sign = @compileError("deprecated; use KeyPair.sign instead");
489 pub const verify = @compileError("deprecated; use PublicKey.verify instead");
490};484};
491485
492test "ed25519 key pair creation" {486test "ed25519 key pair creation" {
lib/std/cstr.zig+1-1
...@@ -22,7 +22,7 @@ pub fn cmp(a: [*:0]const u8, b: [*:0]const u8) i8 {...@@ -22,7 +22,7 @@ pub fn cmp(a: [*:0]const u8, b: [*:0]const u8) i8 {
22}22}
2323
24test "cstr fns" {24test "cstr fns" {
25 comptime try testCStrFnsImpl();25 try comptime testCStrFnsImpl();
26 try testCStrFnsImpl();26 try testCStrFnsImpl();
27}27}
2828
lib/std/debug.zig-2
...@@ -81,8 +81,6 @@ const PdbOrDwarf = union(enum) {...@@ -81,8 +81,6 @@ const PdbOrDwarf = union(enum) {
8181
82var stderr_mutex = std.Thread.Mutex{};82var stderr_mutex = std.Thread.Mutex{};
8383
84pub const warn = @compileError("deprecated; use `std.log` functions for logging or `std.debug.print` for 'printf debugging'");
85
86/// Print to stderr, unbuffered, and silently returning on failure. Intended84/// Print to stderr, unbuffered, and silently returning on failure. Intended
87/// for use in "printf debugging." Use `std.log` functions for proper logging.85/// for use in "printf debugging." Use `std.log` functions for proper logging.
88pub fn print(comptime fmt: []const u8, args: anytype) void {86pub fn print(comptime fmt: []const u8, args: anytype) void {
lib/std/fifo.zig-2
...@@ -117,8 +117,6 @@ pub fn LinearFifo(...@@ -117,8 +117,6 @@ pub fn LinearFifo(
117 }117 }
118 }118 }
119119
120 pub const ensureCapacity = @compileError("deprecated; call `ensureUnusedCapacity` or `ensureTotalCapacity`");
121
122 /// Ensure that the buffer can fit at least `size` items120 /// Ensure that the buffer can fit at least `size` items
123 pub fn ensureTotalCapacity(self: *Self, size: usize) !void {121 pub fn ensureTotalCapacity(self: *Self, size: usize) !void {
124 if (self.buf.len >= size) return;122 if (self.buf.len >= size) return;
lib/std/fmt.zig+2-10
...@@ -727,12 +727,6 @@ fn formatValue(...@@ -727,12 +727,6 @@ fn formatValue(
727 options: FormatOptions,727 options: FormatOptions,
728 writer: anytype,728 writer: anytype,
729) !void {729) !void {
730 if (comptime std.mem.eql(u8, fmt, "B")) {
731 @compileError("specifier 'B' has been deprecated, wrap your argument in std.fmt.fmtIntSizeDec instead");
732 } else if (comptime std.mem.eql(u8, fmt, "Bi")) {
733 @compileError("specifier 'Bi' has been deprecated, wrap your argument in std.fmt.fmtIntSizeBin instead");
734 }
735
736 const T = @TypeOf(value);730 const T = @TypeOf(value);
737 switch (@typeInfo(T)) {731 switch (@typeInfo(T)) {
738 .Float, .ComptimeFloat => return formatFloatValue(value, fmt, options, writer),732 .Float, .ComptimeFloat => return formatFloatValue(value, fmt, options, writer),
...@@ -977,12 +971,10 @@ fn checkTextFmt(comptime fmt: []const u8) void {...@@ -977,12 +971,10 @@ fn checkTextFmt(comptime fmt: []const u8) void {
977 if (fmt.len != 1)971 if (fmt.len != 1)
978 @compileError("unsupported format string '" ++ fmt ++ "' when formatting text");972 @compileError("unsupported format string '" ++ fmt ++ "' when formatting text");
979 switch (fmt[0]) {973 switch (fmt[0]) {
974 // Example of deprecation:
975 // '[deprecated_specifier]' => @compileError("specifier '[deprecated_specifier]' has been deprecated, wrap your argument in `std.some_function` instead"),
980 'x' => @compileError("specifier 'x' has been deprecated, wrap your argument in std.fmt.fmtSliceHexLower instead"),976 'x' => @compileError("specifier 'x' has been deprecated, wrap your argument in std.fmt.fmtSliceHexLower instead"),
981 'X' => @compileError("specifier 'X' has been deprecated, wrap your argument in std.fmt.fmtSliceHexUpper instead"),977 'X' => @compileError("specifier 'X' has been deprecated, wrap your argument in std.fmt.fmtSliceHexUpper instead"),
982 'e' => @compileError("specifier 'e' has been deprecated, wrap your argument in std.fmt.fmtSliceEscapeLower instead"),
983 'E' => @compileError("specifier 'E' has been deprecated, wrap your argument in std.fmt.fmtSliceEscapeUpper instead"),
984 'z' => @compileError("specifier 'z' has been deprecated, wrap your argument in std.zig.fmtId instead"),
985 'Z' => @compileError("specifier 'Z' has been deprecated, wrap your argument in std.zig.fmtEscapes instead"),
986 else => {},978 else => {},
987 }979 }
988}980}
lib/std/hash/auto_hash.zig+4-4
...@@ -408,13 +408,13 @@ test "testHash union" {...@@ -408,13 +408,13 @@ test "testHash union" {
408}408}
409409
410test "testHash vector" {410test "testHash vector" {
411 const a: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };411 const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
412 const b: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };412 const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
413 try testing.expect(testHash(a) == testHash(a));413 try testing.expect(testHash(a) == testHash(a));
414 try testing.expect(testHash(a) != testHash(b));414 try testing.expect(testHash(a) != testHash(b));
415415
416 const c: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 4 };416 const c: @Vector(4, u31) = [_]u31{ 1, 2, 3, 4 };
417 const d: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 5 };417 const d: @Vector(4, u31) = [_]u31{ 1, 2, 3, 5 };
418 try testing.expect(testHash(c) == testHash(c));418 try testing.expect(testHash(c) == testHash(c));
419 try testing.expect(testHash(c) != testHash(d));419 try testing.expect(testHash(c) != testHash(d));
420}420}
lib/std/io.zig-3
...@@ -148,9 +148,6 @@ pub const changeDetectionStream = @import("io/change_detection_stream.zig").chan...@@ -148,9 +148,6 @@ pub const changeDetectionStream = @import("io/change_detection_stream.zig").chan
148pub const FindByteWriter = @import("io/find_byte_writer.zig").FindByteWriter;148pub const FindByteWriter = @import("io/find_byte_writer.zig").FindByteWriter;
149pub const findByteWriter = @import("io/find_byte_writer.zig").findByteWriter;149pub const findByteWriter = @import("io/find_byte_writer.zig").findByteWriter;
150150
151pub const FindByteOutStream = @compileError("deprecated; use `FindByteWriter`");
152pub const findByteOutStream = @compileError("deprecated; use `findByteWriter`");
153
154pub const BufferedAtomicFile = @import("io/buffered_atomic_file.zig").BufferedAtomicFile;151pub const BufferedAtomicFile = @import("io/buffered_atomic_file.zig").BufferedAtomicFile;
155152
156pub const StreamSource = @import("io/stream_source.zig").StreamSource;153pub const StreamSource = @import("io/stream_source.zig").StreamSource;
lib/std/math.zig+134-51
...@@ -48,43 +48,41 @@ pub const floatMax = @import("math/float.zig").floatMax;...@@ -48,43 +48,41 @@ pub const floatMax = @import("math/float.zig").floatMax;
48pub const floatEps = @import("math/float.zig").floatEps;48pub const floatEps = @import("math/float.zig").floatEps;
49pub const inf = @import("math/float.zig").inf;49pub const inf = @import("math/float.zig").inf;
5050
51// TODO Replace with @compileError("deprecated for foobar") after 0.10.0 is released.51pub const f16_true_min = @compileError("Deprecated: use `floatTrueMin(f16)` instead");
52pub const f16_true_min: comptime_float = floatTrueMin(f16); // prev: 0.00000005960464477539062552pub const f32_true_min = @compileError("Deprecated: use `floatTrueMin(f32)` instead");
53pub const f32_true_min: comptime_float = floatTrueMin(f32); // prev: 1.40129846432481707092e-4553pub const f64_true_min = @compileError("Deprecated: use `floatTrueMin(f64)` instead");
54pub const f64_true_min: comptime_float = floatTrueMin(f64); // prev: 4.94065645841246544177e-32454pub const f80_true_min = @compileError("Deprecated: use `floatTrueMin(f80)` instead");
55pub const f80_true_min = floatTrueMin(f80); // prev: make_f80(.{ .fraction = 1, .exp = 0 })55pub const f128_true_min = @compileError("Deprecated: use `floatTrueMin(f128)` instead");
56pub const f128_true_min = floatTrueMin(f128); // prev: @bitCast(f128, @as(u128, 0x00000000000000000000000000000001))56pub const f16_min = @compileError("Deprecated: use `floatMin(f16)` instead");
57pub const f16_min: comptime_float = floatMin(f16); // prev: 0.0000610351562557pub const f32_min = @compileError("Deprecated: use `floatMin(f32)` instead");
58pub const f32_min: comptime_float = floatMin(f32); // prev: 1.17549435082228750797e-3858pub const f64_min = @compileError("Deprecated: use `floatMin(f64)` instead");
59pub const f64_min: comptime_float = floatMin(f64); // prev: 2.2250738585072014e-30859pub const f80_min = @compileError("Deprecated: use `floatMin(f80)` instead");
60pub const f80_min = floatMin(f80); // prev: make_f80(.{ .fraction = 0x8000000000000000, .exp = 1 })60pub const f128_min = @compileError("Deprecated: use `floatMin(f128)` instead");
61pub const f128_min = floatMin(f128); // prev: @bitCast(f128, @as(u128, 0x00010000000000000000000000000000))61pub const f16_max = @compileError("Deprecated: use `floatMax(f16)` instead");
62pub const f16_max: comptime_float = floatMax(f16); // prev: 6550462pub const f32_max = @compileError("Deprecated: use `floatMax(f32)` instead");
63pub const f32_max: comptime_float = floatMax(f32); // prev: 3.40282346638528859812e+3863pub const f64_max = @compileError("Deprecated: use `floatMax(f64)` instead");
64pub const f64_max: comptime_float = floatMax(f64); // prev: 1.79769313486231570815e+30864pub const f80_max = @compileError("Deprecated: use `floatMax(f80)` instead");
65pub const f80_max = floatMax(f80); // prev: make_f80(.{ .fraction = 0xFFFFFFFFFFFFFFFF, .exp = 0x7FFE })65pub const f128_max = @compileError("Deprecated: use `floatMax(f128)` instead");
66pub const f128_max = floatMax(f128); // prev: @bitCast(f128, @as(u128, 0x7FFEFFFFFFFFFFFFFFFFFFFFFFFFFFFF))66pub const f16_epsilon = @compileError("Deprecated: use `floatEps(f16)` instead");
67pub const f16_epsilon: comptime_float = floatEps(f16); // prev: 0.000976562567pub const f32_epsilon = @compileError("Deprecated: use `floatEps(f32)` instead");
68pub const f32_epsilon: comptime_float = floatEps(f32); // prev: 1.1920928955078125e-0768pub const f64_epsilon = @compileError("Deprecated: use `floatEps(f64)` instead");
69pub const f64_epsilon: comptime_float = floatEps(f64); // prev: 2.22044604925031308085e-1669pub const f80_epsilon = @compileError("Deprecated: use `floatEps(f80)` instead");
70pub const f80_epsilon = floatEps(f80); // prev: make_f80(.{ .fraction = 0x8000000000000000, .exp = 0x3FC0 })70pub const f128_epsilon = @compileError("Deprecated: use `floatEps(f128)` instead");
71pub const f128_epsilon = floatEps(f128); // prev: @bitCast(f128, @as(u128, 0x3F8F0000000000000000000000000000))71pub const f16_toint = @compileError("Deprecated: use `1.0 / floatEps(f16)` instead");
72pub const f16_toint: comptime_float = 1.0 / f16_epsilon; // same as before72pub const f32_toint = @compileError("Deprecated: use `1.0 / floatEps(f32)` instead");
73pub const f32_toint: comptime_float = 1.0 / f32_epsilon; // same as before73pub const f64_toint = @compileError("Deprecated: use `1.0 / floatEps(f64)` instead");
74pub const f64_toint: comptime_float = 1.0 / f64_epsilon; // same as before74pub const f80_toint = @compileError("Deprecated: use `1.0 / floatEps(f80)` instead");
75pub const f80_toint = 1.0 / f80_epsilon; // same as before75pub const f128_toint = @compileError("Deprecated: use `1.0 / floatEps(f128)` instead");
76pub const f128_toint = 1.0 / f128_epsilon; // same as before76pub const inf_u16 = @compileError("Deprecated: use `@bitCast(u16, inf(f16))` instead");
77pub const inf_u16 = @bitCast(u16, inf_f16); // prev: @as(u16, 0x7C00)77pub const inf_f16 = @compileError("Deprecated: use `inf(f16)` instead");
78pub const inf_f16 = inf(f16); // prev: @bitCast(f16, inf_u16)78pub const inf_u32 = @compileError("Deprecated: use `@bitCast(u32, inf(f32))` instead");
79pub const inf_u32 = @bitCast(u32, inf_f32); // prev: @as(u32, 0x7F800000)79pub const inf_f32 = @compileError("Deprecated: use `inf(f32)` instead");
80pub const inf_f32 = inf(f32); // prev: @bitCast(f32, inf_u32)80pub const inf_u64 = @compileError("Deprecated: use `@bitCast(u64, inf(f64))` instead");
81pub const inf_u64 = @bitCast(u64, inf_f64); // prev: @as(u64, 0x7FF << 52)81pub const inf_f64 = @compileError("Deprecated: use `inf(f64)` instead");
82pub const inf_f64 = inf(f64); // prev: @bitCast(f64, inf_u64)82pub const inf_f80 = @compileError("Deprecated: use `inf(f80)` instead");
83pub const inf_f80 = inf(f80); // prev: make_f80(F80{ .fraction = 0x8000000000000000, .exp = 0x7fff })83pub const inf_u128 = @compileError("Deprecated: use `@bitCast(u128, inf(f128))` instead");
84pub const inf_u128 = @bitCast(u128, inf_f128); // prev: @as(u128, 0x7fff0000000000000000000000000000)84pub const inf_f128 = @compileError("Deprecated: use `inf(f128)` instead");
85pub const inf_f128 = inf(f128); // prev: @bitCast(f128, inf_u128)85pub const epsilon = @compileError("Deprecated: use `floatEps` instead");
86pub const epsilon = floatEps;
87// End of "soft deprecated" section
8886
89pub const nan_u16 = @as(u16, 0x7C01);87pub const nan_u16 = @as(u16, 0x7C01);
90pub const nan_f16 = @bitCast(f16, nan_u16);88pub const nan_f16 = @bitCast(f16, nan_u16);
...@@ -329,7 +327,92 @@ pub const Complex = complex.Complex;...@@ -329,7 +327,92 @@ pub const Complex = complex.Complex;
329pub const big = @import("math/big.zig");327pub const big = @import("math/big.zig");
330328
331test {329test {
332 std.testing.refAllDecls(@This());330 _ = floatExponentBits;
331 _ = floatMantissaBits;
332 _ = floatFractionalBits;
333 _ = floatExponentMin;
334 _ = floatExponentMax;
335 _ = floatTrueMin;
336 _ = floatMin;
337 _ = floatMax;
338 _ = floatEps;
339 _ = inf;
340
341 _ = nan_u16;
342 _ = nan_f16;
343
344 _ = qnan_u16;
345 _ = qnan_f16;
346
347 _ = nan_u32;
348 _ = nan_f32;
349
350 _ = qnan_u32;
351 _ = qnan_f32;
352
353 _ = nan_u64;
354 _ = nan_f64;
355
356 _ = qnan_u64;
357 _ = qnan_f64;
358
359 _ = nan_f80;
360 _ = qnan_f80;
361
362 _ = nan_u128;
363 _ = nan_f128;
364
365 _ = qnan_u128;
366 _ = qnan_f128;
367
368 _ = nan;
369 _ = snan;
370
371 _ = isNan;
372 _ = isSignalNan;
373 _ = frexp;
374 _ = Frexp;
375 _ = modf;
376 _ = modf32_result;
377 _ = modf64_result;
378 _ = copysign;
379 _ = isFinite;
380 _ = isInf;
381 _ = isPositiveInf;
382 _ = isNegativeInf;
383 _ = isNormal;
384 _ = signbit;
385 _ = scalbn;
386 _ = ldexp;
387 _ = pow;
388 _ = powi;
389 _ = sqrt;
390 _ = cbrt;
391 _ = acos;
392 _ = asin;
393 _ = atan;
394 _ = atan2;
395 _ = hypot;
396 _ = expm1;
397 _ = ilogb;
398 _ = ln;
399 _ = log;
400 _ = log2;
401 _ = log10;
402 _ = log10_int;
403 _ = log1p;
404 _ = asinh;
405 _ = acosh;
406 _ = atanh;
407 _ = sinh;
408 _ = cosh;
409 _ = tanh;
410 _ = gcd;
411
412 _ = complex;
413 _ = Complex;
414
415 _ = big;
333}416}
334417
335/// Given two types, returns the smallest one which is capable of holding the418/// Given two types, returns the smallest one which is capable of holding the
...@@ -771,7 +854,7 @@ test "IntFittingRange" {...@@ -771,7 +854,7 @@ test "IntFittingRange" {
771854
772test "overflow functions" {855test "overflow functions" {
773 try testOverflow();856 try testOverflow();
774 comptime try testOverflow();857 try comptime testOverflow();
775}858}
776859
777fn testOverflow() !void {860fn testOverflow() !void {
...@@ -815,7 +898,7 @@ pub fn absInt(x: anytype) !@TypeOf(x) {...@@ -815,7 +898,7 @@ pub fn absInt(x: anytype) !@TypeOf(x) {
815898
816test "absInt" {899test "absInt" {
817 try testAbsInt();900 try testAbsInt();
818 comptime try testAbsInt();901 try comptime testAbsInt();
819}902}
820fn testAbsInt() !void {903fn testAbsInt() !void {
821 try testing.expect((absInt(@as(i32, -10)) catch unreachable) == 10);904 try testing.expect((absInt(@as(i32, -10)) catch unreachable) == 10);
...@@ -837,7 +920,7 @@ pub fn divTrunc(comptime T: type, numerator: T, denominator: T) !T {...@@ -837,7 +920,7 @@ pub fn divTrunc(comptime T: type, numerator: T, denominator: T) !T {
837920
838test "divTrunc" {921test "divTrunc" {
839 try testDivTrunc();922 try testDivTrunc();
840 comptime try testDivTrunc();923 try comptime testDivTrunc();
841}924}
842fn testDivTrunc() !void {925fn testDivTrunc() !void {
843 try testing.expect((divTrunc(i32, 5, 3) catch unreachable) == 1);926 try testing.expect((divTrunc(i32, 5, 3) catch unreachable) == 1);
...@@ -861,7 +944,7 @@ pub fn divFloor(comptime T: type, numerator: T, denominator: T) !T {...@@ -861,7 +944,7 @@ pub fn divFloor(comptime T: type, numerator: T, denominator: T) !T {
861944
862test "divFloor" {945test "divFloor" {
863 try testDivFloor();946 try testDivFloor();
864 comptime try testDivFloor();947 try comptime testDivFloor();
865}948}
866fn testDivFloor() !void {949fn testDivFloor() !void {
867 try testing.expect((divFloor(i32, 5, 3) catch unreachable) == 1);950 try testing.expect((divFloor(i32, 5, 3) catch unreachable) == 1);
...@@ -898,7 +981,7 @@ pub fn divCeil(comptime T: type, numerator: T, denominator: T) !T {...@@ -898,7 +981,7 @@ pub fn divCeil(comptime T: type, numerator: T, denominator: T) !T {
898981
899test "divCeil" {982test "divCeil" {
900 try testDivCeil();983 try testDivCeil();
901 comptime try testDivCeil();984 try comptime testDivCeil();
902}985}
903fn testDivCeil() !void {986fn testDivCeil() !void {
904 try testing.expectEqual(@as(i32, 2), divCeil(i32, 5, 3) catch unreachable);987 try testing.expectEqual(@as(i32, 2), divCeil(i32, 5, 3) catch unreachable);
...@@ -942,7 +1025,7 @@ pub fn divExact(comptime T: type, numerator: T, denominator: T) !T {...@@ -942,7 +1025,7 @@ pub fn divExact(comptime T: type, numerator: T, denominator: T) !T {
9421025
943test "divExact" {1026test "divExact" {
944 try testDivExact();1027 try testDivExact();
945 comptime try testDivExact();1028 try comptime testDivExact();
946}1029}
947fn testDivExact() !void {1030fn testDivExact() !void {
948 try testing.expect((divExact(i32, 10, 5) catch unreachable) == 2);1031 try testing.expect((divExact(i32, 10, 5) catch unreachable) == 2);
...@@ -968,7 +1051,7 @@ pub fn mod(comptime T: type, numerator: T, denominator: T) !T {...@@ -968,7 +1051,7 @@ pub fn mod(comptime T: type, numerator: T, denominator: T) !T {
9681051
969test "mod" {1052test "mod" {
970 try testMod();1053 try testMod();
971 comptime try testMod();1054 try comptime testMod();
972}1055}
973fn testMod() !void {1056fn testMod() !void {
974 try testing.expect((mod(i32, -5, 3) catch unreachable) == 1);1057 try testing.expect((mod(i32, -5, 3) catch unreachable) == 1);
...@@ -994,7 +1077,7 @@ pub fn rem(comptime T: type, numerator: T, denominator: T) !T {...@@ -994,7 +1077,7 @@ pub fn rem(comptime T: type, numerator: T, denominator: T) !T {
9941077
995test "rem" {1078test "rem" {
996 try testRem();1079 try testRem();
997 comptime try testRem();1080 try comptime testRem();
998}1081}
999fn testRem() !void {1082fn testRem() !void {
1000 try testing.expect((rem(i32, -5, 3) catch unreachable) == -2);1083 try testing.expect((rem(i32, -5, 3) catch unreachable) == -2);
...@@ -1170,7 +1253,7 @@ pub fn floorPowerOfTwo(comptime T: type, value: T) T {...@@ -1170,7 +1253,7 @@ pub fn floorPowerOfTwo(comptime T: type, value: T) T {
11701253
1171test "floorPowerOfTwo" {1254test "floorPowerOfTwo" {
1172 try testFloorPowerOfTwo();1255 try testFloorPowerOfTwo();
1173 comptime try testFloorPowerOfTwo();1256 try comptime testFloorPowerOfTwo();
1174}1257}
11751258
1176fn testFloorPowerOfTwo() !void {1259fn testFloorPowerOfTwo() !void {
...@@ -1232,7 +1315,7 @@ pub fn ceilPowerOfTwoAssert(comptime T: type, value: T) T {...@@ -1232,7 +1315,7 @@ pub fn ceilPowerOfTwoAssert(comptime T: type, value: T) T {
12321315
1233test "ceilPowerOfTwoPromote" {1316test "ceilPowerOfTwoPromote" {
1234 try testCeilPowerOfTwoPromote();1317 try testCeilPowerOfTwoPromote();
1235 comptime try testCeilPowerOfTwoPromote();1318 try comptime testCeilPowerOfTwoPromote();
1236}1319}
12371320
1238fn testCeilPowerOfTwoPromote() !void {1321fn testCeilPowerOfTwoPromote() !void {
...@@ -1249,7 +1332,7 @@ fn testCeilPowerOfTwoPromote() !void {...@@ -1249,7 +1332,7 @@ fn testCeilPowerOfTwoPromote() !void {
12491332
1250test "ceilPowerOfTwo" {1333test "ceilPowerOfTwo" {
1251 try testCeilPowerOfTwo();1334 try testCeilPowerOfTwo();
1252 comptime try testCeilPowerOfTwo();1335 try comptime testCeilPowerOfTwo();
1253}1336}
12541337
1255fn testCeilPowerOfTwo() !void {1338fn testCeilPowerOfTwo() !void {
...@@ -1668,7 +1751,7 @@ test "boolMask" {...@@ -1668,7 +1751,7 @@ test "boolMask" {
1668 }1751 }
1669 }.runTest;1752 }.runTest;
1670 try runTest();1753 try runTest();
1671 comptime try runTest();1754 try comptime runTest();
1672}1755}
16731756
1674/// Return the mod of `num` with the smallest integer type1757/// Return the mod of `num` with the smallest integer type
...@@ -1799,5 +1882,5 @@ test "sign" {...@@ -1799,5 +1882,5 @@ test "sign" {
1799 return error.SkipZigTest;1882 return error.SkipZigTest;
1800 }1883 }
1801 try testSign();1884 try testSign();
1802 comptime try testSign();1885 try comptime testSign();
1803}1886}
lib/std/mem.zig+6-6
...@@ -3101,7 +3101,7 @@ test "testStringEquality" {...@@ -3101,7 +3101,7 @@ test "testStringEquality" {
31013101
3102test "testReadInt" {3102test "testReadInt" {
3103 try testReadIntImpl();3103 try testReadIntImpl();
3104 comptime try testReadIntImpl();3104 try comptime testReadIntImpl();
3105}3105}
3106fn testReadIntImpl() !void {3106fn testReadIntImpl() !void {
3107 {3107 {
...@@ -3152,7 +3152,7 @@ fn testReadIntImpl() !void {...@@ -3152,7 +3152,7 @@ fn testReadIntImpl() !void {
31523152
3153test writeIntSlice {3153test writeIntSlice {
3154 try testWriteIntImpl();3154 try testWriteIntImpl();
3155 comptime try testWriteIntImpl();3155 try comptime testWriteIntImpl();
3156}3156}
3157fn testWriteIntImpl() !void {3157fn testWriteIntImpl() !void {
3158 var bytes: [8]u8 = undefined;3158 var bytes: [8]u8 = undefined;
...@@ -4069,13 +4069,13 @@ test "bytesAsSlice keeps pointer alignment" {...@@ -4069,13 +4069,13 @@ test "bytesAsSlice keeps pointer alignment" {
4069 {4069 {
4070 var bytes = [_]u8{ 0x01, 0x02, 0x03, 0x04 };4070 var bytes = [_]u8{ 0x01, 0x02, 0x03, 0x04 };
4071 const numbers = bytesAsSlice(u32, bytes[0..]);4071 const numbers = bytesAsSlice(u32, bytes[0..]);
4072 comptime try testing.expect(@TypeOf(numbers) == []align(@alignOf(@TypeOf(bytes))) u32);4072 try comptime testing.expect(@TypeOf(numbers) == []align(@alignOf(@TypeOf(bytes))) u32);
4073 }4073 }
4074 {4074 {
4075 var bytes = [_]u8{ 0x01, 0x02, 0x03, 0x04 };4075 var bytes = [_]u8{ 0x01, 0x02, 0x03, 0x04 };
4076 var runtime_zero: usize = 0;4076 var runtime_zero: usize = 0;
4077 const numbers = bytesAsSlice(u32, bytes[runtime_zero..]);4077 const numbers = bytesAsSlice(u32, bytes[runtime_zero..]);
4078 comptime try testing.expect(@TypeOf(numbers) == []align(@alignOf(@TypeOf(bytes))) u32);4078 try comptime testing.expect(@TypeOf(numbers) == []align(@alignOf(@TypeOf(bytes))) u32);
4079 }4079 }
4080}4080}
40814081
...@@ -4168,7 +4168,7 @@ test "sliceAsBytes packed struct at runtime and comptime" {...@@ -4168,7 +4168,7 @@ test "sliceAsBytes packed struct at runtime and comptime" {
4168 }4168 }
4169 };4169 };
4170 try S.doTheTest();4170 try S.doTheTest();
4171 comptime try S.doTheTest();4171 try comptime S.doTheTest();
4172}4172}
41734173
4174test "sliceAsBytes and bytesAsSlice back" {4174test "sliceAsBytes and bytesAsSlice back" {
...@@ -4557,7 +4557,7 @@ test "read/write(Var)PackedInt" {...@@ -4557,7 +4557,7 @@ test "read/write(Var)PackedInt" {
4557 }4557 }
45584558
4559 const signedness = @typeInfo(PackedType).Int.signedness;4559 const signedness = @typeInfo(PackedType).Int.signedness;
4560 const NextPowerOfTwoInt = std.meta.Int(signedness, comptime try std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType)));4560 const NextPowerOfTwoInt = std.meta.Int(signedness, try comptime std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType)));
4561 const ui64 = std.meta.Int(signedness, 64);4561 const ui64 = std.meta.Int(signedness, 64);
4562 inline for ([_]type{ PackedType, NextPowerOfTwoInt, ui64 }) |U| {4562 inline for ([_]type{ PackedType, NextPowerOfTwoInt, ui64 }) |U| {
4563 { // Variable-size Read/Write (Native-endian)4563 { // Variable-size Read/Write (Native-endian)
lib/std/meta.zig+4-16
...@@ -146,7 +146,7 @@ test "std.meta.Child" {...@@ -146,7 +146,7 @@ test "std.meta.Child" {
146 try testing.expect(Child(*u8) == u8);146 try testing.expect(Child(*u8) == u8);
147 try testing.expect(Child([]u8) == u8);147 try testing.expect(Child([]u8) == u8);
148 try testing.expect(Child(?u8) == u8);148 try testing.expect(Child(?u8) == u8);
149 try testing.expect(Child(Vector(2, u8)) == u8);149 try testing.expect(Child(@Vector(2, u8)) == u8);
150}150}
151151
152/// Given a "memory span" type (array, slice, vector, or pointer to such), returns the "element type".152/// Given a "memory span" type (array, slice, vector, or pointer to such), returns the "element type".
...@@ -173,8 +173,8 @@ test "std.meta.Elem" {...@@ -173,8 +173,8 @@ test "std.meta.Elem" {
173 try testing.expect(Elem([*]u8) == u8);173 try testing.expect(Elem([*]u8) == u8);
174 try testing.expect(Elem([]u8) == u8);174 try testing.expect(Elem([]u8) == u8);
175 try testing.expect(Elem(*[10]u8) == u8);175 try testing.expect(Elem(*[10]u8) == u8);
176 try testing.expect(Elem(Vector(2, u8)) == u8);176 try testing.expect(Elem(@Vector(2, u8)) == u8);
177 try testing.expect(Elem(*Vector(2, u8)) == u8);177 try testing.expect(Elem(*@Vector(2, u8)) == u8);
178 try testing.expect(Elem(?[*]u8) == u8);178 try testing.expect(Elem(?[*]u8) == u8);
179}179}
180180
...@@ -210,7 +210,7 @@ pub fn sentinel(comptime T: type) ?Elem(T) {...@@ -210,7 +210,7 @@ pub fn sentinel(comptime T: type) ?Elem(T) {
210210
211test "std.meta.sentinel" {211test "std.meta.sentinel" {
212 try testSentinel();212 try testSentinel();
213 comptime try testSentinel();213 try comptime testSentinel();
214}214}
215215
216fn testSentinel() !void {216fn testSentinel() !void {
...@@ -711,8 +711,6 @@ test "std.meta.DeclEnum" {...@@ -711,8 +711,6 @@ test "std.meta.DeclEnum" {
711 try expectEqualEnum(enum { a, b, c }, DeclEnum(C));711 try expectEqualEnum(enum { a, b, c }, DeclEnum(C));
712}712}
713713
714pub const TagType = @compileError("deprecated; use Tag");
715
716pub fn Tag(comptime T: type) type {714pub fn Tag(comptime T: type) type {
717 return switch (@typeInfo(T)) {715 return switch (@typeInfo(T)) {
718 .Enum => |info| info.tag_type,716 .Enum => |info| info.tag_type,
...@@ -1014,16 +1012,6 @@ test "std.meta.Float" {...@@ -1014,16 +1012,6 @@ test "std.meta.Float" {
1014 try testing.expectEqual(f128, Float(128));1012 try testing.expectEqual(f128, Float(128));
1015}1013}
10161014
1017/// Deprecated. Use `@Vector`.
1018pub fn Vector(comptime len: u32, comptime child: type) type {
1019 return @Type(.{
1020 .Vector = .{
1021 .len = len,
1022 .child = child,
1023 },
1024 });
1025}
1026
1027/// For a given function type, returns a tuple type which fields will1015/// For a given function type, returns a tuple type which fields will
1028/// correspond to the argument types.1016/// correspond to the argument types.
1029///1017///
lib/std/meta/trait.zig+3-3
...@@ -222,8 +222,8 @@ pub fn isSingleItemPtr(comptime T: type) bool {...@@ -222,8 +222,8 @@ pub fn isSingleItemPtr(comptime T: type) bool {
222222
223test "isSingleItemPtr" {223test "isSingleItemPtr" {
224 const array = [_]u8{0} ** 10;224 const array = [_]u8{0} ** 10;
225 comptime try testing.expect(isSingleItemPtr(@TypeOf(&array[0])));225 try comptime testing.expect(isSingleItemPtr(@TypeOf(&array[0])));
226 comptime try testing.expect(!isSingleItemPtr(@TypeOf(array)));226 try comptime testing.expect(!isSingleItemPtr(@TypeOf(array)));
227 var runtime_zero: usize = 0;227 var runtime_zero: usize = 0;
228 try testing.expect(!isSingleItemPtr(@TypeOf(array[runtime_zero..1])));228 try testing.expect(!isSingleItemPtr(@TypeOf(array[runtime_zero..1])));
229}229}
...@@ -271,7 +271,7 @@ pub fn isIndexable(comptime T: type) bool {...@@ -271,7 +271,7 @@ pub fn isIndexable(comptime T: type) bool {
271test "isIndexable" {271test "isIndexable" {
272 const array = [_]u8{0} ** 10;272 const array = [_]u8{0} ** 10;
273 const slice = @as([]const u8, &array);273 const slice = @as([]const u8, &array);
274 const vector: meta.Vector(2, u32) = [_]u32{0} ** 2;274 const vector: @Vector(2, u32) = [_]u32{0} ** 2;
275 const tuple = .{ 1, 2, 3 };275 const tuple = .{ 1, 2, 3 };
276276
277 try testing.expect(isIndexable(@TypeOf(array)));277 try testing.expect(isIndexable(@TypeOf(array)));
lib/std/rand.zig+1-1
...@@ -410,7 +410,7 @@ pub const Random = struct {...@@ -410,7 +410,7 @@ pub const Random = struct {
410 r.uintLessThan(T, sum)410 r.uintLessThan(T, sum)
411 else if (comptime std.meta.trait.isFloat(T))411 else if (comptime std.meta.trait.isFloat(T))
412 // take care that imprecision doesn't lead to a value slightly greater than sum412 // take care that imprecision doesn't lead to a value slightly greater than sum
413 std.math.min(r.float(T) * sum, sum - std.math.epsilon(T))413 std.math.min(r.float(T) * sum, sum - std.math.floatEps(T))
414 else414 else
415 @compileError("weightedIndex does not support proportions of type " ++ @typeName(T));415 @compileError("weightedIndex does not support proportions of type " ++ @typeName(T));
416416
lib/std/rand/test.zig+5-5
...@@ -79,7 +79,7 @@ const Dilbert = struct {...@@ -79,7 +79,7 @@ const Dilbert = struct {
7979
80test "Random int" {80test "Random int" {
81 try testRandomInt();81 try testRandomInt();
82 comptime try testRandomInt();82 try comptime testRandomInt();
83}83}
84fn testRandomInt() !void {84fn testRandomInt() !void {
85 var rng = SequentialPrng.init();85 var rng = SequentialPrng.init();
...@@ -126,7 +126,7 @@ fn testRandomInt() !void {...@@ -126,7 +126,7 @@ fn testRandomInt() !void {
126126
127test "Random boolean" {127test "Random boolean" {
128 try testRandomBoolean();128 try testRandomBoolean();
129 comptime try testRandomBoolean();129 try comptime testRandomBoolean();
130}130}
131fn testRandomBoolean() !void {131fn testRandomBoolean() !void {
132 var rng = SequentialPrng.init();132 var rng = SequentialPrng.init();
...@@ -140,7 +140,7 @@ fn testRandomBoolean() !void {...@@ -140,7 +140,7 @@ fn testRandomBoolean() !void {
140140
141test "Random enum" {141test "Random enum" {
142 try testRandomEnumValue();142 try testRandomEnumValue();
143 comptime try testRandomEnumValue();143 try comptime testRandomEnumValue();
144}144}
145fn testRandomEnumValue() !void {145fn testRandomEnumValue() !void {
146 const TestEnum = enum {146 const TestEnum = enum {
...@@ -159,7 +159,7 @@ fn testRandomEnumValue() !void {...@@ -159,7 +159,7 @@ fn testRandomEnumValue() !void {
159test "Random intLessThan" {159test "Random intLessThan" {
160 @setEvalBranchQuota(10000);160 @setEvalBranchQuota(10000);
161 try testRandomIntLessThan();161 try testRandomIntLessThan();
162 comptime try testRandomIntLessThan();162 try comptime testRandomIntLessThan();
163}163}
164fn testRandomIntLessThan() !void {164fn testRandomIntLessThan() !void {
165 var rng = SequentialPrng.init();165 var rng = SequentialPrng.init();
...@@ -201,7 +201,7 @@ fn testRandomIntLessThan() !void {...@@ -201,7 +201,7 @@ fn testRandomIntLessThan() !void {
201test "Random intAtMost" {201test "Random intAtMost" {
202 @setEvalBranchQuota(10000);202 @setEvalBranchQuota(10000);
203 try testRandomIntAtMost();203 try testRandomIntAtMost();
204 comptime try testRandomIntAtMost();204 try comptime testRandomIntAtMost();
205}205}
206fn testRandomIntAtMost() !void {206fn testRandomIntAtMost() !void {
207 var rng = SequentialPrng.init();207 var rng = SequentialPrng.init();
lib/std/testing.zig+1-1
...@@ -263,7 +263,7 @@ pub fn expectApproxEqRel(expected: anytype, actual: @TypeOf(expected), tolerance...@@ -263,7 +263,7 @@ pub fn expectApproxEqRel(expected: anytype, actual: @TypeOf(expected), tolerance
263263
264test "expectApproxEqRel" {264test "expectApproxEqRel" {
265 inline for ([_]type{ f16, f32, f64, f128 }) |T| {265 inline for ([_]type{ f16, f32, f64, f128 }) |T| {
266 const eps_value = comptime math.epsilon(T);266 const eps_value = comptime math.floatEps(T);
267 const sqrt_eps_value = comptime @sqrt(eps_value);267 const sqrt_eps_value = comptime @sqrt(eps_value);
268268
269 const pos_x: T = 12.0;269 const pos_x: T = 12.0;
lib/std/unicode.zig+15-15
...@@ -354,11 +354,11 @@ fn testUtf16CountCodepoints() !void {...@@ -354,11 +354,11 @@ fn testUtf16CountCodepoints() !void {
354354
355test "utf16 count codepoints" {355test "utf16 count codepoints" {
356 try testUtf16CountCodepoints();356 try testUtf16CountCodepoints();
357 comptime try testUtf16CountCodepoints();357 try comptime testUtf16CountCodepoints();
358}358}
359359
360test "utf8 encode" {360test "utf8 encode" {
361 comptime try testUtf8Encode();361 try comptime testUtf8Encode();
362 try testUtf8Encode();362 try testUtf8Encode();
363}363}
364fn testUtf8Encode() !void {364fn testUtf8Encode() !void {
...@@ -384,7 +384,7 @@ fn testUtf8Encode() !void {...@@ -384,7 +384,7 @@ fn testUtf8Encode() !void {
384}384}
385385
386test "utf8 encode error" {386test "utf8 encode error" {
387 comptime try testUtf8EncodeError();387 try comptime testUtf8EncodeError();
388 try testUtf8EncodeError();388 try testUtf8EncodeError();
389}389}
390fn testUtf8EncodeError() !void {390fn testUtf8EncodeError() !void {
...@@ -400,7 +400,7 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void {...@@ -400,7 +400,7 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void {
400}400}
401401
402test "utf8 iterator on ascii" {402test "utf8 iterator on ascii" {
403 comptime try testUtf8IteratorOnAscii();403 try comptime testUtf8IteratorOnAscii();
404 try testUtf8IteratorOnAscii();404 try testUtf8IteratorOnAscii();
405}405}
406fn testUtf8IteratorOnAscii() !void {406fn testUtf8IteratorOnAscii() !void {
...@@ -420,7 +420,7 @@ fn testUtf8IteratorOnAscii() !void {...@@ -420,7 +420,7 @@ fn testUtf8IteratorOnAscii() !void {
420}420}
421421
422test "utf8 view bad" {422test "utf8 view bad" {
423 comptime try testUtf8ViewBad();423 try comptime testUtf8ViewBad();
424 try testUtf8ViewBad();424 try testUtf8ViewBad();
425}425}
426fn testUtf8ViewBad() !void {426fn testUtf8ViewBad() !void {
...@@ -430,7 +430,7 @@ fn testUtf8ViewBad() !void {...@@ -430,7 +430,7 @@ fn testUtf8ViewBad() !void {
430}430}
431431
432test "utf8 view ok" {432test "utf8 view ok" {
433 comptime try testUtf8ViewOk();433 try comptime testUtf8ViewOk();
434 try testUtf8ViewOk();434 try testUtf8ViewOk();
435}435}
436fn testUtf8ViewOk() !void {436fn testUtf8ViewOk() !void {
...@@ -450,7 +450,7 @@ fn testUtf8ViewOk() !void {...@@ -450,7 +450,7 @@ fn testUtf8ViewOk() !void {
450}450}
451451
452test "bad utf8 slice" {452test "bad utf8 slice" {
453 comptime try testBadUtf8Slice();453 try comptime testBadUtf8Slice();
454 try testBadUtf8Slice();454 try testBadUtf8Slice();
455}455}
456fn testBadUtf8Slice() !void {456fn testBadUtf8Slice() !void {
...@@ -461,7 +461,7 @@ fn testBadUtf8Slice() !void {...@@ -461,7 +461,7 @@ fn testBadUtf8Slice() !void {
461}461}
462462
463test "valid utf8" {463test "valid utf8" {
464 comptime try testValidUtf8();464 try comptime testValidUtf8();
465 try testValidUtf8();465 try testValidUtf8();
466}466}
467fn testValidUtf8() !void {467fn testValidUtf8() !void {
...@@ -480,7 +480,7 @@ fn testValidUtf8() !void {...@@ -480,7 +480,7 @@ fn testValidUtf8() !void {
480}480}
481481
482test "invalid utf8 continuation bytes" {482test "invalid utf8 continuation bytes" {
483 comptime try testInvalidUtf8ContinuationBytes();483 try comptime testInvalidUtf8ContinuationBytes();
484 try testInvalidUtf8ContinuationBytes();484 try testInvalidUtf8ContinuationBytes();
485}485}
486fn testInvalidUtf8ContinuationBytes() !void {486fn testInvalidUtf8ContinuationBytes() !void {
...@@ -512,7 +512,7 @@ fn testInvalidUtf8ContinuationBytes() !void {...@@ -512,7 +512,7 @@ fn testInvalidUtf8ContinuationBytes() !void {
512}512}
513513
514test "overlong utf8 codepoint" {514test "overlong utf8 codepoint" {
515 comptime try testOverlongUtf8Codepoint();515 try comptime testOverlongUtf8Codepoint();
516 try testOverlongUtf8Codepoint();516 try testOverlongUtf8Codepoint();
517}517}
518fn testOverlongUtf8Codepoint() !void {518fn testOverlongUtf8Codepoint() !void {
...@@ -525,7 +525,7 @@ fn testOverlongUtf8Codepoint() !void {...@@ -525,7 +525,7 @@ fn testOverlongUtf8Codepoint() !void {
525}525}
526526
527test "misc invalid utf8" {527test "misc invalid utf8" {
528 comptime try testMiscInvalidUtf8();528 try comptime testMiscInvalidUtf8();
529 try testMiscInvalidUtf8();529 try testMiscInvalidUtf8();
530}530}
531fn testMiscInvalidUtf8() !void {531fn testMiscInvalidUtf8() !void {
...@@ -540,7 +540,7 @@ fn testMiscInvalidUtf8() !void {...@@ -540,7 +540,7 @@ fn testMiscInvalidUtf8() !void {
540}540}
541541
542test "utf8 iterator peeking" {542test "utf8 iterator peeking" {
543 comptime try testUtf8Peeking();543 try comptime testUtf8Peeking();
544 try testUtf8Peeking();544 try testUtf8Peeking();
545}545}
546546
...@@ -813,7 +813,7 @@ fn testCalcUtf16LeLen() !void {...@@ -813,7 +813,7 @@ fn testCalcUtf16LeLen() !void {
813813
814test "calculate utf16 string length of given utf8 string in u16" {814test "calculate utf16 string length of given utf8 string in u16" {
815 try testCalcUtf16LeLen();815 try testCalcUtf16LeLen();
816 comptime try testCalcUtf16LeLen();816 try comptime testCalcUtf16LeLen();
817}817}
818818
819/// Print the given `utf16le` string819/// Print the given `utf16le` string
...@@ -919,7 +919,7 @@ fn testUtf8CountCodepoints() !void {...@@ -919,7 +919,7 @@ fn testUtf8CountCodepoints() !void {
919919
920test "utf8 count codepoints" {920test "utf8 count codepoints" {
921 try testUtf8CountCodepoints();921 try testUtf8CountCodepoints();
922 comptime try testUtf8CountCodepoints();922 try comptime testUtf8CountCodepoints();
923}923}
924924
925fn testUtf8ValidCodepoint() !void {925fn testUtf8ValidCodepoint() !void {
...@@ -935,5 +935,5 @@ fn testUtf8ValidCodepoint() !void {...@@ -935,5 +935,5 @@ fn testUtf8ValidCodepoint() !void {
935935
936test "utf8 valid codepoint" {936test "utf8 valid codepoint" {
937 try testUtf8ValidCodepoint();937 try testUtf8ValidCodepoint();
938 comptime try testUtf8ValidCodepoint();938 try comptime testUtf8ValidCodepoint();
939}939}
test/behavior/align.zig+8-8
...@@ -7,11 +7,11 @@ const assert = std.debug.assert;...@@ -7,11 +7,11 @@ const assert = std.debug.assert;
7var foo: u8 align(4) = 100;7var foo: u8 align(4) = 100;
88
9test "global variable alignment" {9test "global variable alignment" {
10 comptime try expect(@typeInfo(@TypeOf(&foo)).Pointer.alignment == 4);10 try comptime expect(@typeInfo(@TypeOf(&foo)).Pointer.alignment == 4);
11 comptime try expect(@TypeOf(&foo) == *align(4) u8);11 try comptime expect(@TypeOf(&foo) == *align(4) u8);
12 {12 {
13 const slice = @as(*align(4) [1]u8, &foo)[0..];13 const slice = @as(*align(4) [1]u8, &foo)[0..];
14 comptime try expect(@TypeOf(slice) == *align(4) [1]u8);14 try comptime expect(@TypeOf(slice) == *align(4) [1]u8);
15 }15 }
16}16}
1717
...@@ -396,7 +396,7 @@ test "function align expression depends on generic parameter" {...@@ -396,7 +396,7 @@ test "function align expression depends on generic parameter" {
396 }396 }
397 };397 };
398 try S.doTheTest();398 try S.doTheTest();
399 comptime try S.doTheTest();399 try comptime S.doTheTest();
400}400}
401401
402test "function callconv expression depends on generic parameter" {402test "function callconv expression depends on generic parameter" {
...@@ -414,7 +414,7 @@ test "function callconv expression depends on generic parameter" {...@@ -414,7 +414,7 @@ test "function callconv expression depends on generic parameter" {
414 }414 }
415 };415 };
416 try S.doTheTest();416 try S.doTheTest();
417 comptime try S.doTheTest();417 try comptime S.doTheTest();
418}418}
419419
420test "runtime-known array index has best alignment possible" {420test "runtime-known array index has best alignment possible" {
...@@ -452,10 +452,10 @@ test "runtime-known array index has best alignment possible" {...@@ -452,10 +452,10 @@ test "runtime-known array index has best alignment possible" {
452 try testIndex2(&array, 3, *u8);452 try testIndex2(&array, 3, *u8);
453}453}
454fn testIndex(smaller: [*]align(2) u32, index: usize, comptime T: type) !void {454fn testIndex(smaller: [*]align(2) u32, index: usize, comptime T: type) !void {
455 comptime try expect(@TypeOf(&smaller[index]) == T);455 try comptime expect(@TypeOf(&smaller[index]) == T);
456}456}
457fn testIndex2(ptr: [*]align(4) u8, index: usize, comptime T: type) !void {457fn testIndex2(ptr: [*]align(4) u8, index: usize, comptime T: type) !void {
458 comptime try expect(@TypeOf(&ptr[index]) == T);458 try comptime expect(@TypeOf(&ptr[index]) == T);
459}459}
460460
461test "alignment of function with c calling convention" {461test "alignment of function with c calling convention" {
...@@ -517,7 +517,7 @@ test "struct field explicit alignment" {...@@ -517,7 +517,7 @@ test "struct field explicit alignment" {
517 var node: S.Node = undefined;517 var node: S.Node = undefined;
518 node.massive_byte = 100;518 node.massive_byte = 100;
519 try expect(node.massive_byte == 100);519 try expect(node.massive_byte == 100);
520 comptime try expect(@TypeOf(&node.massive_byte) == *align(64) u8);520 try comptime expect(@TypeOf(&node.massive_byte) == *align(64) u8);
521 try expect(@ptrToInt(&node.massive_byte) % 64 == 0);521 try expect(@ptrToInt(&node.massive_byte) % 64 == 0);
522}522}
523523
test/behavior/alignof.zig+2-2
...@@ -11,9 +11,9 @@ const Foo = struct {...@@ -11,9 +11,9 @@ const Foo = struct {
11};11};
1212
13test "@alignOf(T) before referencing T" {13test "@alignOf(T) before referencing T" {
14 comptime try expect(@alignOf(Foo) != maxInt(usize));14 try comptime expect(@alignOf(Foo) != maxInt(usize));
15 if (native_arch == .x86_64) {15 if (native_arch == .x86_64) {
16 comptime try expect(@alignOf(Foo) == 4);16 try comptime expect(@alignOf(Foo) == 4);
17 }17 }
18}18}
1919
test/behavior/array.zig+15-15
...@@ -67,7 +67,7 @@ test "array concat with undefined" {...@@ -67,7 +67,7 @@ test "array concat with undefined" {
67 };67 };
6868
69 try S.doTheTest();69 try S.doTheTest();
70 comptime try S.doTheTest();70 try comptime S.doTheTest();
71}71}
7272
73test "array concat with tuple" {73test "array concat with tuple" {
...@@ -154,9 +154,9 @@ test "array len field" {...@@ -154,9 +154,9 @@ test "array len field" {
154 var arr = [4]u8{ 0, 0, 0, 0 };154 var arr = [4]u8{ 0, 0, 0, 0 };
155 var ptr = &arr;155 var ptr = &arr;
156 try expect(arr.len == 4);156 try expect(arr.len == 4);
157 comptime try expect(arr.len == 4);157 try comptime expect(arr.len == 4);
158 try expect(ptr.len == 4);158 try expect(ptr.len == 4);
159 comptime try expect(ptr.len == 4);159 try comptime expect(ptr.len == 4);
160 try expect(@TypeOf(arr.len) == usize);160 try expect(@TypeOf(arr.len) == usize);
161}161}
162162
...@@ -186,7 +186,7 @@ test "array with sentinels" {...@@ -186,7 +186,7 @@ test "array with sentinels" {
186 };186 };
187187
188 try S.doTheTest(false);188 try S.doTheTest(false);
189 comptime try S.doTheTest(true);189 try comptime S.doTheTest(true);
190}190}
191191
192test "void arrays" {192test "void arrays" {
...@@ -247,7 +247,7 @@ test "single-item pointer to array indexing and slicing" {...@@ -247,7 +247,7 @@ test "single-item pointer to array indexing and slicing" {
247 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;247 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
248248
249 try testSingleItemPtrArrayIndexSlice();249 try testSingleItemPtrArrayIndexSlice();
250 comptime try testSingleItemPtrArrayIndexSlice();250 try comptime testSingleItemPtrArrayIndexSlice();
251}251}
252252
253fn testSingleItemPtrArrayIndexSlice() !void {253fn testSingleItemPtrArrayIndexSlice() !void {
...@@ -300,7 +300,7 @@ test "anonymous list literal syntax" {...@@ -300,7 +300,7 @@ test "anonymous list literal syntax" {
300 }300 }
301 };301 };
302 try S.doTheTest();302 try S.doTheTest();
303 comptime try S.doTheTest();303 try comptime S.doTheTest();
304}304}
305305
306var s_array: [8]Sub = undefined;306var s_array: [8]Sub = undefined;
...@@ -349,7 +349,7 @@ test "implicit cast single-item pointer" {...@@ -349,7 +349,7 @@ test "implicit cast single-item pointer" {
349 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO349 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
350350
351 try testImplicitCastSingleItemPtr();351 try testImplicitCastSingleItemPtr();
352 comptime try testImplicitCastSingleItemPtr();352 try comptime testImplicitCastSingleItemPtr();
353}353}
354354
355fn testImplicitCastSingleItemPtr() !void {355fn testImplicitCastSingleItemPtr() !void {
...@@ -410,7 +410,7 @@ test "array literal as argument to function" {...@@ -410,7 +410,7 @@ test "array literal as argument to function" {
410 }410 }
411 };411 };
412 try S.entry(2);412 try S.entry(2);
413 comptime try S.entry(2);413 try comptime S.entry(2);
414}414}
415415
416test "double nested array to const slice cast in array literal" {416test "double nested array to const slice cast in array literal" {
...@@ -472,7 +472,7 @@ test "double nested array to const slice cast in array literal" {...@@ -472,7 +472,7 @@ test "double nested array to const slice cast in array literal" {
472 }472 }
473 };473 };
474 try S.entry(2);474 try S.entry(2);
475 comptime try S.entry(2);475 try comptime S.entry(2);
476}476}
477477
478test "anonymous literal in array" {478test "anonymous literal in array" {
...@@ -498,7 +498,7 @@ test "anonymous literal in array" {...@@ -498,7 +498,7 @@ test "anonymous literal in array" {
498 }498 }
499 };499 };
500 try S.doTheTest();500 try S.doTheTest();
501 comptime try S.doTheTest();501 try comptime S.doTheTest();
502}502}
503503
504test "access the null element of a null terminated array" {504test "access the null element of a null terminated array" {
...@@ -515,7 +515,7 @@ test "access the null element of a null terminated array" {...@@ -515,7 +515,7 @@ test "access the null element of a null terminated array" {
515 }515 }
516 };516 };
517 try S.doTheTest();517 try S.doTheTest();
518 comptime try S.doTheTest();518 try comptime S.doTheTest();
519}519}
520520
521test "type deduction for array subscript expression" {521test "type deduction for array subscript expression" {
...@@ -534,7 +534,7 @@ test "type deduction for array subscript expression" {...@@ -534,7 +534,7 @@ test "type deduction for array subscript expression" {
534 }534 }
535 };535 };
536 try S.doTheTest();536 try S.doTheTest();
537 comptime try S.doTheTest();537 try comptime S.doTheTest();
538}538}
539539
540test "sentinel element count towards the ABI size calculation" {540test "sentinel element count towards the ABI size calculation" {
...@@ -558,7 +558,7 @@ test "sentinel element count towards the ABI size calculation" {...@@ -558,7 +558,7 @@ test "sentinel element count towards the ABI size calculation" {
558 };558 };
559559
560 try S.doTheTest();560 try S.doTheTest();
561 comptime try S.doTheTest();561 try comptime S.doTheTest();
562}562}
563563
564test "zero-sized array with recursive type definition" {564test "zero-sized array with recursive type definition" {
...@@ -613,7 +613,7 @@ test "type coercion of anon struct literal to array" {...@@ -613,7 +613,7 @@ test "type coercion of anon struct literal to array" {
613 }613 }
614 };614 };
615 try S.doTheTest();615 try S.doTheTest();
616 comptime try S.doTheTest();616 try comptime S.doTheTest();
617}617}
618618
619test "type coercion of pointer to anon struct literal to pointer to array" {619test "type coercion of pointer to anon struct literal to pointer to array" {
...@@ -646,7 +646,7 @@ test "type coercion of pointer to anon struct literal to pointer to array" {...@@ -646,7 +646,7 @@ test "type coercion of pointer to anon struct literal to pointer to array" {
646 }646 }
647 };647 };
648 try S.doTheTest();648 try S.doTheTest();
649 comptime try S.doTheTest();649 try comptime S.doTheTest();
650}650}
651651
652test "array with comptime-only element type" {652test "array with comptime-only element type" {
test/behavior/async_fn.zig+3-3
...@@ -331,7 +331,7 @@ test "async fn pointer in a struct field" {...@@ -331,7 +331,7 @@ test "async fn pointer in a struct field" {
331 var foo = Foo{ .bar = simpleAsyncFn2 };331 var foo = Foo{ .bar = simpleAsyncFn2 };
332 var bytes: [64]u8 align(16) = undefined;332 var bytes: [64]u8 align(16) = undefined;
333 const f = @asyncCall(&bytes, {}, foo.bar, .{&data});333 const f = @asyncCall(&bytes, {}, foo.bar, .{&data});
334 comptime try expect(@TypeOf(f) == anyframe->void);334 try comptime expect(@TypeOf(f) == anyframe->void);
335 try expect(data == 2);335 try expect(data == 2);
336 resume f;336 resume f;
337 try expect(data == 4);337 try expect(data == 4);
...@@ -1143,7 +1143,7 @@ test "@asyncCall using the result location inside the frame" {...@@ -1143,7 +1143,7 @@ test "@asyncCall using the result location inside the frame" {
1143 var foo = Foo{ .bar = S.simple2 };1143 var foo = Foo{ .bar = S.simple2 };
1144 var bytes: [64]u8 align(16) = undefined;1144 var bytes: [64]u8 align(16) = undefined;
1145 const f = @asyncCall(&bytes, {}, foo.bar, .{&data});1145 const f = @asyncCall(&bytes, {}, foo.bar, .{&data});
1146 comptime try expect(@TypeOf(f) == anyframe->i32);1146 try comptime expect(@TypeOf(f) == anyframe->i32);
1147 try expect(data == 2);1147 try expect(data == 2);
1148 resume f;1148 resume f;
1149 try expect(data == 4);1149 try expect(data == 4);
...@@ -1158,7 +1158,7 @@ test "@TypeOf an async function call of generic fn with error union type" {...@@ -1158,7 +1158,7 @@ test "@TypeOf an async function call of generic fn with error union type" {
1158 const S = struct {1158 const S = struct {
1159 fn func(comptime x: anytype) anyerror!i32 {1159 fn func(comptime x: anytype) anyerror!i32 {
1160 const T = @TypeOf(async func(x));1160 const T = @TypeOf(async func(x));
1161 comptime try expect(T == @typeInfo(@TypeOf(@frame())).Pointer.child);1161 try comptime expect(T == @typeInfo(@TypeOf(@frame())).Pointer.child);
1162 return undefined;1162 return undefined;
1163 }1163 }
1164 };1164 };
test/behavior/atomics.zig+8-8
...@@ -17,7 +17,7 @@ test "cmpxchg" {...@@ -17,7 +17,7 @@ test "cmpxchg" {
17 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;17 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1818
19 try testCmpxchg();19 try testCmpxchg();
20 comptime try testCmpxchg();20 try comptime testCmpxchg();
21}21}
2222
23fn testCmpxchg() !void {23fn testCmpxchg() !void {
...@@ -122,7 +122,7 @@ test "128-bit cmpxchg" {...@@ -122,7 +122,7 @@ test "128-bit cmpxchg" {
122 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO122 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
123123
124 try test_u128_cmpxchg();124 try test_u128_cmpxchg();
125 comptime try test_u128_cmpxchg();125 try comptime test_u128_cmpxchg();
126}126}
127127
128fn test_u128_cmpxchg() !void {128fn test_u128_cmpxchg() !void {
...@@ -195,7 +195,7 @@ test "atomic store comptime" {...@@ -195,7 +195,7 @@ test "atomic store comptime" {
195 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO195 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
196 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;196 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
197197
198 comptime try testAtomicStore();198 try comptime testAtomicStore();
199 try testAtomicStore();199 try testAtomicStore();
200}200}
201201
...@@ -219,7 +219,7 @@ test "atomicrmw with floats" {...@@ -219,7 +219,7 @@ test "atomicrmw with floats" {
219 return error.SkipZigTest;219 return error.SkipZigTest;
220 }220 }
221 try testAtomicRmwFloat();221 try testAtomicRmwFloat();
222 comptime try testAtomicRmwFloat();222 try comptime testAtomicRmwFloat();
223}223}
224224
225fn testAtomicRmwFloat() !void {225fn testAtomicRmwFloat() !void {
...@@ -244,7 +244,7 @@ test "atomicrmw with ints" {...@@ -244,7 +244,7 @@ test "atomicrmw with ints" {
244 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;244 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
245245
246 try testAtomicRmwInts();246 try testAtomicRmwInts();
247 comptime try testAtomicRmwInts();247 try comptime testAtomicRmwInts();
248}248}
249249
250fn testAtomicRmwInts() !void {250fn testAtomicRmwInts() !void {
...@@ -318,8 +318,8 @@ test "atomicrmw with 128-bit ints" {...@@ -318,8 +318,8 @@ test "atomicrmw with 128-bit ints" {
318318
319 try testAtomicRmwInt128(.signed);319 try testAtomicRmwInt128(.signed);
320 try testAtomicRmwInt128(.unsigned);320 try testAtomicRmwInt128(.unsigned);
321 comptime try testAtomicRmwInt128(.signed);321 try comptime testAtomicRmwInt128(.signed);
322 comptime try testAtomicRmwInt128(.unsigned);322 try comptime testAtomicRmwInt128(.unsigned);
323}323}
324324
325fn testAtomicRmwInt128(comptime signedness: std.builtin.Signedness) !void {325fn testAtomicRmwInt128(comptime signedness: std.builtin.Signedness) !void {
...@@ -441,5 +441,5 @@ test "return @atomicStore, using it as a void value" {...@@ -441,5 +441,5 @@ test "return @atomicStore, using it as a void value" {
441 }441 }
442 };442 };
443 try S.doTheTest();443 try S.doTheTest();
444 comptime try S.doTheTest();444 try comptime S.doTheTest();
445}445}
test/behavior/basic.zig+6-6
...@@ -17,7 +17,7 @@ test "empty function with comments" {...@@ -17,7 +17,7 @@ test "empty function with comments" {
1717
18test "truncate" {18test "truncate" {
19 try expect(testTruncate(0x10fd) == 0xfd);19 try expect(testTruncate(0x10fd) == 0xfd);
20 comptime try expect(testTruncate(0x10fd) == 0xfd);20 try comptime expect(testTruncate(0x10fd) == 0xfd);
21}21}
22fn testTruncate(x: u32) u8 {22fn testTruncate(x: u32) u8 {
23 return @truncate(u8, x);23 return @truncate(u8, x);
...@@ -462,7 +462,7 @@ test "struct inside function" {...@@ -462,7 +462,7 @@ test "struct inside function" {
462 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO462 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
463463
464 try testStructInFn();464 try testStructInFn();
465 comptime try testStructInFn();465 try comptime testStructInFn();
466}466}
467467
468fn testStructInFn() !void {468fn testStructInFn() !void {
...@@ -577,7 +577,7 @@ fn emptyFn() void {}...@@ -577,7 +577,7 @@ fn emptyFn() void {}
577const addr1 = @ptrCast(*const u8, &emptyFn);577const addr1 = @ptrCast(*const u8, &emptyFn);
578test "comptime cast fn to ptr" {578test "comptime cast fn to ptr" {
579 const addr2 = @ptrCast(*const u8, &emptyFn);579 const addr2 = @ptrCast(*const u8, &emptyFn);
580 comptime try expect(addr1 == addr2);580 try comptime expect(addr1 == addr2);
581}581}
582582
583test "equality compare fn ptrs" {583test "equality compare fn ptrs" {
...@@ -688,8 +688,8 @@ test "string concatenation" {...@@ -688,8 +688,8 @@ test "string concatenation" {
688 const a = "OK" ++ " IT " ++ "WORKED";688 const a = "OK" ++ " IT " ++ "WORKED";
689 const b = "OK IT WORKED";689 const b = "OK IT WORKED";
690690
691 comptime try expect(@TypeOf(a) == *const [12:0]u8);691 try comptime expect(@TypeOf(a) == *const [12:0]u8);
692 comptime try expect(@TypeOf(b) == *const [12:0]u8);692 try comptime expect(@TypeOf(b) == *const [12:0]u8);
693693
694 const len = b.len;694 const len = b.len;
695 const len_with_null = len + 1;695 const len_with_null = len + 1;
...@@ -759,7 +759,7 @@ test "auto created variables have correct alignment" {...@@ -759,7 +759,7 @@ test "auto created variables have correct alignment" {
759 }759 }
760 };760 };
761 try expect(S.foo("\x7a\x7a\x7a\x7a") == 0x7a7a7a7a);761 try expect(S.foo("\x7a\x7a\x7a\x7a") == 0x7a7a7a7a);
762 comptime try expect(S.foo("\x7a\x7a\x7a\x7a") == 0x7a7a7a7a);762 try comptime expect(S.foo("\x7a\x7a\x7a\x7a") == 0x7a7a7a7a);
763}763}
764764
765test "extern variable with non-pointer opaque type" {765test "extern variable with non-pointer opaque type" {
test/behavior/bitcast.zig+12-12
...@@ -14,7 +14,7 @@ test "@bitCast iX -> uX (32, 64)" {...@@ -14,7 +14,7 @@ test "@bitCast iX -> uX (32, 64)" {
1414
15 inline for (bit_values) |bits| {15 inline for (bit_values) |bits| {
16 try testBitCast(bits);16 try testBitCast(bits);
17 comptime try testBitCast(bits);17 try comptime testBitCast(bits);
18 }18 }
19}19}
2020
...@@ -28,7 +28,7 @@ test "@bitCast iX -> uX (8, 16, 128)" {...@@ -28,7 +28,7 @@ test "@bitCast iX -> uX (8, 16, 128)" {
2828
29 inline for (bit_values) |bits| {29 inline for (bit_values) |bits| {
30 try testBitCast(bits);30 try testBitCast(bits);
31 comptime try testBitCast(bits);31 try comptime testBitCast(bits);
32 }32 }
33}33}
3434
...@@ -43,7 +43,7 @@ test "@bitCast iX -> uX exotic integers" {...@@ -43,7 +43,7 @@ test "@bitCast iX -> uX exotic integers" {
4343
44 inline for (bit_values) |bits| {44 inline for (bit_values) |bits| {
45 try testBitCast(bits);45 try testBitCast(bits);
46 comptime try testBitCast(bits);46 try comptime testBitCast(bits);
47 }47 }
48}48}
4949
...@@ -88,7 +88,7 @@ test "bitcast uX to bytes" {...@@ -88,7 +88,7 @@ test "bitcast uX to bytes" {
88 const bit_values = [_]usize{ 1, 48, 27, 512, 493, 293, 125, 204, 112 };88 const bit_values = [_]usize{ 1, 48, 27, 512, 493, 293, 125, 204, 112 };
89 inline for (bit_values) |bits| {89 inline for (bit_values) |bits| {
90 try testBitCast(bits);90 try testBitCast(bits);
91 comptime try testBitCast(bits);91 try comptime testBitCast(bits);
92 }92 }
93}93}
9494
...@@ -141,7 +141,7 @@ test "nested bitcast" {...@@ -141,7 +141,7 @@ test "nested bitcast" {
141 };141 };
142142
143 try S.foo(42);143 try S.foo(42);
144 comptime try S.foo(42);144 try comptime S.foo(42);
145}145}
146146
147// issue #3010: compiler segfault147// issue #3010: compiler segfault
...@@ -182,7 +182,7 @@ test "@bitCast packed structs at runtime and comptime" {...@@ -182,7 +182,7 @@ test "@bitCast packed structs at runtime and comptime" {
182 }182 }
183 };183 };
184 try S.doTheTest();184 try S.doTheTest();
185 comptime try S.doTheTest();185 try comptime S.doTheTest();
186}186}
187187
188test "@bitCast extern structs at runtime and comptime" {188test "@bitCast extern structs at runtime and comptime" {
...@@ -214,7 +214,7 @@ test "@bitCast extern structs at runtime and comptime" {...@@ -214,7 +214,7 @@ test "@bitCast extern structs at runtime and comptime" {
214 }214 }
215 };215 };
216 try S.doTheTest();216 try S.doTheTest();
217 comptime try S.doTheTest();217 try comptime S.doTheTest();
218}218}
219219
220test "bitcast packed struct to integer and back" {220test "bitcast packed struct to integer and back" {
...@@ -237,7 +237,7 @@ test "bitcast packed struct to integer and back" {...@@ -237,7 +237,7 @@ test "bitcast packed struct to integer and back" {
237 }237 }
238 };238 };
239 try S.doTheTest();239 try S.doTheTest();
240 comptime try S.doTheTest();240 try comptime S.doTheTest();
241}241}
242242
243test "implicit cast to error union by returning" {243test "implicit cast to error union by returning" {
...@@ -254,7 +254,7 @@ test "implicit cast to error union by returning" {...@@ -254,7 +254,7 @@ test "implicit cast to error union by returning" {
254 }254 }
255 };255 };
256 try S.entry();256 try S.entry();
257 comptime try S.entry();257 try comptime S.entry();
258}258}
259259
260test "bitcast packed struct literal to byte" {260test "bitcast packed struct literal to byte" {
...@@ -275,7 +275,7 @@ test "comptime bitcast used in expression has the correct type" {...@@ -275,7 +275,7 @@ test "comptime bitcast used in expression has the correct type" {
275test "bitcast passed as tuple element" {275test "bitcast passed as tuple element" {
276 const S = struct {276 const S = struct {
277 fn foo(args: anytype) !void {277 fn foo(args: anytype) !void {
278 comptime try expect(@TypeOf(args[0]) == f32);278 try comptime expect(@TypeOf(args[0]) == f32);
279 try expect(args[0] == 12.34);279 try expect(args[0] == 12.34);
280 }280 }
281 };281 };
...@@ -285,7 +285,7 @@ test "bitcast passed as tuple element" {...@@ -285,7 +285,7 @@ test "bitcast passed as tuple element" {
285test "triple level result location with bitcast sandwich passed as tuple element" {285test "triple level result location with bitcast sandwich passed as tuple element" {
286 const S = struct {286 const S = struct {
287 fn foo(args: anytype) !void {287 fn foo(args: anytype) !void {
288 comptime try expect(@TypeOf(args[0]) == f64);288 try comptime expect(@TypeOf(args[0]) == f64);
289 try expect(args[0] > 12.33 and args[0] < 12.35);289 try expect(args[0] > 12.33 and args[0] < 12.35);
290 }290 }
291 };291 };
...@@ -326,7 +326,7 @@ test "@bitCast packed struct of floats" {...@@ -326,7 +326,7 @@ test "@bitCast packed struct of floats" {
326 }326 }
327 };327 };
328 try S.doTheTest();328 try S.doTheTest();
329 comptime try S.doTheTest();329 try comptime S.doTheTest();
330}330}
331331
332test "comptime @bitCast packed struct to int and back" {332test "comptime @bitCast packed struct to int and back" {
test/behavior/bitreverse.zig+5-5
...@@ -17,7 +17,7 @@ test "@bitReverse" {...@@ -17,7 +17,7 @@ test "@bitReverse" {
17 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO17 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
18 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;18 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1919
20 comptime try testBitReverse();20 try comptime testBitReverse();
21 try testBitReverse();21 try testBitReverse();
22}22}
2323
...@@ -103,7 +103,7 @@ test "bitReverse vectors u8" {...@@ -103,7 +103,7 @@ test "bitReverse vectors u8" {
103 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO103 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
104 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;104 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
105105
106 comptime try vector8();106 try comptime vector8();
107 try vector8();107 try vector8();
108}108}
109109
...@@ -122,7 +122,7 @@ test "bitReverse vectors u16" {...@@ -122,7 +122,7 @@ test "bitReverse vectors u16" {
122 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO122 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
123 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;123 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
124124
125 comptime try vector16();125 try comptime vector16();
126 try vector16();126 try vector16();
127}127}
128128
...@@ -141,7 +141,7 @@ test "bitReverse vectors u24" {...@@ -141,7 +141,7 @@ test "bitReverse vectors u24" {
141 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO141 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
142 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;142 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
143143
144 comptime try vector24();144 try comptime vector24();
145 try vector24();145 try vector24();
146}146}
147147
...@@ -155,6 +155,6 @@ fn vector0() !void {...@@ -155,6 +155,6 @@ fn vector0() !void {
155test "bitReverse vectors u0" {155test "bitReverse vectors u0" {
156 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;156 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
157157
158 comptime try vector0();158 try comptime vector0();
159 try vector0();159 try vector0();
160}160}
test/behavior/bool.zig+1-1
...@@ -49,7 +49,7 @@ test "compile time bool not" {...@@ -49,7 +49,7 @@ test "compile time bool not" {
4949
50test "short circuit" {50test "short circuit" {
51 try testShortCircuit(false, true);51 try testShortCircuit(false, true);
52 comptime try testShortCircuit(false, true);52 try comptime testShortCircuit(false, true);
53}53}
5454
55fn testShortCircuit(f: bool, t: bool) !void {55fn testShortCircuit(f: bool, t: bool) !void {
test/behavior/bugs/1076.zig+1-1
...@@ -9,7 +9,7 @@ test "comptime code should not modify constant data" {...@@ -9,7 +9,7 @@ test "comptime code should not modify constant data" {
9 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;9 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1010
11 try testCastPtrOfArrayToSliceAndPtr();11 try testCastPtrOfArrayToSliceAndPtr();
12 comptime try testCastPtrOfArrayToSliceAndPtr();12 try comptime testCastPtrOfArrayToSliceAndPtr();
13}13}
1414
15fn testCastPtrOfArrayToSliceAndPtr() !void {15fn testCastPtrOfArrayToSliceAndPtr() !void {
test/behavior/bugs/11139.zig+1-1
...@@ -9,7 +9,7 @@ test "store array of array of structs at comptime" {...@@ -9,7 +9,7 @@ test "store array of array of structs at comptime" {
9 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;9 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1010
11 try expect(storeArrayOfArrayOfStructs() == 15);11 try expect(storeArrayOfArrayOfStructs() == 15);
12 comptime try expect(storeArrayOfArrayOfStructs() == 15);12 try comptime expect(storeArrayOfArrayOfStructs() == 15);
13}13}
1414
15fn storeArrayOfArrayOfStructs() u8 {15fn storeArrayOfArrayOfStructs() u8 {
test/behavior/bugs/1607.zig+1-1
...@@ -17,5 +17,5 @@ test "slices pointing at the same address as global array." {...@@ -17,5 +17,5 @@ test "slices pointing at the same address as global array." {
17 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;17 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1818
19 try checkAddress(&a);19 try checkAddress(&a);
20 comptime try checkAddress(&a);20 try comptime checkAddress(&a);
21}21}
test/behavior/bugs/2114.zig+1-1
...@@ -17,7 +17,7 @@ test "fixed" {...@@ -17,7 +17,7 @@ test "fixed" {
17 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;17 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1818
19 try testCtz();19 try testCtz();
20 comptime try testCtz();20 try comptime testCtz();
21}21}
2222
23fn testCtz() !void {23fn testCtz() !void {
test/behavior/bugs/421.zig+1-1
...@@ -7,7 +7,7 @@ test "bitCast to array" {...@@ -7,7 +7,7 @@ test "bitCast to array" {
7 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO7 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
8 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;8 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
99
10 comptime try testBitCastArray();10 try comptime testBitCastArray();
11 try testBitCastArray();11 try testBitCastArray();
12}12}
1313
test/behavior/bugs/4328.zig+3-3
...@@ -35,7 +35,7 @@ test "Extern function calls in @TypeOf" {...@@ -35,7 +35,7 @@ test "Extern function calls in @TypeOf" {
35 };35 };
3636
37 try Test.doTheTest();37 try Test.doTheTest();
38 comptime try Test.doTheTest();38 try comptime Test.doTheTest();
39}39}
4040
41test "Peer resolution of extern function calls in @TypeOf" {41test "Peer resolution of extern function calls in @TypeOf" {
...@@ -52,7 +52,7 @@ test "Peer resolution of extern function calls in @TypeOf" {...@@ -52,7 +52,7 @@ test "Peer resolution of extern function calls in @TypeOf" {
52 };52 };
5353
54 try Test.doTheTest();54 try Test.doTheTest();
55 comptime try Test.doTheTest();55 try comptime Test.doTheTest();
56}56}
5757
58test "Extern function calls, dereferences and field access in @TypeOf" {58test "Extern function calls, dereferences and field access in @TypeOf" {
...@@ -78,5 +78,5 @@ test "Extern function calls, dereferences and field access in @TypeOf" {...@@ -78,5 +78,5 @@ test "Extern function calls, dereferences and field access in @TypeOf" {
78 };78 };
7979
80 try Test.doTheTest();80 try Test.doTheTest();
81 comptime try Test.doTheTest();81 try comptime Test.doTheTest();
82}82}
test/behavior/bugs/5474.zig+2-2
...@@ -52,12 +52,12 @@ test "pointer-to-array constness for zero-size elements, var" {...@@ -52,12 +52,12 @@ test "pointer-to-array constness for zero-size elements, var" {
52 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO52 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
5353
54 try mutable();54 try mutable();
55 comptime try mutable();55 try comptime mutable();
56}56}
5757
58test "pointer-to-array constness for zero-size elements, const" {58test "pointer-to-array constness for zero-size elements, const" {
59 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO59 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
6060
61 try constant();61 try constant();
62 comptime try constant();62 try comptime constant();
63}63}
test/behavior/bugs/655.zig+1-1
...@@ -3,7 +3,7 @@ const other_file = @import("655_other_file.zig");...@@ -3,7 +3,7 @@ const other_file = @import("655_other_file.zig");
33
4test "function with *const parameter with type dereferenced by namespace" {4test "function with *const parameter with type dereferenced by namespace" {
5 const x: other_file.Integer = 1234;5 const x: other_file.Integer = 1234;
6 comptime try std.testing.expect(@TypeOf(&x) == *const other_file.Integer);6 try comptime std.testing.expect(@TypeOf(&x) == *const other_file.Integer);
7 try foo(&x);7 try foo(&x);
8}8}
99
test/behavior/byteswap.zig+5-5
...@@ -50,7 +50,7 @@ test "@byteSwap integers" {...@@ -50,7 +50,7 @@ test "@byteSwap integers" {
50 try std.testing.expect(expected_output == @byteSwap(input));50 try std.testing.expect(expected_output == @byteSwap(input));
51 }51 }
52 };52 };
53 comptime try ByteSwapIntTest.run();53 try comptime ByteSwapIntTest.run();
54 try ByteSwapIntTest.run();54 try ByteSwapIntTest.run();
55}55}
5656
...@@ -69,7 +69,7 @@ test "@byteSwap vectors u8" {...@@ -69,7 +69,7 @@ test "@byteSwap vectors u8" {
69 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO69 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
70 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;70 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
7171
72 comptime try vector8();72 try comptime vector8();
73 try vector8();73 try vector8();
74}74}
7575
...@@ -88,7 +88,7 @@ test "@byteSwap vectors u16" {...@@ -88,7 +88,7 @@ test "@byteSwap vectors u16" {
88 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO88 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
89 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;89 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
9090
91 comptime try vector16();91 try comptime vector16();
92 try vector16();92 try vector16();
93}93}
9494
...@@ -107,7 +107,7 @@ test "@byteSwap vectors u24" {...@@ -107,7 +107,7 @@ test "@byteSwap vectors u24" {
107 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO107 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
108 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;108 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
109109
110 comptime try vector24();110 try comptime vector24();
111 try vector24();111 try vector24();
112}112}
113113
...@@ -121,6 +121,6 @@ fn vector0() !void {...@@ -121,6 +121,6 @@ fn vector0() !void {
121test "@byteSwap vectors u0" {121test "@byteSwap vectors u0" {
122 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;122 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
123123
124 comptime try vector0();124 try comptime vector0();
125 try vector0();125 try vector0();
126}126}
test/behavior/call.zig+5-5
...@@ -10,11 +10,11 @@ test "super basic invocations" {...@@ -10,11 +10,11 @@ test "super basic invocations" {
10 }10 }
11 }.foo;11 }.foo;
12 try expect(@call(.auto, foo, .{}) == 1234);12 try expect(@call(.auto, foo, .{}) == 1234);
13 comptime try expect(@call(.always_inline, foo, .{}) == 1234);13 try comptime expect(@call(.always_inline, foo, .{}) == 1234);
14 {14 {
15 // comptime call without comptime keyword15 // comptime call without comptime keyword
16 const result = @call(.compile_time, foo, .{}) == 1234;16 const result = @call(.compile_time, foo, .{}) == 1234;
17 comptime try expect(result);17 try comptime expect(result);
18 }18 }
19}19}
2020
...@@ -42,7 +42,7 @@ test "basic invocations" {...@@ -42,7 +42,7 @@ test "basic invocations" {
42 {42 {
43 // comptime call without comptime keyword43 // comptime call without comptime keyword
44 const result = @call(.compile_time, foo, .{}) == 1234;44 const result = @call(.compile_time, foo, .{}) == 1234;
45 comptime try expect(result);45 try comptime expect(result);
46 }46 }
47 {47 {
48 // call of non comptime-known function48 // call of non comptime-known function
...@@ -71,7 +71,7 @@ test "tuple parameters" {...@@ -71,7 +71,7 @@ test "tuple parameters" {
71 try expect(@call(.auto, add, .{ a, b }) == 46);71 try expect(@call(.auto, add, .{ a, b }) == 46);
72 try expect(@call(.auto, add, .{ 12, 34 }) == 46);72 try expect(@call(.auto, add, .{ 12, 34 }) == 46);
73 if (false) {73 if (false) {
74 comptime try expect(@call(.auto, add, .{ 12, 34 }) == 46); // TODO74 try comptime expect(@call(.auto, add, .{ 12, 34 }) == 46); // TODO
75 }75 }
76 try expect(comptime @call(.auto, add, .{ 12, 34 }) == 46);76 try expect(comptime @call(.auto, add, .{ 12, 34 }) == 46);
77 {77 {
...@@ -344,7 +344,7 @@ test "inline call doesn't re-evaluate non generic struct" {...@@ -344,7 +344,7 @@ test "inline call doesn't re-evaluate non generic struct" {
344 };344 };
345 const ArgTuple = std.meta.ArgsTuple(@TypeOf(S.foo));345 const ArgTuple = std.meta.ArgsTuple(@TypeOf(S.foo));
346 try @call(.always_inline, S.foo, ArgTuple{.{ .a = 123, .b = 45 }});346 try @call(.always_inline, S.foo, ArgTuple{.{ .a = 123, .b = 45 }});
347 comptime try @call(.always_inline, S.foo, ArgTuple{.{ .a = 123, .b = 45 }});347 try comptime @call(.always_inline, S.foo, ArgTuple{.{ .a = 123, .b = 45 }});
348}348}
349349
350test "Enum constructed by @Type passed as generic argument" {350test "Enum constructed by @Type passed as generic argument" {
test/behavior/cast.zig+58-58
...@@ -39,7 +39,7 @@ fn peerTypeTAndOptionalT(c: bool, b: bool) ?usize {...@@ -39,7 +39,7 @@ fn peerTypeTAndOptionalT(c: bool, b: bool) ?usize {
3939
40test "resolve undefined with integer" {40test "resolve undefined with integer" {
41 try testResolveUndefWithInt(true, 1234);41 try testResolveUndefWithInt(true, 1234);
42 comptime try testResolveUndefWithInt(true, 1234);42 try comptime testResolveUndefWithInt(true, 1234);
43}43}
44fn testResolveUndefWithInt(b: bool, x: i32) !void {44fn testResolveUndefWithInt(b: bool, x: i32) !void {
45 const value = if (b) x else undefined;45 const value = if (b) x else undefined;
...@@ -59,7 +59,7 @@ test "implicit cast comptime numbers to any type when the value fits" {...@@ -59,7 +59,7 @@ test "implicit cast comptime numbers to any type when the value fits" {
59}59}
6060
61test "implicit cast comptime_int to comptime_float" {61test "implicit cast comptime_int to comptime_float" {
62 comptime try expect(@as(comptime_float, 10) == @as(f32, 10));62 try comptime expect(@as(comptime_float, 10) == @as(f32, 10));
63 try expect(2 == 2.0);63 try expect(2 == 2.0);
64}64}
6565
...@@ -110,7 +110,7 @@ test "@intToFloat" {...@@ -110,7 +110,7 @@ test "@intToFloat" {
110 }110 }
111 };111 };
112 try S.doTheTest();112 try S.doTheTest();
113 comptime try S.doTheTest();113 try comptime S.doTheTest();
114}114}
115115
116test "@intToFloat(f80)" {116test "@intToFloat(f80)" {
...@@ -140,13 +140,13 @@ test "@intToFloat(f80)" {...@@ -140,13 +140,13 @@ test "@intToFloat(f80)" {
140 try S.doTheTest(i80);140 try S.doTheTest(i80);
141 try S.doTheTest(i128);141 try S.doTheTest(i128);
142 // try S.doTheTest(i256); // TODO missing compiler_rt symbols142 // try S.doTheTest(i256); // TODO missing compiler_rt symbols
143 comptime try S.doTheTest(i31);143 try comptime S.doTheTest(i31);
144 comptime try S.doTheTest(i32);144 try comptime S.doTheTest(i32);
145 comptime try S.doTheTest(i45);145 try comptime S.doTheTest(i45);
146 comptime try S.doTheTest(i64);146 try comptime S.doTheTest(i64);
147 comptime try S.doTheTest(i80);147 try comptime S.doTheTest(i80);
148 comptime try S.doTheTest(i128);148 try comptime S.doTheTest(i128);
149 comptime try S.doTheTest(i256);149 try comptime S.doTheTest(i256);
150}150}
151151
152test "@floatToInt" {152test "@floatToInt" {
...@@ -156,7 +156,7 @@ test "@floatToInt" {...@@ -156,7 +156,7 @@ test "@floatToInt" {
156 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO156 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
157157
158 try testFloatToInts();158 try testFloatToInts();
159 comptime try testFloatToInts();159 try comptime testFloatToInts();
160}160}
161161
162fn testFloatToInts() !void {162fn testFloatToInts() !void {
...@@ -291,7 +291,7 @@ test "@intCast to u0 and use the result" {...@@ -291,7 +291,7 @@ test "@intCast to u0 and use the result" {
291 }291 }
292 };292 };
293 try S.doTheTest(0, 1, 0);293 try S.doTheTest(0, 1, 0);
294 comptime try S.doTheTest(0, 1, 0);294 try comptime S.doTheTest(0, 1, 0);
295}295}
296296
297test "peer result null and comptime_int" {297test "peer result null and comptime_int" {
...@@ -312,11 +312,11 @@ test "peer result null and comptime_int" {...@@ -312,11 +312,11 @@ test "peer result null and comptime_int" {
312 };312 };
313313
314 try expect(S.blah(0) == null);314 try expect(S.blah(0) == null);
315 comptime try expect(S.blah(0) == null);315 try comptime expect(S.blah(0) == null);
316 try expect(S.blah(10).? == 1);316 try expect(S.blah(10).? == 1);
317 comptime try expect(S.blah(10).? == 1);317 try comptime expect(S.blah(10).? == 1);
318 try expect(S.blah(-10).? == -1);318 try expect(S.blah(-10).? == -1);
319 comptime try expect(S.blah(-10).? == -1);319 try comptime expect(S.blah(-10).? == -1);
320}320}
321321
322test "*const ?[*]const T to [*c]const [*c]const T" {322test "*const ?[*]const T to [*c]const [*c]const T" {
...@@ -375,7 +375,7 @@ test "return u8 coercing into ?u32 return type" {...@@ -375,7 +375,7 @@ test "return u8 coercing into ?u32 return type" {
375 }375 }
376 };376 };
377 try S.doTheTest();377 try S.doTheTest();
378 comptime try S.doTheTest();378 try comptime S.doTheTest();
379}379}
380380
381test "cast from ?[*]T to ??[*]T" {381test "cast from ?[*]T to ??[*]T" {
...@@ -392,7 +392,7 @@ test "peer type unsigned int to signed" {...@@ -392,7 +392,7 @@ test "peer type unsigned int to signed" {
392 var x: u8 = 7;392 var x: u8 = 7;
393 var y: i32 = -5;393 var y: i32 = -5;
394 var a = w + y + x;394 var a = w + y + x;
395 comptime try expect(@TypeOf(a) == i32);395 try comptime expect(@TypeOf(a) == i32);
396 try expect(a == 7);396 try expect(a == 7);
397}397}
398398
...@@ -414,7 +414,7 @@ test "explicit cast from integer to error type" {...@@ -414,7 +414,7 @@ test "explicit cast from integer to error type" {
414 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;414 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
415415
416 try testCastIntToErr(error.ItBroke);416 try testCastIntToErr(error.ItBroke);
417 comptime try testCastIntToErr(error.ItBroke);417 try comptime testCastIntToErr(error.ItBroke);
418}418}
419fn testCastIntToErr(err: anyerror) !void {419fn testCastIntToErr(err: anyerror) !void {
420 const x = @errorToInt(err);420 const x = @errorToInt(err);
...@@ -428,7 +428,7 @@ test "peer resolve array and const slice" {...@@ -428,7 +428,7 @@ test "peer resolve array and const slice" {
428 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO428 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
429429
430 try testPeerResolveArrayConstSlice(true);430 try testPeerResolveArrayConstSlice(true);
431 comptime try testPeerResolveArrayConstSlice(true);431 try comptime testPeerResolveArrayConstSlice(true);
432}432}
433fn testPeerResolveArrayConstSlice(b: bool) !void {433fn testPeerResolveArrayConstSlice(b: bool) !void {
434 const value1 = if (b) "aoeu" else @as([]const u8, "zz");434 const value1 = if (b) "aoeu" else @as([]const u8, "zz");
...@@ -444,7 +444,7 @@ test "implicitly cast from T to anyerror!?T" {...@@ -444,7 +444,7 @@ test "implicitly cast from T to anyerror!?T" {
444 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;444 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
445445
446 try castToOptionalTypeError(1);446 try castToOptionalTypeError(1);
447 comptime try castToOptionalTypeError(1);447 try comptime castToOptionalTypeError(1);
448}448}
449449
450const A = struct {450const A = struct {
...@@ -470,7 +470,7 @@ test "implicitly cast from [0]T to anyerror![]T" {...@@ -470,7 +470,7 @@ test "implicitly cast from [0]T to anyerror![]T" {
470 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;470 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
471471
472 try testCastZeroArrayToErrSliceMut();472 try testCastZeroArrayToErrSliceMut();
473 comptime try testCastZeroArrayToErrSliceMut();473 try comptime testCastZeroArrayToErrSliceMut();
474}474}
475475
476fn testCastZeroArrayToErrSliceMut() !void {476fn testCastZeroArrayToErrSliceMut() !void {
...@@ -504,7 +504,7 @@ test "peer type resolution: [0]u8, []const u8, and anyerror![]u8" {...@@ -504,7 +504,7 @@ test "peer type resolution: [0]u8, []const u8, and anyerror![]u8" {
504 }504 }
505 };505 };
506 try S.doTheTest();506 try S.doTheTest();
507 comptime try S.doTheTest();507 try comptime S.doTheTest();
508}508}
509fn peerTypeEmptyArrayAndSliceAndError(a: bool, slice: []u8) anyerror![]u8 {509fn peerTypeEmptyArrayAndSliceAndError(a: bool, slice: []u8) anyerror![]u8 {
510 if (a) {510 if (a) {
...@@ -520,7 +520,7 @@ test "implicit cast from *const [N]T to []const T" {...@@ -520,7 +520,7 @@ test "implicit cast from *const [N]T to []const T" {
520 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;520 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
521521
522 try testCastConstArrayRefToConstSlice();522 try testCastConstArrayRefToConstSlice();
523 comptime try testCastConstArrayRefToConstSlice();523 try comptime testCastConstArrayRefToConstSlice();
524}524}
525525
526fn testCastConstArrayRefToConstSlice() !void {526fn testCastConstArrayRefToConstSlice() !void {
...@@ -546,9 +546,9 @@ test "peer type resolution: error and [N]T" {...@@ -546,9 +546,9 @@ test "peer type resolution: error and [N]T" {
546 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;546 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
547547
548 try expect(mem.eql(u8, try testPeerErrorAndArray(0), "OK"));548 try expect(mem.eql(u8, try testPeerErrorAndArray(0), "OK"));
549 comptime try expect(mem.eql(u8, try testPeerErrorAndArray(0), "OK"));549 try comptime expect(mem.eql(u8, try testPeerErrorAndArray(0), "OK"));
550 try expect(mem.eql(u8, try testPeerErrorAndArray2(1), "OKK"));550 try expect(mem.eql(u8, try testPeerErrorAndArray2(1), "OKK"));
551 comptime try expect(mem.eql(u8, try testPeerErrorAndArray2(1), "OKK"));551 try comptime expect(mem.eql(u8, try testPeerErrorAndArray2(1), "OKK"));
552}552}
553553
554fn testPeerErrorAndArray(x: u8) anyerror![]const u8 {554fn testPeerErrorAndArray(x: u8) anyerror![]const u8 {
...@@ -571,7 +571,7 @@ test "single-item pointer of array to slice to unknown length pointer" {...@@ -571,7 +571,7 @@ test "single-item pointer of array to slice to unknown length pointer" {
571 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;571 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
572572
573 try testCastPtrOfArrayToSliceAndPtr();573 try testCastPtrOfArrayToSliceAndPtr();
574 comptime try testCastPtrOfArrayToSliceAndPtr();574 try comptime testCastPtrOfArrayToSliceAndPtr();
575}575}
576576
577fn testCastPtrOfArrayToSliceAndPtr() !void {577fn testCastPtrOfArrayToSliceAndPtr() !void {
...@@ -644,9 +644,9 @@ test "vector casts" {...@@ -644,9 +644,9 @@ test "vector casts" {
644 };644 };
645645
646 try S.doTheTest();646 try S.doTheTest();
647 comptime try S.doTheTest();647 try comptime S.doTheTest();
648 try S.doTheTestFloat();648 try S.doTheTestFloat();
649 comptime try S.doTheTestFloat();649 try comptime S.doTheTestFloat();
650}650}
651651
652test "@floatCast cast down" {652test "@floatCast cast down" {
...@@ -887,7 +887,7 @@ test "peer resolution of string literals" {...@@ -887,7 +887,7 @@ test "peer resolution of string literals" {
887 }887 }
888 };888 };
889 try S.doTheTest(.b);889 try S.doTheTest(.b);
890 comptime try S.doTheTest(.b);890 try comptime S.doTheTest(.b);
891}891}
892892
893test "peer cast [:x]T to []T" {893test "peer cast [:x]T to []T" {
...@@ -904,7 +904,7 @@ test "peer cast [:x]T to []T" {...@@ -904,7 +904,7 @@ test "peer cast [:x]T to []T" {
904 }904 }
905 };905 };
906 try S.doTheTest();906 try S.doTheTest();
907 comptime try S.doTheTest();907 try comptime S.doTheTest();
908}908}
909909
910test "peer cast [N:x]T to [N]T" {910test "peer cast [N:x]T to [N]T" {
...@@ -920,7 +920,7 @@ test "peer cast [N:x]T to [N]T" {...@@ -920,7 +920,7 @@ test "peer cast [N:x]T to [N]T" {
920 }920 }
921 };921 };
922 try S.doTheTest();922 try S.doTheTest();
923 comptime try S.doTheTest();923 try comptime S.doTheTest();
924}924}
925925
926test "peer cast *[N:x]T to *[N]T" {926test "peer cast *[N:x]T to *[N]T" {
...@@ -936,7 +936,7 @@ test "peer cast *[N:x]T to *[N]T" {...@@ -936,7 +936,7 @@ test "peer cast *[N:x]T to *[N]T" {
936 }936 }
937 };937 };
938 try S.doTheTest();938 try S.doTheTest();
939 comptime try S.doTheTest();939 try comptime S.doTheTest();
940}940}
941941
942test "peer cast [*:x]T to [*]T" {942test "peer cast [*:x]T to [*]T" {
...@@ -956,7 +956,7 @@ test "peer cast [*:x]T to [*]T" {...@@ -956,7 +956,7 @@ test "peer cast [*:x]T to [*]T" {
956 }956 }
957 };957 };
958 try S.doTheTest();958 try S.doTheTest();
959 comptime try S.doTheTest();959 try comptime S.doTheTest();
960}960}
961961
962test "peer cast [:x]T to [*:x]T" {962test "peer cast [:x]T to [*:x]T" {
...@@ -978,7 +978,7 @@ test "peer cast [:x]T to [*:x]T" {...@@ -978,7 +978,7 @@ test "peer cast [:x]T to [*:x]T" {
978 }978 }
979 };979 };
980 try S.doTheTest();980 try S.doTheTest();
981 comptime try S.doTheTest();981 try comptime S.doTheTest();
982}982}
983983
984test "peer type resolution implicit cast to return type" {984test "peer type resolution implicit cast to return type" {
...@@ -999,7 +999,7 @@ test "peer type resolution implicit cast to return type" {...@@ -999,7 +999,7 @@ test "peer type resolution implicit cast to return type" {
999 }999 }
1000 };1000 };
1001 try S.doTheTest();1001 try S.doTheTest();
1002 comptime try S.doTheTest();1002 try comptime S.doTheTest();
1003}1003}
10041004
1005test "peer type resolution implicit cast to variable type" {1005test "peer type resolution implicit cast to variable type" {
...@@ -1018,7 +1018,7 @@ test "peer type resolution implicit cast to variable type" {...@@ -1018,7 +1018,7 @@ test "peer type resolution implicit cast to variable type" {
1018 }1018 }
1019 };1019 };
1020 try S.doTheTest();1020 try S.doTheTest();
1021 comptime try S.doTheTest();1021 try comptime S.doTheTest();
1022}1022}
10231023
1024test "variable initialization uses result locations properly with regards to the type" {1024test "variable initialization uses result locations properly with regards to the type" {
...@@ -1042,7 +1042,7 @@ test "cast between C pointer with different but compatible types" {...@@ -1042,7 +1042,7 @@ test "cast between C pointer with different but compatible types" {
1042 }1042 }
1043 };1043 };
1044 try S.doTheTest();1044 try S.doTheTest();
1045 comptime try S.doTheTest();1045 try comptime S.doTheTest();
1046}1046}
10471047
1048test "peer type resolve string lit with sentinel-terminated mutable slice" {1048test "peer type resolve string lit with sentinel-terminated mutable slice" {
...@@ -1053,8 +1053,8 @@ test "peer type resolve string lit with sentinel-terminated mutable slice" {...@@ -1053,8 +1053,8 @@ test "peer type resolve string lit with sentinel-terminated mutable slice" {
1053 var array: [4:0]u8 = undefined;1053 var array: [4:0]u8 = undefined;
1054 array[4] = 0; // TODO remove this when #4372 is solved1054 array[4] = 0; // TODO remove this when #4372 is solved
1055 var slice: [:0]u8 = array[0..4 :0];1055 var slice: [:0]u8 = array[0..4 :0];
1056 comptime try expect(@TypeOf(slice, "hi") == [:0]const u8);1056 try comptime expect(@TypeOf(slice, "hi") == [:0]const u8);
1057 comptime try expect(@TypeOf("hi", slice) == [:0]const u8);1057 try comptime expect(@TypeOf("hi", slice) == [:0]const u8);
1058}1058}
10591059
1060test "peer type resolve array pointers, one of them const" {1060test "peer type resolve array pointers, one of them const" {
...@@ -1062,8 +1062,8 @@ test "peer type resolve array pointers, one of them const" {...@@ -1062,8 +1062,8 @@ test "peer type resolve array pointers, one of them const" {
10621062
1063 var array1: [4]u8 = undefined;1063 var array1: [4]u8 = undefined;
1064 const array2: [5]u8 = undefined;1064 const array2: [5]u8 = undefined;
1065 comptime try expect(@TypeOf(&array1, &array2) == []const u8);1065 try comptime expect(@TypeOf(&array1, &array2) == []const u8);
1066 comptime try expect(@TypeOf(&array2, &array1) == []const u8);1066 try comptime expect(@TypeOf(&array2, &array1) == []const u8);
1067}1067}
10681068
1069test "peer type resolve array pointer and unknown pointer" {1069test "peer type resolve array pointer and unknown pointer" {
...@@ -1074,17 +1074,17 @@ test "peer type resolve array pointer and unknown pointer" {...@@ -1074,17 +1074,17 @@ test "peer type resolve array pointer and unknown pointer" {
1074 var const_ptr: [*]const u8 = undefined;1074 var const_ptr: [*]const u8 = undefined;
1075 var ptr: [*]u8 = undefined;1075 var ptr: [*]u8 = undefined;
10761076
1077 comptime try expect(@TypeOf(&array, ptr) == [*]u8);1077 try comptime expect(@TypeOf(&array, ptr) == [*]u8);
1078 comptime try expect(@TypeOf(ptr, &array) == [*]u8);1078 try comptime expect(@TypeOf(ptr, &array) == [*]u8);
10791079
1080 comptime try expect(@TypeOf(&const_array, ptr) == [*]const u8);1080 try comptime expect(@TypeOf(&const_array, ptr) == [*]const u8);
1081 comptime try expect(@TypeOf(ptr, &const_array) == [*]const u8);1081 try comptime expect(@TypeOf(ptr, &const_array) == [*]const u8);
10821082
1083 comptime try expect(@TypeOf(&array, const_ptr) == [*]const u8);1083 try comptime expect(@TypeOf(&array, const_ptr) == [*]const u8);
1084 comptime try expect(@TypeOf(const_ptr, &array) == [*]const u8);1084 try comptime expect(@TypeOf(const_ptr, &array) == [*]const u8);
10851085
1086 comptime try expect(@TypeOf(&const_array, const_ptr) == [*]const u8);1086 try comptime expect(@TypeOf(&const_array, const_ptr) == [*]const u8);
1087 comptime try expect(@TypeOf(const_ptr, &const_array) == [*]const u8);1087 try comptime expect(@TypeOf(const_ptr, &const_array) == [*]const u8);
1088}1088}
10891089
1090test "comptime float casts" {1090test "comptime float casts" {
...@@ -1209,7 +1209,7 @@ test "implicitly cast from [N]T to ?[]const T" {...@@ -1209,7 +1209,7 @@ test "implicitly cast from [N]T to ?[]const T" {
1209 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1209 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
12101210
1211 try expect(mem.eql(u8, castToOptionalSlice().?, "hi"));1211 try expect(mem.eql(u8, castToOptionalSlice().?, "hi"));
1212 comptime try expect(mem.eql(u8, castToOptionalSlice().?, "hi"));1212 try comptime expect(mem.eql(u8, castToOptionalSlice().?, "hi"));
1213}1213}
12141214
1215fn castToOptionalSlice() ?[]const u8 {1215fn castToOptionalSlice() ?[]const u8 {
...@@ -1223,7 +1223,7 @@ test "cast u128 to f128 and back" {...@@ -1223,7 +1223,7 @@ test "cast u128 to f128 and back" {
1223 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1223 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1224 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1224 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
12251225
1226 comptime try testCast128();1226 try comptime testCast128();
1227 try testCast128();1227 try testCast128();
1228}1228}
12291229
...@@ -1303,7 +1303,7 @@ test "*const [N]null u8 to ?[]const u8" {...@@ -1303,7 +1303,7 @@ test "*const [N]null u8 to ?[]const u8" {
1303 }1303 }
1304 };1304 };
1305 try S.doTheTest();1305 try S.doTheTest();
1306 comptime try S.doTheTest();1306 try comptime S.doTheTest();
1307}1307}
13081308
1309test "cast between [*c]T and ?[*:0]T on fn parameter" {1309test "cast between [*c]T and ?[*:0]T on fn parameter" {
...@@ -1352,8 +1352,8 @@ test "peer resolve arrays of different size to const slice" {...@@ -1352,8 +1352,8 @@ test "peer resolve arrays of different size to const slice" {
13521352
1353 try expect(mem.eql(u8, boolToStr(true), "true"));1353 try expect(mem.eql(u8, boolToStr(true), "true"));
1354 try expect(mem.eql(u8, boolToStr(false), "false"));1354 try expect(mem.eql(u8, boolToStr(false), "false"));
1355 comptime try expect(mem.eql(u8, boolToStr(true), "true"));1355 try comptime expect(mem.eql(u8, boolToStr(true), "true"));
1356 comptime try expect(mem.eql(u8, boolToStr(false), "false"));1356 try comptime expect(mem.eql(u8, boolToStr(false), "false"));
1357}1357}
1358fn boolToStr(b: bool) []const u8 {1358fn boolToStr(b: bool) []const u8 {
1359 return if (b) "true" else "false";1359 return if (b) "true" else "false";
...@@ -1376,7 +1376,7 @@ test "cast f16 to wider types" {...@@ -1376,7 +1376,7 @@ test "cast f16 to wider types" {
1376 }1376 }
1377 };1377 };
1378 try S.doTheTest();1378 try S.doTheTest();
1379 comptime try S.doTheTest();1379 try comptime S.doTheTest();
1380}1380}
13811381
1382test "cast f128 to narrower types" {1382test "cast f128 to narrower types" {
...@@ -1396,7 +1396,7 @@ test "cast f128 to narrower types" {...@@ -1396,7 +1396,7 @@ test "cast f128 to narrower types" {
1396 }1396 }
1397 };1397 };
1398 try S.doTheTest();1398 try S.doTheTest();
1399 comptime try S.doTheTest();1399 try comptime S.doTheTest();
1400}1400}
14011401
1402test "peer type resolution: unreachable, null, slice" {1402test "peer type resolution: unreachable, null, slice" {
...@@ -1436,7 +1436,7 @@ test "cast i8 fn call peers to i32 result" {...@@ -1436,7 +1436,7 @@ test "cast i8 fn call peers to i32 result" {
1436 }1436 }
1437 };1437 };
1438 try S.doTheTest();1438 try S.doTheTest();
1439 comptime try S.doTheTest();1439 try comptime S.doTheTest();
1440}1440}
14411441
1442test "cast compatible optional types" {1442test "cast compatible optional types" {
...@@ -1509,7 +1509,7 @@ test "floatToInt to zero-bit int" {...@@ -1509,7 +1509,7 @@ test "floatToInt to zero-bit int" {
1509 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1509 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
15101510
1511 const a: f32 = 0.0;1511 const a: f32 = 0.0;
1512 comptime try std.testing.expect(@floatToInt(u0, a) == 0);1512 try comptime std.testing.expect(@floatToInt(u0, a) == 0);
1513}1513}
15141514
1515test "peer type resolution of function pointer and function body" {1515test "peer type resolution of function pointer and function body" {
test/behavior/comptime_memory.zig+2-2
...@@ -257,9 +257,9 @@ test "shuffle chunks of linker value" {...@@ -257,9 +257,9 @@ test "shuffle chunks of linker value" {
257 try testing.expectEqual(lazy_address, unshuffled1_rt);257 try testing.expectEqual(lazy_address, unshuffled1_rt);
258 const shuffled1_ct = comptime shuffle(lazy_address, Bits, ShuffledBits);258 const shuffled1_ct = comptime shuffle(lazy_address, Bits, ShuffledBits);
259 const shuffled1_ct_2 = comptime shuffle(lazy_address, Bits, ShuffledBits);259 const shuffled1_ct_2 = comptime shuffle(lazy_address, Bits, ShuffledBits);
260 comptime try testing.expectEqual(shuffled1_ct, shuffled1_ct_2);260 try comptime testing.expectEqual(shuffled1_ct, shuffled1_ct_2);
261 const unshuffled1_ct = comptime shuffle(shuffled1_ct, ShuffledBits, Bits);261 const unshuffled1_ct = comptime shuffle(shuffled1_ct, ShuffledBits, Bits);
262 comptime try testing.expectEqual(lazy_address, unshuffled1_ct);262 try comptime testing.expectEqual(lazy_address, unshuffled1_ct);
263 try testing.expectEqual(shuffled1_ct, shuffled1_rt);263 try testing.expectEqual(shuffled1_ct, shuffled1_rt);
264}264}
265265
test/behavior/defer.zig+3-3
...@@ -70,7 +70,7 @@ test "return variable while defer expression in scope to modify it" {...@@ -70,7 +70,7 @@ test "return variable while defer expression in scope to modify it" {
70 };70 };
7171
72 try S.doTheTest();72 try S.doTheTest();
73 comptime try S.doTheTest();73 try comptime S.doTheTest();
74}74}
7575
76var result: [3]u8 = undefined;76var result: [3]u8 = undefined;
...@@ -131,7 +131,7 @@ test "errdefer with payload" {...@@ -131,7 +131,7 @@ test "errdefer with payload" {
131 }131 }
132 };132 };
133 try S.doTheTest();133 try S.doTheTest();
134 comptime try S.doTheTest();134 try comptime S.doTheTest();
135}135}
136136
137test "reference to errdefer payload" {137test "reference to errdefer payload" {
...@@ -157,7 +157,7 @@ test "reference to errdefer payload" {...@@ -157,7 +157,7 @@ test "reference to errdefer payload" {
157 }157 }
158 };158 };
159 try S.doTheTest();159 try S.doTheTest();
160 comptime try S.doTheTest();160 try comptime S.doTheTest();
161}161}
162162
163test "simple else prong doesn't emit an error for unreachable else prong" {163test "simple else prong doesn't emit an error for unreachable else prong" {
test/behavior/enum.zig+16-16
...@@ -611,7 +611,7 @@ test "enum with specified tag values" {...@@ -611,7 +611,7 @@ test "enum with specified tag values" {
611 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO611 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
612612
613 try testEnumWithSpecifiedTagValues(MultipleChoice.C);613 try testEnumWithSpecifiedTagValues(MultipleChoice.C);
614 comptime try testEnumWithSpecifiedTagValues(MultipleChoice.C);614 try comptime testEnumWithSpecifiedTagValues(MultipleChoice.C);
615}615}
616616
617test "non-exhaustive enum" {617test "non-exhaustive enum" {
...@@ -656,7 +656,7 @@ test "non-exhaustive enum" {...@@ -656,7 +656,7 @@ test "non-exhaustive enum" {
656 }656 }
657 };657 };
658 try S.doTheTest(52);658 try S.doTheTest(52);
659 comptime try S.doTheTest(52);659 try comptime S.doTheTest(52);
660}660}
661661
662test "empty non-exhaustive enum" {662test "empty non-exhaustive enum" {
...@@ -677,7 +677,7 @@ test "empty non-exhaustive enum" {...@@ -677,7 +677,7 @@ test "empty non-exhaustive enum" {
677 }677 }
678 };678 };
679 try S.doTheTest(42);679 try S.doTheTest(42);
680 comptime try S.doTheTest(42);680 try comptime S.doTheTest(42);
681}681}
682682
683test "single field non-exhaustive enum" {683test "single field non-exhaustive enum" {
...@@ -715,7 +715,7 @@ test "single field non-exhaustive enum" {...@@ -715,7 +715,7 @@ test "single field non-exhaustive enum" {
715 }715 }
716 };716 };
717 try S.doTheTest(23);717 try S.doTheTest(23);
718 comptime try S.doTheTest(23);718 try comptime S.doTheTest(23);
719}719}
720720
721const EnumWithTagValues = enum(u4) {721const EnumWithTagValues = enum(u4) {
...@@ -750,7 +750,7 @@ test "enum with specified and unspecified tag values" {...@@ -750,7 +750,7 @@ test "enum with specified and unspecified tag values" {
750 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO750 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
751751
752 try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D);752 try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D);
753 comptime try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D);753 try comptime testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D);
754}754}
755755
756fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void {756fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void {
...@@ -775,18 +775,18 @@ test "set enum tag type" {...@@ -775,18 +775,18 @@ test "set enum tag type" {
775 {775 {
776 var x = Small.One;776 var x = Small.One;
777 x = Small.Two;777 x = Small.Two;
778 comptime try expect(Tag(Small) == u2);778 try comptime expect(Tag(Small) == u2);
779 }779 }
780 {780 {
781 var x = Small2.One;781 var x = Small2.One;
782 x = Small2.Two;782 x = Small2.Two;
783 comptime try expect(Tag(Small2) == u2);783 try comptime expect(Tag(Small2) == u2);
784 }784 }
785}785}
786786
787test "casting enum to its tag type" {787test "casting enum to its tag type" {
788 try testCastEnumTag(Small2.Two);788 try testCastEnumTag(Small2.Two);
789 comptime try testCastEnumTag(Small2.Two);789 try comptime testCastEnumTag(Small2.Two);
790}790}
791791
792fn testCastEnumTag(value: Small2) !void {792fn testCastEnumTag(value: Small2) !void {
...@@ -797,7 +797,7 @@ test "enum with 1 field but explicit tag type should still have the tag type" {...@@ -797,7 +797,7 @@ test "enum with 1 field but explicit tag type should still have the tag type" {
797 const Enum = enum(u8) {797 const Enum = enum(u8) {
798 B = 2,798 B = 2,
799 };799 };
800 comptime try expect(@sizeOf(Enum) == @sizeOf(u8));800 try comptime expect(@sizeOf(Enum) == @sizeOf(u8));
801}801}
802802
803test "signed integer as enum tag" {803test "signed integer as enum tag" {
...@@ -836,12 +836,12 @@ test "enum with comptime_int tag type" {...@@ -836,12 +836,12 @@ test "enum with comptime_int tag type" {
836 Two = 2,836 Two = 2,
837 Three = 1,837 Three = 1,
838 };838 };
839 comptime try expect(Tag(Enum) == comptime_int);839 try comptime expect(Tag(Enum) == comptime_int);
840}840}
841841
842test "enum with one member default to u0 tag type" {842test "enum with one member default to u0 tag type" {
843 const E0 = enum { X };843 const E0 = enum { X };
844 comptime try expect(Tag(E0) == u0);844 try comptime expect(Tag(E0) == u0);
845}845}
846846
847const EnumWithOneMember = enum { Eof };847const EnumWithOneMember = enum { Eof };
...@@ -891,7 +891,7 @@ test "method call on an enum" {...@@ -891,7 +891,7 @@ test "method call on an enum" {
891 }891 }
892 };892 };
893 try S.doTheTest();893 try S.doTheTest();
894 comptime try S.doTheTest();894 try comptime S.doTheTest();
895}895}
896896
897test "enum value allocation" {897test "enum value allocation" {
...@@ -993,7 +993,7 @@ test "@tagName" {...@@ -993,7 +993,7 @@ test "@tagName" {
993 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;993 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
994994
995 try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three"));995 try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three"));
996 comptime try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three"));996 try comptime expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three"));
997}997}
998998
999fn testEnumTagNameBare(n: anytype) []const u8 {999fn testEnumTagNameBare(n: anytype) []const u8 {
...@@ -1009,7 +1009,7 @@ test "@tagName non-exhaustive enum" {...@@ -1009,7 +1009,7 @@ test "@tagName non-exhaustive enum" {
1009 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1009 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
10101010
1011 try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B"));1011 try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B"));
1012 comptime try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B"));1012 try comptime expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B"));
1013}1013}
1014const NonExhaustive = enum(u8) { A, B, _ };1014const NonExhaustive = enum(u8) { A, B, _ };
10151015
...@@ -1047,7 +1047,7 @@ test "@tagName on enum literals" {...@@ -1047,7 +1047,7 @@ test "@tagName on enum literals" {
1047 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1047 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
10481048
1049 try expect(mem.eql(u8, @tagName(.FooBar), "FooBar"));1049 try expect(mem.eql(u8, @tagName(.FooBar), "FooBar"));
1050 comptime try expect(mem.eql(u8, @tagName(.FooBar), "FooBar"));1050 try comptime expect(mem.eql(u8, @tagName(.FooBar), "FooBar"));
1051}1051}
10521052
1053test "enum literal casting to optional" {1053test "enum literal casting to optional" {
...@@ -1088,7 +1088,7 @@ test "bit field access with enum fields" {...@@ -1088,7 +1088,7 @@ test "bit field access with enum fields" {
1088 try expect(getA(&data) == A.Two);1088 try expect(getA(&data) == A.Two);
1089 try expect(getB(&data) == B.Three3);1089 try expect(getB(&data) == B.Three3);
1090 try expect(getC(&data) == C.Four4);1090 try expect(getC(&data) == C.Four4);
1091 comptime try expect(@sizeOf(BitFieldOfEnums) == 1);1091 try comptime expect(@sizeOf(BitFieldOfEnums) == 1);
10921092
1093 data.b = B.Four3;1093 data.b = B.Four3;
1094 try expect(data.b == B.Four3);1094 try expect(data.b == B.Four3);
test/behavior/error.zig+11-11
...@@ -188,7 +188,7 @@ fn bar2() (error{}!void) {}...@@ -188,7 +188,7 @@ fn bar2() (error{}!void) {}
188188
189test "error union type " {189test "error union type " {
190 try testErrorUnionType();190 try testErrorUnionType();
191 comptime try testErrorUnionType();191 try comptime testErrorUnionType();
192}192}
193193
194fn testErrorUnionType() !void {194fn testErrorUnionType() !void {
...@@ -201,7 +201,7 @@ fn testErrorUnionType() !void {...@@ -201,7 +201,7 @@ fn testErrorUnionType() !void {
201201
202test "error set type" {202test "error set type" {
203 try testErrorSetType();203 try testErrorSetType();
204 comptime try testErrorSetType();204 try comptime testErrorSetType();
205}205}
206206
207const MyErrSet = error{207const MyErrSet = error{
...@@ -227,7 +227,7 @@ test "explicit error set cast" {...@@ -227,7 +227,7 @@ test "explicit error set cast" {
227 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;227 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
228228
229 try testExplicitErrorSetCast(Set1.A);229 try testExplicitErrorSetCast(Set1.A);
230 comptime try testExplicitErrorSetCast(Set1.A);230 try comptime testExplicitErrorSetCast(Set1.A);
231}231}
232232
233const Set1 = error{ A, B };233const Set1 = error{ A, B };
...@@ -246,7 +246,7 @@ test "comptime test error for empty error set" {...@@ -246,7 +246,7 @@ test "comptime test error for empty error set" {
246 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;246 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
247247
248 try testComptimeTestErrorEmptySet(1234);248 try testComptimeTestErrorEmptySet(1234);
249 comptime try testComptimeTestErrorEmptySet(1234);249 try comptime testComptimeTestErrorEmptySet(1234);
250}250}
251251
252const EmptyErrorSet = error{};252const EmptyErrorSet = error{};
...@@ -337,7 +337,7 @@ test "error: Zero sized error set returned with value payload crash" {...@@ -337,7 +337,7 @@ test "error: Zero sized error set returned with value payload crash" {
337 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;337 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
338338
339 _ = try foo3(0);339 _ = try foo3(0);
340 _ = comptime try foo3(0);340 _ = try comptime foo3(0);
341}341}
342342
343const Error = error{};343const Error = error{};
...@@ -446,7 +446,7 @@ test "return function call to error set from error union function" {...@@ -446,7 +446,7 @@ test "return function call to error set from error union function" {
446 }446 }
447 };447 };
448 try expectError(error.Failure, S.errorable());448 try expectError(error.Failure, S.errorable());
449 comptime try expectError(error.Failure, S.errorable());449 try comptime expectError(error.Failure, S.errorable());
450}450}
451451
452test "optional error set is the same size as error set" {452test "optional error set is the same size as error set" {
...@@ -455,15 +455,15 @@ test "optional error set is the same size as error set" {...@@ -455,15 +455,15 @@ test "optional error set is the same size as error set" {
455 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO455 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
456 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;456 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
457457
458 comptime try expect(@sizeOf(?anyerror) == @sizeOf(anyerror));458 try comptime expect(@sizeOf(?anyerror) == @sizeOf(anyerror));
459 comptime try expect(@alignOf(?anyerror) == @alignOf(anyerror));459 try comptime expect(@alignOf(?anyerror) == @alignOf(anyerror));
460 const S = struct {460 const S = struct {
461 fn returnsOptErrSet() ?anyerror {461 fn returnsOptErrSet() ?anyerror {
462 return null;462 return null;
463 }463 }
464 };464 };
465 try expect(S.returnsOptErrSet() == null);465 try expect(S.returnsOptErrSet() == null);
466 comptime try expect(S.returnsOptErrSet() == null);466 try comptime expect(S.returnsOptErrSet() == null);
467}467}
468468
469test "nested catch" {469test "nested catch" {
...@@ -489,7 +489,7 @@ test "nested catch" {...@@ -489,7 +489,7 @@ test "nested catch" {
489 };489 };
490 };490 };
491 try S.entry();491 try S.entry();
492 comptime try S.entry();492 try comptime S.entry();
493}493}
494494
495test "function pointer with return type that is error union with payload which is pointer of parent struct" {495test "function pointer with return type that is error union with payload which is pointer of parent struct" {
...@@ -545,7 +545,7 @@ test "return result loc as peer result loc in inferred error set function" {...@@ -545,7 +545,7 @@ test "return result loc as peer result loc in inferred error set function" {
545 }545 }
546 };546 };
547 try S.doTheTest();547 try S.doTheTest();
548 comptime try S.doTheTest();548 try comptime S.doTheTest();
549}549}
550550
551test "error payload type is correctly resolved" {551test "error payload type is correctly resolved" {
test/behavior/eval.zig+10-10
...@@ -56,7 +56,7 @@ fn staticAdd(a: i32, b: i32) i32 {...@@ -56,7 +56,7 @@ fn staticAdd(a: i32, b: i32) i32 {
5656
57test "const expr eval on single expr blocks" {57test "const expr eval on single expr blocks" {
58 try expect(constExprEvalOnSingleExprBlocksFn(1, true) == 3);58 try expect(constExprEvalOnSingleExprBlocksFn(1, true) == 3);
59 comptime try expect(constExprEvalOnSingleExprBlocksFn(1, true) == 3);59 try comptime expect(constExprEvalOnSingleExprBlocksFn(1, true) == 3);
60}60}
6161
62fn constExprEvalOnSingleExprBlocksFn(x: i32, b: bool) i32 {62fn constExprEvalOnSingleExprBlocksFn(x: i32, b: bool) i32 {
...@@ -436,7 +436,7 @@ test "f64 at compile time is lossy" {...@@ -436,7 +436,7 @@ test "f64 at compile time is lossy" {
436}436}
437437
438test {438test {
439 comptime try expect(@as(f128, 1 << 113) == 10384593717069655257060992658440192);439 try comptime expect(@as(f128, 1 << 113) == 10384593717069655257060992658440192);
440}440}
441441
442fn copyWithPartialInline(s: []u32, b: []u8) void {442fn copyWithPartialInline(s: []u32, b: []u8) void {
...@@ -625,7 +625,7 @@ test "const global shares pointer with other same one" {...@@ -625,7 +625,7 @@ test "const global shares pointer with other same one" {
625 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;625 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
626626
627 try assertEqualPtrs(&hi1[0], &hi2[0]);627 try assertEqualPtrs(&hi1[0], &hi2[0]);
628 comptime try expect(&hi1[0] == &hi2[0]);628 try comptime expect(&hi1[0] == &hi2[0]);
629}629}
630fn assertEqualPtrs(ptr1: *const u8, ptr2: *const u8) !void {630fn assertEqualPtrs(ptr1: *const u8, ptr2: *const u8) !void {
631 try expect(ptr1 == ptr2);631 try expect(ptr1 == ptr2);
...@@ -646,8 +646,8 @@ fn assertEqualPtrs(ptr1: *const u8, ptr2: *const u8) !void {...@@ -646,8 +646,8 @@ fn assertEqualPtrs(ptr1: *const u8, ptr2: *const u8) !void {
646test "string literal used as comptime slice is memoized" {646test "string literal used as comptime slice is memoized" {
647 const a = "link";647 const a = "link";
648 const b = "link";648 const b = "link";
649 comptime try expect(TypeWithCompTimeSlice(a).Node == TypeWithCompTimeSlice(b).Node);649 try comptime expect(TypeWithCompTimeSlice(a).Node == TypeWithCompTimeSlice(b).Node);
650 comptime try expect(TypeWithCompTimeSlice("link").Node == TypeWithCompTimeSlice("link").Node);650 try comptime expect(TypeWithCompTimeSlice("link").Node == TypeWithCompTimeSlice("link").Node);
651}651}
652652
653pub fn TypeWithCompTimeSlice(comptime field_name: []const u8) type {653pub fn TypeWithCompTimeSlice(comptime field_name: []const u8) type {
...@@ -1072,7 +1072,7 @@ test "comptime break operand passing through runtime condition converted to runt...@@ -1072,7 +1072,7 @@ test "comptime break operand passing through runtime condition converted to runt
1072 };1072 };
10731073
1074 try S.doTheTest('b');1074 try S.doTheTest('b');
1075 comptime try S.doTheTest('b');1075 try comptime S.doTheTest('b');
1076}1076}
10771077
1078test "comptime break operand passing through runtime switch converted to runtime break" {1078test "comptime break operand passing through runtime switch converted to runtime break" {
...@@ -1092,7 +1092,7 @@ test "comptime break operand passing through runtime switch converted to runtime...@@ -1092,7 +1092,7 @@ test "comptime break operand passing through runtime switch converted to runtime
1092 };1092 };
10931093
1094 try S.doTheTest('b');1094 try S.doTheTest('b');
1095 comptime try S.doTheTest('b');1095 try comptime S.doTheTest('b');
1096}1096}
10971097
1098test "no dependency loop for alignment of self struct" {1098test "no dependency loop for alignment of self struct" {
...@@ -1349,7 +1349,7 @@ test "value in if block is comptime-known" {...@@ -1349,7 +1349,7 @@ test "value in if block is comptime-known" {
1349 const s = if (false) S{ .str = "a" } else S{ .str = "b" };1349 const s = if (false) S{ .str = "a" } else S{ .str = "b" };
1350 break :blk "foo" ++ s.str;1350 break :blk "foo" ++ s.str;
1351 };1351 };
1352 comptime try expect(std.mem.eql(u8, first, second));1352 try comptime expect(std.mem.eql(u8, first, second));
1353}1353}
13541354
1355test "lazy sizeof is resolved in division" {1355test "lazy sizeof is resolved in division" {
...@@ -1448,7 +1448,7 @@ test "length of global array is determinable at comptime" {...@@ -1448,7 +1448,7 @@ test "length of global array is determinable at comptime" {
1448 try std.testing.expect(bytes.len == 1024);1448 try std.testing.expect(bytes.len == 1024);
1449 }1449 }
1450 };1450 };
1451 comptime try S.foo();1451 try comptime S.foo();
1452}1452}
14531453
1454test "continue nested inline for loop" {1454test "continue nested inline for loop" {
...@@ -1574,7 +1574,7 @@ test "comptime function turns function value to function pointer" {...@@ -1574,7 +1574,7 @@ test "comptime function turns function value to function pointer" {
1574 fnPtr(Nil),1574 fnPtr(Nil),
1575 };1575 };
1576 };1576 };
1577 comptime try expect(S.foo[0] == &S.Nil);1577 try comptime expect(S.foo[0] == &S.Nil);
1578}1578}
15791579
1580test "container level const and var have unique addresses" {1580test "container level const and var have unique addresses" {
test/behavior/field_parent_ptr.zig+5-5
...@@ -7,7 +7,7 @@ test "@fieldParentPtr non-first field" {...@@ -7,7 +7,7 @@ test "@fieldParentPtr non-first field" {
7 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;7 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
88
9 try testParentFieldPtr(&foo.c);9 try testParentFieldPtr(&foo.c);
10 comptime try testParentFieldPtr(&foo.c);10 try comptime testParentFieldPtr(&foo.c);
11}11}
1212
13test "@fieldParentPtr first field" {13test "@fieldParentPtr first field" {
...@@ -16,7 +16,7 @@ test "@fieldParentPtr first field" {...@@ -16,7 +16,7 @@ test "@fieldParentPtr first field" {
16 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;16 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1717
18 try testParentFieldPtrFirst(&foo.a);18 try testParentFieldPtrFirst(&foo.a);
19 comptime try testParentFieldPtrFirst(&foo.a);19 try comptime testParentFieldPtrFirst(&foo.a);
20}20}
2121
22const Foo = struct {22const Foo = struct {
...@@ -56,7 +56,7 @@ test "@fieldParentPtr untagged union" {...@@ -56,7 +56,7 @@ test "@fieldParentPtr untagged union" {
56 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;56 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
5757
58 try testFieldParentPtrUnion(&bar.c);58 try testFieldParentPtrUnion(&bar.c);
59 comptime try testFieldParentPtrUnion(&bar.c);59 try comptime testFieldParentPtrUnion(&bar.c);
60}60}
6161
62const Bar = union(enum) {62const Bar = union(enum) {
...@@ -83,7 +83,7 @@ test "@fieldParentPtr tagged union" {...@@ -83,7 +83,7 @@ test "@fieldParentPtr tagged union" {
83 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;83 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
8484
85 try testFieldParentPtrTaggedUnion(&bar_tagged.c);85 try testFieldParentPtrTaggedUnion(&bar_tagged.c);
86 comptime try testFieldParentPtrTaggedUnion(&bar_tagged.c);86 try comptime testFieldParentPtrTaggedUnion(&bar_tagged.c);
87}87}
8888
89const BarTagged = union(enum) {89const BarTagged = union(enum) {
...@@ -110,7 +110,7 @@ test "@fieldParentPtr extern union" {...@@ -110,7 +110,7 @@ test "@fieldParentPtr extern union" {
110 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;110 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
111111
112 try testFieldParentPtrExternUnion(&bar_extern.c);112 try testFieldParentPtrExternUnion(&bar_extern.c);
113 comptime try testFieldParentPtrExternUnion(&bar_extern.c);113 try comptime testFieldParentPtrExternUnion(&bar_extern.c);
114}114}
115115
116const BarExtern = extern union {116const BarExtern = extern union {
test/behavior/floatop.zig+58-58
...@@ -25,7 +25,7 @@ test "floating point comparisons" {...@@ -25,7 +25,7 @@ test "floating point comparisons" {
25 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO25 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
2626
27 try testFloatComparisons();27 try testFloatComparisons();
28 comptime try testFloatComparisons();28 try comptime testFloatComparisons();
29}29}
3030
31fn testFloatComparisons() !void {31fn testFloatComparisons() !void {
...@@ -61,7 +61,7 @@ test "different sized float comparisons" {...@@ -61,7 +61,7 @@ test "different sized float comparisons" {
61 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;61 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
6262
63 try testDifferentSizedFloatComparisons();63 try testDifferentSizedFloatComparisons();
64 comptime try testDifferentSizedFloatComparisons();64 try comptime testDifferentSizedFloatComparisons();
65}65}
6666
67fn testDifferentSizedFloatComparisons() !void {67fn testDifferentSizedFloatComparisons() !void {
...@@ -104,7 +104,7 @@ test "@sqrt" {...@@ -104,7 +104,7 @@ test "@sqrt" {
104 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO104 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
105 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;105 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
106106
107 comptime try testSqrt();107 try comptime testSqrt();
108 try testSqrt();108 try testSqrt();
109}109}
110110
...@@ -142,7 +142,7 @@ test "@sqrt with vectors" {...@@ -142,7 +142,7 @@ test "@sqrt with vectors" {
142 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO142 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
143 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;143 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
144144
145 comptime try testSqrtWithVectors();145 try comptime testSqrtWithVectors();
146 try testSqrtWithVectors();146 try testSqrtWithVectors();
147}147}
148148
...@@ -188,18 +188,18 @@ test "another, possibly redundant @sqrt test" {...@@ -188,18 +188,18 @@ test "another, possibly redundant @sqrt test" {
188 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;188 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
189189
190 try testSqrtLegacy(f64, 12.0);190 try testSqrtLegacy(f64, 12.0);
191 comptime try testSqrtLegacy(f64, 12.0);191 try comptime testSqrtLegacy(f64, 12.0);
192 try testSqrtLegacy(f32, 13.0);192 try testSqrtLegacy(f32, 13.0);
193 comptime try testSqrtLegacy(f32, 13.0);193 try comptime testSqrtLegacy(f32, 13.0);
194 try testSqrtLegacy(f16, 13.0);194 try testSqrtLegacy(f16, 13.0);
195 comptime try testSqrtLegacy(f16, 13.0);195 try comptime testSqrtLegacy(f16, 13.0);
196196
197 // TODO: make this pass197 // TODO: make this pass
198 if (false) {198 if (false) {
199 const x = 14.0;199 const x = 14.0;
200 const y = x * x;200 const y = x * x;
201 const z = @sqrt(y);201 const z = @sqrt(y);
202 comptime try expect(z == x);202 try comptime expect(z == x);
203 }203 }
204}204}
205205
...@@ -214,7 +214,7 @@ test "@sin" {...@@ -214,7 +214,7 @@ test "@sin" {
214 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO214 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
215 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;215 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
216216
217 comptime try testSin();217 try comptime testSin();
218 try testSin();218 try testSin();
219}219}
220220
...@@ -235,7 +235,7 @@ test "@sin with vectors" {...@@ -235,7 +235,7 @@ test "@sin with vectors" {
235 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO235 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
236 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;236 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
237237
238 comptime try testSinWithVectors();238 try comptime testSinWithVectors();
239 try testSinWithVectors();239 try testSinWithVectors();
240}240}
241241
...@@ -255,7 +255,7 @@ test "@cos" {...@@ -255,7 +255,7 @@ test "@cos" {
255 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO255 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
256 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;256 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
257257
258 comptime try testCos();258 try comptime testCos();
259 try testCos();259 try testCos();
260}260}
261261
...@@ -276,7 +276,7 @@ test "@cos with vectors" {...@@ -276,7 +276,7 @@ test "@cos with vectors" {
276 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO276 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
277 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;277 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
278278
279 comptime try testCosWithVectors();279 try comptime testCosWithVectors();
280 try testCosWithVectors();280 try testCosWithVectors();
281}281}
282282
...@@ -296,7 +296,7 @@ test "@exp" {...@@ -296,7 +296,7 @@ test "@exp" {
296 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO296 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
297 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;297 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
298298
299 comptime try testExp();299 try comptime testExp();
300 try testExp();300 try testExp();
301}301}
302302
...@@ -316,7 +316,7 @@ test "@exp with vectors" {...@@ -316,7 +316,7 @@ test "@exp with vectors" {
316 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO316 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
317 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;317 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
318318
319 comptime try testExpWithVectors();319 try comptime testExpWithVectors();
320 try testExpWithVectors();320 try testExpWithVectors();
321}321}
322322
...@@ -336,7 +336,7 @@ test "@exp2" {...@@ -336,7 +336,7 @@ test "@exp2" {
336 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO336 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
337 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;337 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
338338
339 comptime try testExp2();339 try comptime testExp2();
340 try testExp2();340 try testExp2();
341}341}
342342
...@@ -356,7 +356,7 @@ test "@exp2 with @vectors" {...@@ -356,7 +356,7 @@ test "@exp2 with @vectors" {
356 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO356 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
357 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;357 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
358358
359 comptime try testExp2WithVectors();359 try comptime testExp2WithVectors();
360 try testExp2WithVectors();360 try testExp2WithVectors();
361}361}
362362
...@@ -376,7 +376,7 @@ test "@log" {...@@ -376,7 +376,7 @@ test "@log" {
376 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO376 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
377 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;377 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
378378
379 comptime try testLog();379 try comptime testLog();
380 try testLog();380 try testLog();
381}381}
382382
...@@ -425,7 +425,7 @@ test "@log2" {...@@ -425,7 +425,7 @@ test "@log2" {
425 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO425 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
426 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;426 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
427427
428 comptime try testLog2();428 try comptime testLog2();
429 try testLog2();429 try testLog2();
430}430}
431431
...@@ -449,7 +449,7 @@ test "@log2 with vectors" {...@@ -449,7 +449,7 @@ test "@log2 with vectors" {
449 builtin.cpu.arch == .aarch64 and449 builtin.cpu.arch == .aarch64 and
450 builtin.os.tag == .windows) return error.SkipZigTest;450 builtin.os.tag == .windows) return error.SkipZigTest;
451451
452 comptime try testLog2WithVectors();452 try comptime testLog2WithVectors();
453 try testLog2WithVectors();453 try testLog2WithVectors();
454}454}
455455
...@@ -469,7 +469,7 @@ test "@log10" {...@@ -469,7 +469,7 @@ test "@log10" {
469 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO469 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
470 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;470 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
471471
472 comptime try testLog10();472 try comptime testLog10();
473 try testLog10();473 try testLog10();
474}474}
475475
...@@ -489,7 +489,7 @@ test "@log10 with vectors" {...@@ -489,7 +489,7 @@ test "@log10 with vectors" {
489 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO489 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
490 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;490 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
491491
492 comptime try testLog10WithVectors();492 try comptime testLog10WithVectors();
493 try testLog10WithVectors();493 try testLog10WithVectors();
494}494}
495495
...@@ -507,7 +507,7 @@ test "@fabs" {...@@ -507,7 +507,7 @@ test "@fabs" {
507 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO507 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
508 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO508 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
509509
510 comptime try testFabs();510 try comptime testFabs();
511 try testFabs();511 try testFabs();
512}512}
513513
...@@ -535,7 +535,7 @@ test "@fabs with vectors" {...@@ -535,7 +535,7 @@ test "@fabs with vectors" {
535 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO535 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
536 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;536 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
537537
538 comptime try testFabsWithVectors();538 try comptime testFabsWithVectors();
539 try testFabsWithVectors();539 try testFabsWithVectors();
540}540}
541541
...@@ -556,18 +556,18 @@ test "another, possibly redundant, @fabs test" {...@@ -556,18 +556,18 @@ test "another, possibly redundant, @fabs test" {
556 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;556 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
557557
558 try testFabsLegacy(f128, 12.0);558 try testFabsLegacy(f128, 12.0);
559 comptime try testFabsLegacy(f128, 12.0);559 try comptime testFabsLegacy(f128, 12.0);
560 try testFabsLegacy(f64, 12.0);560 try testFabsLegacy(f64, 12.0);
561 comptime try testFabsLegacy(f64, 12.0);561 try comptime testFabsLegacy(f64, 12.0);
562 try testFabsLegacy(f32, 12.0);562 try testFabsLegacy(f32, 12.0);
563 comptime try testFabsLegacy(f32, 12.0);563 try comptime testFabsLegacy(f32, 12.0);
564 try testFabsLegacy(f16, 12.0);564 try testFabsLegacy(f16, 12.0);
565 comptime try testFabsLegacy(f16, 12.0);565 try comptime testFabsLegacy(f16, 12.0);
566566
567 const x = 14.0;567 const x = 14.0;
568 const y = -x;568 const y = -x;
569 const z = @fabs(y);569 const z = @fabs(y);
570 comptime try std.testing.expectEqual(x, z);570 try comptime std.testing.expectEqual(x, z);
571}571}
572572
573test "@fabs f80" {573test "@fabs f80" {
...@@ -578,7 +578,7 @@ test "@fabs f80" {...@@ -578,7 +578,7 @@ test "@fabs f80" {
578 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;578 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
579579
580 try testFabsLegacy(f80, 12.0);580 try testFabsLegacy(f80, 12.0);
581 comptime try testFabsLegacy(f80, 12.0);581 try comptime testFabsLegacy(f80, 12.0);
582}582}
583583
584fn testFabsLegacy(comptime T: type, x: T) !void {584fn testFabsLegacy(comptime T: type, x: T) !void {
...@@ -621,7 +621,7 @@ test "@floor" {...@@ -621,7 +621,7 @@ test "@floor" {
621 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO621 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
622 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO622 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
623623
624 comptime try testFloor();624 try comptime testFloor();
625 try testFloor();625 try testFloor();
626}626}
627627
...@@ -646,7 +646,7 @@ test "@floor with vectors" {...@@ -646,7 +646,7 @@ test "@floor with vectors" {
646 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO646 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
647 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;647 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
648648
649 comptime try testFloorWithVectors();649 try comptime testFloorWithVectors();
650 try testFloorWithVectors();650 try testFloorWithVectors();
651}651}
652652
...@@ -666,16 +666,16 @@ test "another, possibly redundant, @floor test" {...@@ -666,16 +666,16 @@ test "another, possibly redundant, @floor test" {
666 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;666 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
667667
668 try testFloorLegacy(f64, 12.0);668 try testFloorLegacy(f64, 12.0);
669 comptime try testFloorLegacy(f64, 12.0);669 try comptime testFloorLegacy(f64, 12.0);
670 try testFloorLegacy(f32, 12.0);670 try testFloorLegacy(f32, 12.0);
671 comptime try testFloorLegacy(f32, 12.0);671 try comptime testFloorLegacy(f32, 12.0);
672 try testFloorLegacy(f16, 12.0);672 try testFloorLegacy(f16, 12.0);
673 comptime try testFloorLegacy(f16, 12.0);673 try comptime testFloorLegacy(f16, 12.0);
674674
675 const x = 14.0;675 const x = 14.0;
676 const y = x + 0.7;676 const y = x + 0.7;
677 const z = @floor(y);677 const z = @floor(y);
678 comptime try expect(x == z);678 try comptime expect(x == z);
679}679}
680680
681test "@floor f80" {681test "@floor f80" {
...@@ -691,7 +691,7 @@ test "@floor f80" {...@@ -691,7 +691,7 @@ test "@floor f80" {
691 }691 }
692692
693 try testFloorLegacy(f80, 12.0);693 try testFloorLegacy(f80, 12.0);
694 comptime try testFloorLegacy(f80, 12.0);694 try comptime testFloorLegacy(f80, 12.0);
695}695}
696696
697test "@floor f128" {697test "@floor f128" {
...@@ -702,7 +702,7 @@ test "@floor f128" {...@@ -702,7 +702,7 @@ test "@floor f128" {
702 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;702 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
703703
704 try testFloorLegacy(f128, 12.0);704 try testFloorLegacy(f128, 12.0);
705 comptime try testFloorLegacy(f128, 12.0);705 try comptime testFloorLegacy(f128, 12.0);
706}706}
707707
708fn testFloorLegacy(comptime T: type, x: T) !void {708fn testFloorLegacy(comptime T: type, x: T) !void {
...@@ -717,7 +717,7 @@ test "@ceil" {...@@ -717,7 +717,7 @@ test "@ceil" {
717 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO717 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
718 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;718 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
719719
720 comptime try testCeil();720 try comptime testCeil();
721 try testCeil();721 try testCeil();
722}722}
723723
...@@ -742,7 +742,7 @@ test "@ceil with vectors" {...@@ -742,7 +742,7 @@ test "@ceil with vectors" {
742 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO742 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
743 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;743 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
744744
745 comptime try testCeilWithVectors();745 try comptime testCeilWithVectors();
746 try testCeilWithVectors();746 try testCeilWithVectors();
747}747}
748748
...@@ -762,16 +762,16 @@ test "another, possibly redundant, @ceil test" {...@@ -762,16 +762,16 @@ test "another, possibly redundant, @ceil test" {
762 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;762 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
763763
764 try testCeilLegacy(f64, 12.0);764 try testCeilLegacy(f64, 12.0);
765 comptime try testCeilLegacy(f64, 12.0);765 try comptime testCeilLegacy(f64, 12.0);
766 try testCeilLegacy(f32, 12.0);766 try testCeilLegacy(f32, 12.0);
767 comptime try testCeilLegacy(f32, 12.0);767 try comptime testCeilLegacy(f32, 12.0);
768 try testCeilLegacy(f16, 12.0);768 try testCeilLegacy(f16, 12.0);
769 comptime try testCeilLegacy(f16, 12.0);769 try comptime testCeilLegacy(f16, 12.0);
770770
771 const x = 14.0;771 const x = 14.0;
772 const y = x - 0.7;772 const y = x - 0.7;
773 const z = @ceil(y);773 const z = @ceil(y);
774 comptime try expect(x == z);774 try comptime expect(x == z);
775}775}
776776
777test "@ceil f80" {777test "@ceil f80" {
...@@ -787,7 +787,7 @@ test "@ceil f80" {...@@ -787,7 +787,7 @@ test "@ceil f80" {
787 }787 }
788788
789 try testCeilLegacy(f80, 12.0);789 try testCeilLegacy(f80, 12.0);
790 comptime try testCeilLegacy(f80, 12.0);790 try comptime testCeilLegacy(f80, 12.0);
791}791}
792792
793test "@ceil f128" {793test "@ceil f128" {
...@@ -798,7 +798,7 @@ test "@ceil f128" {...@@ -798,7 +798,7 @@ test "@ceil f128" {
798 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;798 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
799799
800 try testCeilLegacy(f128, 12.0);800 try testCeilLegacy(f128, 12.0);
801 comptime try testCeilLegacy(f128, 12.0);801 try comptime testCeilLegacy(f128, 12.0);
802}802}
803803
804fn testCeilLegacy(comptime T: type, x: T) !void {804fn testCeilLegacy(comptime T: type, x: T) !void {
...@@ -812,7 +812,7 @@ test "@trunc" {...@@ -812,7 +812,7 @@ test "@trunc" {
812 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO812 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
813 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO813 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
814814
815 comptime try testTrunc();815 try comptime testTrunc();
816 try testTrunc();816 try testTrunc();
817}817}
818818
...@@ -837,7 +837,7 @@ test "@trunc with vectors" {...@@ -837,7 +837,7 @@ test "@trunc with vectors" {
837 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO837 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
838 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;838 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
839839
840 comptime try testTruncWithVectors();840 try comptime testTruncWithVectors();
841 try testTruncWithVectors();841 try testTruncWithVectors();
842}842}
843843
...@@ -857,16 +857,16 @@ test "another, possibly redundant, @trunc test" {...@@ -857,16 +857,16 @@ test "another, possibly redundant, @trunc test" {
857 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;857 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
858858
859 try testTruncLegacy(f64, 12.0);859 try testTruncLegacy(f64, 12.0);
860 comptime try testTruncLegacy(f64, 12.0);860 try comptime testTruncLegacy(f64, 12.0);
861 try testTruncLegacy(f32, 12.0);861 try testTruncLegacy(f32, 12.0);
862 comptime try testTruncLegacy(f32, 12.0);862 try comptime testTruncLegacy(f32, 12.0);
863 try testTruncLegacy(f16, 12.0);863 try testTruncLegacy(f16, 12.0);
864 comptime try testTruncLegacy(f16, 12.0);864 try comptime testTruncLegacy(f16, 12.0);
865865
866 const x = 14.0;866 const x = 14.0;
867 const y = x + 0.7;867 const y = x + 0.7;
868 const z = @trunc(y);868 const z = @trunc(y);
869 comptime try expect(x == z);869 try comptime expect(x == z);
870}870}
871871
872test "@trunc f80" {872test "@trunc f80" {
...@@ -882,7 +882,7 @@ test "@trunc f80" {...@@ -882,7 +882,7 @@ test "@trunc f80" {
882 }882 }
883883
884 try testTruncLegacy(f80, 12.0);884 try testTruncLegacy(f80, 12.0);
885 comptime try testTruncLegacy(f80, 12.0);885 try comptime testTruncLegacy(f80, 12.0);
886 comptime {886 comptime {
887 const x: f80 = 12.0;887 const x: f80 = 12.0;
888 const y = x + 0.8;888 const y = x + 0.8;
...@@ -899,7 +899,7 @@ test "@trunc f128" {...@@ -899,7 +899,7 @@ test "@trunc f128" {
899 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;899 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
900900
901 try testTruncLegacy(f128, 12.0);901 try testTruncLegacy(f128, 12.0);
902 comptime try testTruncLegacy(f128, 12.0);902 try comptime testTruncLegacy(f128, 12.0);
903}903}
904904
905fn testTruncLegacy(comptime T: type, x: T) !void {905fn testTruncLegacy(comptime T: type, x: T) !void {
...@@ -939,7 +939,7 @@ test "negation f16" {...@@ -939,7 +939,7 @@ test "negation f16" {
939 };939 };
940940
941 try S.doTheTest();941 try S.doTheTest();
942 comptime try S.doTheTest();942 try comptime S.doTheTest();
943}943}
944944
945test "negation f32" {945test "negation f32" {
...@@ -959,7 +959,7 @@ test "negation f32" {...@@ -959,7 +959,7 @@ test "negation f32" {
959 };959 };
960960
961 try S.doTheTest();961 try S.doTheTest();
962 comptime try S.doTheTest();962 try comptime S.doTheTest();
963}963}
964964
965test "negation f64" {965test "negation f64" {
...@@ -979,7 +979,7 @@ test "negation f64" {...@@ -979,7 +979,7 @@ test "negation f64" {
979 };979 };
980980
981 try S.doTheTest();981 try S.doTheTest();
982 comptime try S.doTheTest();982 try comptime S.doTheTest();
983}983}
984984
985test "negation f80" {985test "negation f80" {
...@@ -1001,7 +1001,7 @@ test "negation f80" {...@@ -1001,7 +1001,7 @@ test "negation f80" {
1001 };1001 };
10021002
1003 try S.doTheTest();1003 try S.doTheTest();
1004 comptime try S.doTheTest();1004 try comptime S.doTheTest();
1005}1005}
10061006
1007test "negation f128" {1007test "negation f128" {
...@@ -1023,7 +1023,7 @@ test "negation f128" {...@@ -1023,7 +1023,7 @@ test "negation f128" {
1023 };1023 };
10241024
1025 try S.doTheTest();1025 try S.doTheTest();
1026 comptime try S.doTheTest();1026 try comptime S.doTheTest();
1027}1027}
10281028
1029test "eval @setFloatMode at compile-time" {1029test "eval @setFloatMode at compile-time" {
test/behavior/fn.zig+6-6
...@@ -211,7 +211,7 @@ test "pass by non-copying value through var arg" {...@@ -211,7 +211,7 @@ test "pass by non-copying value through var arg" {
211}211}
212212
213fn addPointCoordsVar(pt: anytype) !i32 {213fn addPointCoordsVar(pt: anytype) !i32 {
214 comptime try expect(@TypeOf(pt) == Point);214 try comptime expect(@TypeOf(pt) == Point);
215 return pt.x + pt.y;215 return pt.x + pt.y;
216}216}
217217
...@@ -285,7 +285,7 @@ test "implicit cast fn call result to optional in field result" {...@@ -285,7 +285,7 @@ test "implicit cast fn call result to optional in field result" {
285 };285 };
286 };286 };
287 try S.entry();287 try S.entry();
288 comptime try S.entry();288 try comptime S.entry();
289}289}
290290
291test "void parameters" {291test "void parameters" {
...@@ -344,7 +344,7 @@ fn fn4() u32 {...@@ -344,7 +344,7 @@ fn fn4() u32 {
344344
345test "number literal as an argument" {345test "number literal as an argument" {
346 try numberLiteralArg(3);346 try numberLiteralArg(3);
347 comptime try numberLiteralArg(3);347 try comptime numberLiteralArg(3);
348}348}
349349
350fn numberLiteralArg(a: anytype) !void {350fn numberLiteralArg(a: anytype) !void {
...@@ -369,7 +369,7 @@ test "function call with anon list literal" {...@@ -369,7 +369,7 @@ test "function call with anon list literal" {
369 }369 }
370 };370 };
371 try S.doTheTest();371 try S.doTheTest();
372 comptime try S.doTheTest();372 try comptime S.doTheTest();
373}373}
374374
375test "function call with anon list literal - 2D" {375test "function call with anon list literal - 2D" {
...@@ -391,7 +391,7 @@ test "function call with anon list literal - 2D" {...@@ -391,7 +391,7 @@ test "function call with anon list literal - 2D" {
391 }391 }
392 };392 };
393 try S.doTheTest();393 try S.doTheTest();
394 comptime try S.doTheTest();394 try comptime S.doTheTest();
395}395}
396396
397test "ability to give comptime types and non comptime types to same parameter" {397test "ability to give comptime types and non comptime types to same parameter" {
...@@ -410,7 +410,7 @@ test "ability to give comptime types and non comptime types to same parameter" {...@@ -410,7 +410,7 @@ test "ability to give comptime types and non comptime types to same parameter" {
410 }410 }
411 };411 };
412 try S.doTheTest();412 try S.doTheTest();
413 comptime try S.doTheTest();413 try comptime S.doTheTest();
414}414}
415415
416test "function with inferred error set but returning no error" {416test "function with inferred error set but returning no error" {
test/behavior/for.zig+6-6
...@@ -23,7 +23,7 @@ test "continue in for loop" {...@@ -23,7 +23,7 @@ test "continue in for loop" {
2323
24test "break from outer for loop" {24test "break from outer for loop" {
25 try testBreakOuter();25 try testBreakOuter();
26 comptime try testBreakOuter();26 try comptime testBreakOuter();
27}27}
2828
29fn testBreakOuter() !void {29fn testBreakOuter() !void {
...@@ -40,7 +40,7 @@ fn testBreakOuter() !void {...@@ -40,7 +40,7 @@ fn testBreakOuter() !void {
4040
41test "continue outer for loop" {41test "continue outer for loop" {
42 try testContinueOuter();42 try testContinueOuter();
43 comptime try testContinueOuter();43 try comptime testContinueOuter();
44}44}
4545
46fn testContinueOuter() !void {46fn testContinueOuter() !void {
...@@ -129,7 +129,7 @@ test "for with null and T peer types and inferred result location type" {...@@ -129,7 +129,7 @@ test "for with null and T peer types and inferred result location type" {
129 }129 }
130 };130 };
131 try S.doTheTest(&[_]u8{ 1, 2 });131 try S.doTheTest(&[_]u8{ 1, 2 });
132 comptime try S.doTheTest(&[_]u8{ 1, 2 });132 try comptime S.doTheTest(&[_]u8{ 1, 2 });
133}133}
134134
135test "2 break statements and an else" {135test "2 break statements and an else" {
...@@ -150,7 +150,7 @@ test "2 break statements and an else" {...@@ -150,7 +150,7 @@ test "2 break statements and an else" {
150 }150 }
151 };151 };
152 try S.entry(true, false);152 try S.entry(true, false);
153 comptime try S.entry(true, false);153 try comptime S.entry(true, false);
154}154}
155155
156test "for loop with pointer elem var" {156test "for loop with pointer elem var" {
...@@ -197,7 +197,7 @@ test "for copies its payload" {...@@ -197,7 +197,7 @@ test "for copies its payload" {
197 }197 }
198 };198 };
199 try S.doTheTest();199 try S.doTheTest();
200 comptime try S.doTheTest();200 try comptime S.doTheTest();
201}201}
202202
203test "for on slice with allowzero ptr" {203test "for on slice with allowzero ptr" {
...@@ -214,7 +214,7 @@ test "for on slice with allowzero ptr" {...@@ -214,7 +214,7 @@ test "for on slice with allowzero ptr" {
214 }214 }
215 };215 };
216 try S.doTheTest(&[_]u8{ 1, 2, 3, 4 });216 try S.doTheTest(&[_]u8{ 1, 2, 3, 4 });
217 comptime try S.doTheTest(&[_]u8{ 1, 2, 3, 4 });217 try comptime S.doTheTest(&[_]u8{ 1, 2, 3, 4 });
218}218}
219219
220test "else continue outer for" {220test "else continue outer for" {
test/behavior/if.zig+2-2
...@@ -93,7 +93,7 @@ test "if copies its payload" {...@@ -93,7 +93,7 @@ test "if copies its payload" {
93 }93 }
94 };94 };
95 try S.doTheTest();95 try S.doTheTest();
96 comptime try S.doTheTest();96 try comptime S.doTheTest();
97}97}
9898
99test "if prongs cast to expected type instead of peer type resolution" {99test "if prongs cast to expected type instead of peer type resolution" {
...@@ -109,7 +109,7 @@ test "if prongs cast to expected type instead of peer type resolution" {...@@ -109,7 +109,7 @@ test "if prongs cast to expected type instead of peer type resolution" {
109 }109 }
110 };110 };
111 try S.doTheTest(false);111 try S.doTheTest(false);
112 comptime try S.doTheTest(false);112 try comptime S.doTheTest(false);
113}113}
114114
115test "if peer expressions inferred optional type" {115test "if peer expressions inferred optional type" {
test/behavior/int128.zig+4-4
...@@ -95,16 +95,16 @@ test "shift int128" {...@@ -95,16 +95,16 @@ test "shift int128" {
95 const types = .{ u128, i128 };95 const types = .{ u128, i128 };
96 inline for (types) |t| {96 inline for (types) |t| {
97 try testShlTrunc(t, 0x8, 123);97 try testShlTrunc(t, 0x8, 123);
98 comptime try testShlTrunc(t, 0x8, 123);98 try comptime testShlTrunc(t, 0x8, 123);
9999
100 try testShlTrunc(t, 0x40000000_00000000, 64);100 try testShlTrunc(t, 0x40000000_00000000, 64);
101 comptime try testShlTrunc(t, 0x40000000_00000000, 64);101 try comptime testShlTrunc(t, 0x40000000_00000000, 64);
102102
103 try testShlTrunc(t, 0x01000000_00000000_00000000, 38);103 try testShlTrunc(t, 0x01000000_00000000_00000000, 38);
104 comptime try testShlTrunc(t, 0x01000000_00000000_00000000, 38);104 try comptime testShlTrunc(t, 0x01000000_00000000_00000000, 38);
105105
106 try testShlTrunc(t, 0x00000008_00000000_00000000_00000000, 27);106 try testShlTrunc(t, 0x00000008_00000000_00000000_00000000, 27);
107 comptime try testShlTrunc(t, 0x00000008_00000000_00000000_00000000, 27);107 try comptime testShlTrunc(t, 0x00000008_00000000_00000000_00000000, 27);
108 }108 }
109}109}
110110
test/behavior/int_div.zig+1-1
...@@ -9,7 +9,7 @@ test "integer division" {...@@ -9,7 +9,7 @@ test "integer division" {
9 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO9 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1010
11 try testDivision();11 try testDivision();
12 comptime try testDivision();12 try comptime testDivision();
13}13}
14fn testDivision() !void {14fn testDivision() !void {
15 try expect(div(u32, 13, 3) == 4);15 try expect(div(u32, 13, 3) == 4);
test/behavior/math.zig+53-53
...@@ -40,7 +40,7 @@ test "assignment operators" {...@@ -40,7 +40,7 @@ test "assignment operators" {
4040
41test "three expr in a row" {41test "three expr in a row" {
42 try testThreeExprInARow(false, true);42 try testThreeExprInARow(false, true);
43 comptime try testThreeExprInARow(false, true);43 try comptime testThreeExprInARow(false, true);
44}44}
45fn testThreeExprInARow(f: bool, t: bool) !void {45fn testThreeExprInARow(f: bool, t: bool) !void {
46 try assertFalse(f or f or f);46 try assertFalse(f or f or f);
...@@ -67,7 +67,7 @@ test "@clz" {...@@ -67,7 +67,7 @@ test "@clz" {
67 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;67 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
6868
69 try testClz();69 try testClz();
70 comptime try testClz();70 try comptime testClz();
71}71}
7272
73fn testClz() !void {73fn testClz() !void {
...@@ -86,7 +86,7 @@ test "@clz big ints" {...@@ -86,7 +86,7 @@ test "@clz big ints" {
86 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;86 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
8787
88 try testClzBigInts();88 try testClzBigInts();
89 comptime try testClzBigInts();89 try comptime testClzBigInts();
90}90}
9191
92fn testClzBigInts() !void {92fn testClzBigInts() !void {
...@@ -107,7 +107,7 @@ test "@clz vectors" {...@@ -107,7 +107,7 @@ test "@clz vectors" {
107 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;107 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
108108
109 try testClzVectors();109 try testClzVectors();
110 comptime try testClzVectors();110 try comptime testClzVectors();
111}111}
112112
113fn testClzVectors() !void {113fn testClzVectors() !void {
...@@ -147,7 +147,7 @@ test "@ctz" {...@@ -147,7 +147,7 @@ test "@ctz" {
147 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;147 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
148148
149 try testCtz();149 try testCtz();
150 comptime try testCtz();150 try comptime testCtz();
151}151}
152152
153fn testCtz() !void {153fn testCtz() !void {
...@@ -176,7 +176,7 @@ test "@ctz vectors" {...@@ -176,7 +176,7 @@ test "@ctz vectors" {
176 }176 }
177177
178 try testCtzVectors();178 try testCtzVectors();
179 comptime try testCtzVectors();179 try comptime testCtzVectors();
180}180}
181181
182fn testCtzVectors() !void {182fn testCtzVectors() !void {
...@@ -213,7 +213,7 @@ test "float equality" {...@@ -213,7 +213,7 @@ test "float equality" {
213 const y: f64 = x + 1.0;213 const y: f64 = x + 1.0;
214214
215 try testFloatEqualityImpl(x, y);215 try testFloatEqualityImpl(x, y);
216 comptime try testFloatEqualityImpl(x, y);216 try comptime testFloatEqualityImpl(x, y);
217}217}
218218
219fn testFloatEqualityImpl(x: f64, y: f64) !void {219fn testFloatEqualityImpl(x: f64, y: f64) !void {
...@@ -222,7 +222,7 @@ fn testFloatEqualityImpl(x: f64, y: f64) !void {...@@ -222,7 +222,7 @@ fn testFloatEqualityImpl(x: f64, y: f64) !void {
222}222}
223223
224test "hex float literal parsing" {224test "hex float literal parsing" {
225 comptime try expect(0x1.0 == 1.0);225 try comptime expect(0x1.0 == 1.0);
226}226}
227227
228test "hex float literal within range" {228test "hex float literal within range" {
...@@ -323,7 +323,7 @@ test "comptime_int multi-limb partial shift right" {...@@ -323,7 +323,7 @@ test "comptime_int multi-limb partial shift right" {
323323
324test "xor" {324test "xor" {
325 try test_xor();325 try test_xor();
326 comptime try test_xor();326 try comptime test_xor();
327}327}
328328
329fn test_xor() !void {329fn test_xor() !void {
...@@ -412,7 +412,7 @@ test "division" {...@@ -412,7 +412,7 @@ test "division" {
412 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;412 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
413413
414 try testDivision();414 try testDivision();
415 comptime try testDivision();415 try comptime testDivision();
416}416}
417417
418fn testDivision() !void {418fn testDivision() !void {
...@@ -492,7 +492,7 @@ test "division half-precision floats" {...@@ -492,7 +492,7 @@ test "division half-precision floats" {
492 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;492 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
493493
494 try testDivisionFP16();494 try testDivisionFP16();
495 comptime try testDivisionFP16();495 try comptime testDivisionFP16();
496}496}
497497
498fn testDivisionFP16() !void {498fn testDivisionFP16() !void {
...@@ -527,7 +527,7 @@ fn mod(comptime T: type, a: T, b: T) T {...@@ -527,7 +527,7 @@ fn mod(comptime T: type, a: T, b: T) T {
527527
528test "unsigned wrapping" {528test "unsigned wrapping" {
529 try testUnsignedWrappingEval(maxInt(u32));529 try testUnsignedWrappingEval(maxInt(u32));
530 comptime try testUnsignedWrappingEval(maxInt(u32));530 try comptime testUnsignedWrappingEval(maxInt(u32));
531}531}
532fn testUnsignedWrappingEval(x: u32) !void {532fn testUnsignedWrappingEval(x: u32) !void {
533 const zero = x +% 1;533 const zero = x +% 1;
...@@ -538,7 +538,7 @@ fn testUnsignedWrappingEval(x: u32) !void {...@@ -538,7 +538,7 @@ fn testUnsignedWrappingEval(x: u32) !void {
538538
539test "signed wrapping" {539test "signed wrapping" {
540 try testSignedWrappingEval(maxInt(i32));540 try testSignedWrappingEval(maxInt(i32));
541 comptime try testSignedWrappingEval(maxInt(i32));541 try comptime testSignedWrappingEval(maxInt(i32));
542}542}
543fn testSignedWrappingEval(x: i32) !void {543fn testSignedWrappingEval(x: i32) !void {
544 const min_val = x +% 1;544 const min_val = x +% 1;
...@@ -549,7 +549,7 @@ fn testSignedWrappingEval(x: i32) !void {...@@ -549,7 +549,7 @@ fn testSignedWrappingEval(x: i32) !void {
549549
550test "signed negation wrapping" {550test "signed negation wrapping" {
551 try testSignedNegationWrappingEval(minInt(i16));551 try testSignedNegationWrappingEval(minInt(i16));
552 comptime try testSignedNegationWrappingEval(minInt(i16));552 try comptime testSignedNegationWrappingEval(minInt(i16));
553}553}
554fn testSignedNegationWrappingEval(x: i16) !void {554fn testSignedNegationWrappingEval(x: i16) !void {
555 try expect(x == -32768);555 try expect(x == -32768);
...@@ -559,7 +559,7 @@ fn testSignedNegationWrappingEval(x: i16) !void {...@@ -559,7 +559,7 @@ fn testSignedNegationWrappingEval(x: i16) !void {
559559
560test "unsigned negation wrapping" {560test "unsigned negation wrapping" {
561 try testUnsignedNegationWrappingEval(1);561 try testUnsignedNegationWrappingEval(1);
562 comptime try testUnsignedNegationWrappingEval(1);562 try comptime testUnsignedNegationWrappingEval(1);
563}563}
564fn testUnsignedNegationWrappingEval(x: u16) !void {564fn testUnsignedNegationWrappingEval(x: u16) !void {
565 try expect(x == 1);565 try expect(x == 1);
...@@ -586,7 +586,7 @@ test "unsigned 64-bit division" {...@@ -586,7 +586,7 @@ test "unsigned 64-bit division" {
586 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO586 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
587587
588 try test_u64_div();588 try test_u64_div();
589 comptime try test_u64_div();589 try comptime test_u64_div();
590}590}
591fn test_u64_div() !void {591fn test_u64_div() !void {
592 const result = divWithResult(1152921504606846976, 34359738365);592 const result = divWithResult(1152921504606846976, 34359738365);
...@@ -614,7 +614,7 @@ test "truncating shift right" {...@@ -614,7 +614,7 @@ test "truncating shift right" {
614 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;614 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
615615
616 try testShrTrunc(maxInt(u16));616 try testShrTrunc(maxInt(u16));
617 comptime try testShrTrunc(maxInt(u16));617 try comptime testShrTrunc(maxInt(u16));
618}618}
619fn testShrTrunc(x: u16) !void {619fn testShrTrunc(x: u16) !void {
620 const shifted = x >> 1;620 const shifted = x >> 1;
...@@ -630,7 +630,7 @@ test "f128" {...@@ -630,7 +630,7 @@ test "f128" {
630 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;630 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
631631
632 try test_f128();632 try test_f128();
633 comptime try test_f128();633 try comptime test_f128();
634}634}
635635
636fn make_f128(x: f128) f128 {636fn make_f128(x: f128) f128 {
...@@ -1238,12 +1238,12 @@ test "quad hex float literal parsing accurate" {...@@ -1238,12 +1238,12 @@ test "quad hex float literal parsing accurate" {
1238 }1238 }
1239 };1239 };
1240 try S.doTheTest();1240 try S.doTheTest();
1241 comptime try S.doTheTest();1241 try comptime S.doTheTest();
1242}1242}
12431243
1244test "truncating shift left" {1244test "truncating shift left" {
1245 try testShlTrunc(maxInt(u16));1245 try testShlTrunc(maxInt(u16));
1246 comptime try testShlTrunc(maxInt(u16));1246 try comptime testShlTrunc(maxInt(u16));
1247}1247}
1248fn testShlTrunc(x: u16) !void {1248fn testShlTrunc(x: u16) !void {
1249 const shifted = x << 1;1249 const shifted = x << 1;
...@@ -1254,7 +1254,7 @@ test "exact shift left" {...@@ -1254,7 +1254,7 @@ test "exact shift left" {
1254 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1254 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
12551255
1256 try testShlExact(0b00110101);1256 try testShlExact(0b00110101);
1257 comptime try testShlExact(0b00110101);1257 try comptime testShlExact(0b00110101);
1258}1258}
1259fn testShlExact(x: u8) !void {1259fn testShlExact(x: u8) !void {
1260 const shifted = @shlExact(x, 2);1260 const shifted = @shlExact(x, 2);
...@@ -1265,7 +1265,7 @@ test "exact shift right" {...@@ -1265,7 +1265,7 @@ test "exact shift right" {
1265 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1265 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
12661266
1267 try testShrExact(0b10110100);1267 try testShrExact(0b10110100);
1268 comptime try testShrExact(0b10110100);1268 try comptime testShrExact(0b10110100);
1269}1269}
1270fn testShrExact(x: u8) !void {1270fn testShrExact(x: u8) !void {
1271 const shifted = @shrExact(x, 2);1271 const shifted = @shrExact(x, 2);
...@@ -1288,7 +1288,7 @@ test "shift left/right on u0 operand" {...@@ -1288,7 +1288,7 @@ test "shift left/right on u0 operand" {
1288 }1288 }
1289 };1289 };
1290 try S.doTheTest();1290 try S.doTheTest();
1291 comptime try S.doTheTest();1291 try comptime S.doTheTest();
1292}1292}
12931293
1294test "comptime float rem int" {1294test "comptime float rem int" {
...@@ -1311,11 +1311,11 @@ test "remainder division" {...@@ -1311,11 +1311,11 @@ test "remainder division" {
1311 return error.SkipZigTest;1311 return error.SkipZigTest;
1312 }1312 }
13131313
1314 comptime try remdiv(f16);1314 try comptime remdiv(f16);
1315 comptime try remdiv(f32);1315 try comptime remdiv(f32);
1316 comptime try remdiv(f64);1316 try comptime remdiv(f64);
1317 comptime try remdiv(f80);1317 try comptime remdiv(f80);
1318 comptime try remdiv(f128);1318 try comptime remdiv(f128);
1319 try remdiv(f16);1319 try remdiv(f16);
1320 try remdiv(f64);1320 try remdiv(f64);
1321 try remdiv(f80);1321 try remdiv(f80);
...@@ -1343,11 +1343,11 @@ test "float remainder division using @rem" {...@@ -1343,11 +1343,11 @@ test "float remainder division using @rem" {
1343 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1343 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1344 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO1344 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
13451345
1346 comptime try frem(f16);1346 try comptime frem(f16);
1347 comptime try frem(f32);1347 try comptime frem(f32);
1348 comptime try frem(f64);1348 try comptime frem(f64);
1349 comptime try frem(f80);1349 try comptime frem(f80);
1350 comptime try frem(f128);1350 try comptime frem(f128);
1351 try frem(f16);1351 try frem(f16);
1352 try frem(f32);1352 try frem(f32);
1353 try frem(f64);1353 try frem(f64);
...@@ -1386,11 +1386,11 @@ test "float modulo division using @mod" {...@@ -1386,11 +1386,11 @@ test "float modulo division using @mod" {
1386 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1386 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1387 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1387 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
13881388
1389 comptime try fmod(f16);1389 try comptime fmod(f16);
1390 comptime try fmod(f32);1390 try comptime fmod(f32);
1391 comptime try fmod(f64);1391 try comptime fmod(f64);
1392 comptime try fmod(f80);1392 try comptime fmod(f80);
1393 comptime try fmod(f128);1393 try comptime fmod(f128);
1394 try fmod(f16);1394 try fmod(f16);
1395 try fmod(f32);1395 try fmod(f32);
1396 try fmod(f64);1396 try fmod(f64);
...@@ -1430,16 +1430,16 @@ test "@round" {...@@ -1430,16 +1430,16 @@ test "@round" {
1430 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1430 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
14311431
1432 try testRound(f64, 12.0);1432 try testRound(f64, 12.0);
1433 comptime try testRound(f64, 12.0);1433 try comptime testRound(f64, 12.0);
1434 try testRound(f32, 12.0);1434 try testRound(f32, 12.0);
1435 comptime try testRound(f32, 12.0);1435 try comptime testRound(f32, 12.0);
1436 try testRound(f16, 12.0);1436 try testRound(f16, 12.0);
1437 comptime try testRound(f16, 12.0);1437 try comptime testRound(f16, 12.0);
14381438
1439 const x = 14.0;1439 const x = 14.0;
1440 const y = x + 0.4;1440 const y = x + 0.4;
1441 const z = @round(y);1441 const z = @round(y);
1442 comptime try expect(x == z);1442 try comptime expect(x == z);
1443}1443}
14441444
1445test "@round f80" {1445test "@round f80" {
...@@ -1451,7 +1451,7 @@ test "@round f80" {...@@ -1451,7 +1451,7 @@ test "@round f80" {
1451 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1451 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
14521452
1453 try testRound(f80, 12.0);1453 try testRound(f80, 12.0);
1454 comptime try testRound(f80, 12.0);1454 try comptime testRound(f80, 12.0);
1455}1455}
14561456
1457test "@round f128" {1457test "@round f128" {
...@@ -1463,7 +1463,7 @@ test "@round f128" {...@@ -1463,7 +1463,7 @@ test "@round f128" {
1463 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1463 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
14641464
1465 try testRound(f128, 12.0);1465 try testRound(f128, 12.0);
1466 comptime try testRound(f128, 12.0);1466 try comptime testRound(f128, 12.0);
1467}1467}
14681468
1469fn testRound(comptime T: type, x: T) !void {1469fn testRound(comptime T: type, x: T) !void {
...@@ -1491,7 +1491,7 @@ test "vector integer addition" {...@@ -1491,7 +1491,7 @@ test "vector integer addition" {
1491 }1491 }
1492 };1492 };
1493 try S.doTheTest();1493 try S.doTheTest();
1494 comptime try S.doTheTest();1494 try comptime S.doTheTest();
1495}1495}
14961496
1497test "NaN comparison" {1497test "NaN comparison" {
...@@ -1506,10 +1506,10 @@ test "NaN comparison" {...@@ -1506,10 +1506,10 @@ test "NaN comparison" {
1506 try testNanEqNan(f32);1506 try testNanEqNan(f32);
1507 try testNanEqNan(f64);1507 try testNanEqNan(f64);
1508 try testNanEqNan(f128);1508 try testNanEqNan(f128);
1509 comptime try testNanEqNan(f16);1509 try comptime testNanEqNan(f16);
1510 comptime try testNanEqNan(f32);1510 try comptime testNanEqNan(f32);
1511 comptime try testNanEqNan(f64);1511 try comptime testNanEqNan(f64);
1512 comptime try testNanEqNan(f128);1512 try comptime testNanEqNan(f128);
1513}1513}
15141514
1515test "NaN comparison f80" {1515test "NaN comparison f80" {
...@@ -1521,7 +1521,7 @@ test "NaN comparison f80" {...@@ -1521,7 +1521,7 @@ test "NaN comparison f80" {
1521 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1521 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
15221522
1523 try testNanEqNan(f80);1523 try testNanEqNan(f80);
1524 comptime try testNanEqNan(f80);1524 try comptime testNanEqNan(f80);
1525}1525}
15261526
1527fn testNanEqNan(comptime F: type) !void {1527fn testNanEqNan(comptime F: type) !void {
...@@ -1556,7 +1556,7 @@ test "vector comparison" {...@@ -1556,7 +1556,7 @@ test "vector comparison" {
1556 }1556 }
1557 };1557 };
1558 try S.doTheTest();1558 try S.doTheTest();
1559 comptime try S.doTheTest();1559 try comptime S.doTheTest();
1560}1560}
15611561
1562test "compare undefined literal with comptime_int" {1562test "compare undefined literal with comptime_int" {
...@@ -1593,7 +1593,7 @@ test "signed zeros are represented properly" {...@@ -1593,7 +1593,7 @@ test "signed zeros are represented properly" {
1593 };1593 };
15941594
1595 try S.doTheTest();1595 try S.doTheTest();
1596 comptime try S.doTheTest();1596 try comptime S.doTheTest();
1597}1597}
15981598
1599test "comptime sin and ln" {1599test "comptime sin and ln" {
...@@ -1609,7 +1609,7 @@ test "absFloat" {...@@ -1609,7 +1609,7 @@ test "absFloat" {
1609 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1609 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
16101610
1611 try testAbsFloat();1611 try testAbsFloat();
1612 comptime try testAbsFloat();1612 try comptime testAbsFloat();
1613}1613}
1614fn testAbsFloat() !void {1614fn testAbsFloat() !void {
1615 try testAbsFloatOne(-10.05, 10.05);1615 try testAbsFloatOne(-10.05, 10.05);
test/behavior/maximum_minimum.zig+6-6
...@@ -19,7 +19,7 @@ test "@max" {...@@ -19,7 +19,7 @@ test "@max" {
19 }19 }
20 };20 };
21 try S.doTheTest();21 try S.doTheTest();
22 comptime try S.doTheTest();22 try comptime S.doTheTest();
23}23}
2424
25test "@max on vectors" {25test "@max on vectors" {
...@@ -50,7 +50,7 @@ test "@max on vectors" {...@@ -50,7 +50,7 @@ test "@max on vectors" {
50 }50 }
51 };51 };
52 try S.doTheTest();52 try S.doTheTest();
53 comptime try S.doTheTest();53 try comptime S.doTheTest();
54}54}
5555
56test "@min" {56test "@min" {
...@@ -68,7 +68,7 @@ test "@min" {...@@ -68,7 +68,7 @@ test "@min" {
68 }68 }
69 };69 };
70 try S.doTheTest();70 try S.doTheTest();
71 comptime try S.doTheTest();71 try comptime S.doTheTest();
72}72}
7373
74test "@min for vectors" {74test "@min for vectors" {
...@@ -99,7 +99,7 @@ test "@min for vectors" {...@@ -99,7 +99,7 @@ test "@min for vectors" {
99 }99 }
100 };100 };
101 try S.doTheTest();101 try S.doTheTest();
102 comptime try S.doTheTest();102 try comptime S.doTheTest();
103}103}
104104
105test "@min/max for floats" {105test "@min/max for floats" {
...@@ -123,9 +123,9 @@ test "@min/max for floats" {...@@ -123,9 +123,9 @@ test "@min/max for floats" {
123123
124 inline for (.{ f16, f32, f64, f80, f128, c_longdouble }) |T| {124 inline for (.{ f16, f32, f64, f80, f128, c_longdouble }) |T| {
125 try S.doTheTest(T);125 try S.doTheTest(T);
126 comptime try S.doTheTest(T);126 try comptime S.doTheTest(T);
127 }127 }
128 comptime try S.doTheTest(comptime_float);128 try comptime S.doTheTest(comptime_float);
129}129}
130130
131test "@min/@max on lazy values" {131test "@min/@max on lazy values" {
test/behavior/muladd.zig+9-9
...@@ -12,7 +12,7 @@ test "@mulAdd" {...@@ -12,7 +12,7 @@ test "@mulAdd" {
12 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO12 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
13 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;13 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1414
15 comptime try testMulAdd();15 try comptime testMulAdd();
16 try testMulAdd();16 try testMulAdd();
17}17}
1818
...@@ -38,7 +38,7 @@ test "@mulAdd f16" {...@@ -38,7 +38,7 @@ test "@mulAdd f16" {
38 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO38 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
39 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;39 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
4040
41 comptime try testMulAdd16();41 try comptime testMulAdd16();
42 try testMulAdd16();42 try testMulAdd16();
43}43}
4444
...@@ -57,7 +57,7 @@ test "@mulAdd f80" {...@@ -57,7 +57,7 @@ test "@mulAdd f80" {
57 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO57 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
58 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;58 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
5959
60 comptime try testMulAdd80();60 try comptime testMulAdd80();
61 try testMulAdd80();61 try testMulAdd80();
62}62}
6363
...@@ -76,7 +76,7 @@ test "@mulAdd f128" {...@@ -76,7 +76,7 @@ test "@mulAdd f128" {
76 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO76 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
77 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;77 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
7878
79 comptime try testMulAdd128();79 try comptime testMulAdd128();
80 try testMulAdd128();80 try testMulAdd128();
81}81}
8282
...@@ -107,7 +107,7 @@ test "vector f16" {...@@ -107,7 +107,7 @@ test "vector f16" {
107 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO107 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
108 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;108 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
109109
110 comptime try vector16();110 try comptime vector16();
111 try vector16();111 try vector16();
112}112}
113113
...@@ -131,7 +131,7 @@ test "vector f32" {...@@ -131,7 +131,7 @@ test "vector f32" {
131 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO131 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
132 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;132 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
133133
134 comptime try vector32();134 try comptime vector32();
135 try vector32();135 try vector32();
136}136}
137137
...@@ -155,7 +155,7 @@ test "vector f64" {...@@ -155,7 +155,7 @@ test "vector f64" {
155 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO155 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
156 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;156 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
157157
158 comptime try vector64();158 try comptime vector64();
159 try vector64();159 try vector64();
160}160}
161161
...@@ -178,7 +178,7 @@ test "vector f80" {...@@ -178,7 +178,7 @@ test "vector f80" {
178 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO178 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
179 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;179 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
180180
181 comptime try vector80();181 try comptime vector80();
182 try vector80();182 try vector80();
183}183}
184184
...@@ -202,6 +202,6 @@ test "vector f128" {...@@ -202,6 +202,6 @@ test "vector f128" {
202 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO202 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
203 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;203 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
204204
205 comptime try vector128();205 try comptime vector128();
206 try vector128();206 try vector128();
207}207}
test/behavior/null.zig+3-3
...@@ -56,7 +56,7 @@ test "maybe return" {...@@ -56,7 +56,7 @@ test "maybe return" {
56 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;56 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
5757
58 try maybeReturnImpl();58 try maybeReturnImpl();
59 comptime try maybeReturnImpl();59 try comptime maybeReturnImpl();
60}60}
6161
62fn maybeReturnImpl() !void {62fn maybeReturnImpl() !void {
...@@ -87,7 +87,7 @@ test "optional void" {...@@ -87,7 +87,7 @@ test "optional void" {
87 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;87 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
8888
89 try optionalVoidImpl();89 try optionalVoidImpl();
90 comptime try optionalVoidImpl();90 try comptime optionalVoidImpl();
91}91}
9292
93fn optionalVoidImpl() !void {93fn optionalVoidImpl() !void {
...@@ -111,7 +111,7 @@ test "optional struct{}" {...@@ -111,7 +111,7 @@ test "optional struct{}" {
111 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;111 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
112112
113 _ = try optionalEmptyStructImpl();113 _ = try optionalEmptyStructImpl();
114 _ = comptime try optionalEmptyStructImpl();114 _ = try comptime optionalEmptyStructImpl();
115}115}
116116
117fn optionalEmptyStructImpl() !void {117fn optionalEmptyStructImpl() !void {
test/behavior/optional.zig+8-8
...@@ -20,7 +20,7 @@ test "passing an optional integer as a parameter" {...@@ -20,7 +20,7 @@ test "passing an optional integer as a parameter" {
20 }20 }
21 };21 };
22 try expect(S.entry());22 try expect(S.entry());
23 comptime try expect(S.entry());23 try comptime expect(S.entry());
24}24}
2525
26pub const EmptyStruct = struct {};26pub const EmptyStruct = struct {};
...@@ -38,7 +38,7 @@ test "equality compare optional pointers" {...@@ -38,7 +38,7 @@ test "equality compare optional pointers" {
38 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;38 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
3939
40 try testNullPtrsEql();40 try testNullPtrsEql();
41 comptime try testNullPtrsEql();41 try comptime testNullPtrsEql();
42}42}
4343
44fn testNullPtrsEql() !void {44fn testNullPtrsEql() !void {
...@@ -117,7 +117,7 @@ test "equality compare optional with non-optional" {...@@ -117,7 +117,7 @@ test "equality compare optional with non-optional" {
117 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;117 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
118118
119 try test_cmp_optional_non_optional();119 try test_cmp_optional_non_optional();
120 comptime try test_cmp_optional_non_optional();120 try comptime test_cmp_optional_non_optional();
121}121}
122122
123fn test_cmp_optional_non_optional() !void {123fn test_cmp_optional_non_optional() !void {
...@@ -168,7 +168,7 @@ test "unwrap function call with optional pointer return value" {...@@ -168,7 +168,7 @@ test "unwrap function call with optional pointer return value" {
168 }168 }
169 };169 };
170 try S.entry();170 try S.entry();
171 comptime try S.entry();171 try comptime S.entry();
172}172}
173173
174test "nested orelse" {174test "nested orelse" {
...@@ -195,7 +195,7 @@ test "nested orelse" {...@@ -195,7 +195,7 @@ test "nested orelse" {
195 };195 };
196 };196 };
197 try S.entry();197 try S.entry();
198 comptime try S.entry();198 try comptime S.entry();
199}199}
200200
201test "self-referential struct through a slice of optional" {201test "self-referential struct through a slice of optional" {
...@@ -250,7 +250,7 @@ test "coerce an anon struct literal to optional struct" {...@@ -250,7 +250,7 @@ test "coerce an anon struct literal to optional struct" {
250 }250 }
251 };251 };
252 try S.doTheTest();252 try S.doTheTest();
253 comptime try S.doTheTest();253 try comptime S.doTheTest();
254}254}
255255
256test "0-bit child type coerced to optional return ptr result location" {256test "0-bit child type coerced to optional return ptr result location" {
...@@ -277,7 +277,7 @@ test "0-bit child type coerced to optional return ptr result location" {...@@ -277,7 +277,7 @@ test "0-bit child type coerced to optional return ptr result location" {
277 };277 };
278 };278 };
279 try S.doTheTest();279 try S.doTheTest();
280 comptime try S.doTheTest();280 try comptime S.doTheTest();
281}281}
282282
283test "0-bit child type coerced to optional" {283test "0-bit child type coerced to optional" {
...@@ -303,7 +303,7 @@ test "0-bit child type coerced to optional" {...@@ -303,7 +303,7 @@ test "0-bit child type coerced to optional" {
303 };303 };
304 };304 };
305 try S.doTheTest();305 try S.doTheTest();
306 comptime try S.doTheTest();306 try comptime S.doTheTest();
307}307}
308308
309test "array of optional unaligned types" {309test "array of optional unaligned types" {
test/behavior/packed-struct.zig+1-1
...@@ -351,7 +351,7 @@ test "byte-aligned field pointer offsets" {...@@ -351,7 +351,7 @@ test "byte-aligned field pointer offsets" {
351 };351 };
352352
353 try S.doTheTest();353 try S.doTheTest();
354 comptime try S.doTheTest();354 try comptime S.doTheTest();
355}355}
356356
357test "load pointer from packed struct" {357test "load pointer from packed struct" {
test/behavior/pointers.zig+35-35
...@@ -5,7 +5,7 @@ const expect = testing.expect;...@@ -5,7 +5,7 @@ const expect = testing.expect;
5const expectError = testing.expectError;5const expectError = testing.expectError;
66
7test "dereference pointer" {7test "dereference pointer" {
8 comptime try testDerefPtr();8 try comptime testDerefPtr();
9 try testDerefPtr();9 try testDerefPtr();
10}10}
1111
...@@ -42,7 +42,7 @@ test "pointer arithmetic" {...@@ -42,7 +42,7 @@ test "pointer arithmetic" {
42}42}
4343
44test "double pointer parsing" {44test "double pointer parsing" {
45 comptime try expect(PtrOf(PtrOf(i32)) == **i32);45 try comptime expect(PtrOf(PtrOf(i32)) == **i32);
46}46}
4747
48fn PtrOf(comptime T: type) type {48fn PtrOf(comptime T: type) type {
...@@ -62,7 +62,7 @@ test "implicit cast single item pointer to C pointer and back" {...@@ -62,7 +62,7 @@ test "implicit cast single item pointer to C pointer and back" {
62test "initialize const optional C pointer to null" {62test "initialize const optional C pointer to null" {
63 const a: ?[*c]i32 = null;63 const a: ?[*c]i32 = null;
64 try expect(a == null);64 try expect(a == null);
65 comptime try expect(a == null);65 try comptime expect(a == null);
66}66}
6767
68test "assigning integer to C pointer" {68test "assigning integer to C pointer" {
...@@ -105,12 +105,12 @@ test "C pointer comparison and arithmetic" {...@@ -105,12 +105,12 @@ test "C pointer comparison and arithmetic" {
105 }105 }
106 };106 };
107 try S.doTheTest();107 try S.doTheTest();
108 comptime try S.doTheTest();108 try comptime S.doTheTest();
109}109}
110110
111test "dereference pointer again" {111test "dereference pointer again" {
112 try testDerefPtrOneVal();112 try testDerefPtrOneVal();
113 comptime try testDerefPtrOneVal();113 try comptime testDerefPtrOneVal();
114}114}
115115
116const Foo1 = struct {116const Foo1 = struct {
...@@ -180,7 +180,7 @@ test "implicit cast error unions with non-optional to optional pointer" {...@@ -180,7 +180,7 @@ test "implicit cast error unions with non-optional to optional pointer" {
180 }180 }
181 };181 };
182 try S.doTheTest();182 try S.doTheTest();
183 comptime try S.doTheTest();183 try comptime S.doTheTest();
184}184}
185185
186test "compare equality of optional and non-optional pointer" {186test "compare equality of optional and non-optional pointer" {
...@@ -203,11 +203,11 @@ test "allowzero pointer and slice" {...@@ -203,11 +203,11 @@ test "allowzero pointer and slice" {
203 try expect(@ptrToInt(ptr) == 0);203 try expect(@ptrToInt(ptr) == 0);
204 var runtime_zero: usize = 0;204 var runtime_zero: usize = 0;
205 var slice = ptr[runtime_zero..10];205 var slice = ptr[runtime_zero..10];
206 comptime try expect(@TypeOf(slice) == []allowzero i32);206 try comptime expect(@TypeOf(slice) == []allowzero i32);
207 try expect(@ptrToInt(&slice[5]) == 20);207 try expect(@ptrToInt(&slice[5]) == 20);
208208
209 comptime try expect(@typeInfo(@TypeOf(ptr)).Pointer.is_allowzero);209 try comptime expect(@typeInfo(@TypeOf(ptr)).Pointer.is_allowzero);
210 comptime try expect(@typeInfo(@TypeOf(slice)).Pointer.is_allowzero);210 try comptime expect(@typeInfo(@TypeOf(slice)).Pointer.is_allowzero);
211}211}
212212
213test "assign null directly to C pointer and test null equality" {213test "assign null directly to C pointer and test null equality" {
...@@ -229,17 +229,17 @@ test "assign null directly to C pointer and test null equality" {...@@ -229,17 +229,17 @@ test "assign null directly to C pointer and test null equality" {
229 try expect((x orelse &otherx) == &otherx);229 try expect((x orelse &otherx) == &otherx);
230230
231 const y: [*c]i32 = null;231 const y: [*c]i32 = null;
232 comptime try expect(y == null);232 try comptime expect(y == null);
233 comptime try expect(null == y);233 try comptime expect(null == y);
234 comptime try expect(!(y != null));234 try comptime expect(!(y != null));
235 comptime try expect(!(null != y));235 try comptime expect(!(null != y));
236 if (y) |same_y| {236 if (y) |same_y| {
237 _ = same_y;237 _ = same_y;
238 @panic("fail");238 @panic("fail");
239 }239 }
240 const othery: i32 = undefined;240 const othery: i32 = undefined;
241 const ptr_othery = &othery;241 const ptr_othery = &othery;
242 comptime try expect((y orelse ptr_othery) == ptr_othery);242 try comptime expect((y orelse ptr_othery) == ptr_othery);
243243
244 var n: i32 = 1234;244 var n: i32 = 1234;
245 var x1: [*c]i32 = &n;245 var x1: [*c]i32 = &n;
...@@ -257,17 +257,17 @@ test "assign null directly to C pointer and test null equality" {...@@ -257,17 +257,17 @@ test "assign null directly to C pointer and test null equality" {
257257
258 const nc: i32 = 1234;258 const nc: i32 = 1234;
259 const y1: [*c]const i32 = &nc;259 const y1: [*c]const i32 = &nc;
260 comptime try expect(!(y1 == null));260 try comptime expect(!(y1 == null));
261 comptime try expect(!(null == y1));261 try comptime expect(!(null == y1));
262 comptime try expect(y1 != null);262 try comptime expect(y1 != null);
263 comptime try expect(null != y1);263 try comptime expect(null != y1);
264 comptime try expect(y1.?.* == 1234);264 try comptime expect(y1.?.* == 1234);
265 if (y1) |same_y1| {265 if (y1) |same_y1| {
266 try expect(same_y1.* == 1234);266 try expect(same_y1.* == 1234);
267 } else {267 } else {
268 @compileError("fail");268 @compileError("fail");
269 }269 }
270 comptime try expect((y1 orelse &othery) == y1);270 try comptime expect((y1 orelse &othery) == y1);
271}271}
272272
273test "array initialization types" {273test "array initialization types" {
...@@ -293,7 +293,7 @@ test "null terminated pointer" {...@@ -293,7 +293,7 @@ test "null terminated pointer" {
293 }293 }
294 };294 };
295 try S.doTheTest();295 try S.doTheTest();
296 comptime try S.doTheTest();296 try comptime S.doTheTest();
297}297}
298298
299test "allow any sentinel" {299test "allow any sentinel" {
...@@ -308,7 +308,7 @@ test "allow any sentinel" {...@@ -308,7 +308,7 @@ test "allow any sentinel" {
308 }308 }
309 };309 };
310 try S.doTheTest();310 try S.doTheTest();
311 comptime try S.doTheTest();311 try comptime S.doTheTest();
312}312}
313313
314test "pointer sentinel with enums" {314test "pointer sentinel with enums" {
...@@ -325,11 +325,11 @@ test "pointer sentinel with enums" {...@@ -325,11 +325,11 @@ test "pointer sentinel with enums" {
325325
326 fn doTheTest() !void {326 fn doTheTest() !void {
327 var ptr: [*:.sentinel]const Number = &[_:.sentinel]Number{ .one, .two, .two, .one };327 var ptr: [*:.sentinel]const Number = &[_:.sentinel]Number{ .one, .two, .two, .one };
328 try expect(ptr[4] == .sentinel); // TODO this should be comptime try expect, see #3731328 try expect(ptr[4] == .sentinel); // TODO this should be try comptime expect, see #3731
329 }329 }
330 };330 };
331 try S.doTheTest();331 try S.doTheTest();
332 comptime try S.doTheTest();332 try comptime S.doTheTest();
333}333}
334334
335test "pointer sentinel with optional element" {335test "pointer sentinel with optional element" {
...@@ -341,11 +341,11 @@ test "pointer sentinel with optional element" {...@@ -341,11 +341,11 @@ test "pointer sentinel with optional element" {
341 const S = struct {341 const S = struct {
342 fn doTheTest() !void {342 fn doTheTest() !void {
343 var ptr: [*:null]const ?i32 = &[_:null]?i32{ 1, 2, 3, 4 };343 var ptr: [*:null]const ?i32 = &[_:null]?i32{ 1, 2, 3, 4 };
344 try expect(ptr[4] == null); // TODO this should be comptime try expect, see #3731344 try expect(ptr[4] == null); // TODO this should be try comptime expect, see #3731
345 }345 }
346 };346 };
347 try S.doTheTest();347 try S.doTheTest();
348 comptime try S.doTheTest();348 try comptime S.doTheTest();
349}349}
350350
351test "pointer sentinel with +inf" {351test "pointer sentinel with +inf" {
...@@ -357,13 +357,13 @@ test "pointer sentinel with +inf" {...@@ -357,13 +357,13 @@ test "pointer sentinel with +inf" {
357357
358 const S = struct {358 const S = struct {
359 fn doTheTest() !void {359 fn doTheTest() !void {
360 const inf = std.math.inf_f32;360 const inf_f32 = comptime std.math.inf(f32);
361 var ptr: [*:inf]const f32 = &[_:inf]f32{ 1.1, 2.2, 3.3, 4.4 };361 var ptr: [*:inf_f32]const f32 = &[_:inf_f32]f32{ 1.1, 2.2, 3.3, 4.4 };
362 try expect(ptr[4] == inf); // TODO this should be comptime try expect, see #3731362 try expect(ptr[4] == inf_f32); // TODO this should be try comptime expect, see #3731
363 }363 }
364 };364 };
365 try S.doTheTest();365 try S.doTheTest();
366 comptime try S.doTheTest();366 try comptime S.doTheTest();
367}367}
368368
369test "pointer to array at fixed address" {369test "pointer to array at fixed address" {
...@@ -409,11 +409,11 @@ test "@ptrToInt on null optional at comptime" {...@@ -409,11 +409,11 @@ test "@ptrToInt on null optional at comptime" {
409 const pointer = @intToPtr(?*u8, 0x000);409 const pointer = @intToPtr(?*u8, 0x000);
410 const x = @ptrToInt(pointer);410 const x = @ptrToInt(pointer);
411 _ = x;411 _ = x;
412 comptime try expect(0 == @ptrToInt(pointer));412 try comptime expect(0 == @ptrToInt(pointer));
413 }413 }
414 {414 {
415 const pointer = @intToPtr(?*u8, 0xf00);415 const pointer = @intToPtr(?*u8, 0xf00);
416 comptime try expect(0xf00 == @ptrToInt(pointer));416 try comptime expect(0xf00 == @ptrToInt(pointer));
417 }417 }
418}418}
419419
...@@ -447,7 +447,7 @@ test "element pointer to slice" {...@@ -447,7 +447,7 @@ test "element pointer to slice" {
447 };447 };
448448
449 try S.doTheTest();449 try S.doTheTest();
450 comptime try S.doTheTest();450 try comptime S.doTheTest();
451}451}
452452
453test "element pointer arithmetic to slice" {453test "element pointer arithmetic to slice" {
...@@ -473,7 +473,7 @@ test "element pointer arithmetic to slice" {...@@ -473,7 +473,7 @@ test "element pointer arithmetic to slice" {
473 };473 };
474474
475 try S.doTheTest();475 try S.doTheTest();
476 comptime try S.doTheTest();476 try comptime S.doTheTest();
477}477}
478478
479test "array slicing to slice" {479test "array slicing to slice" {
...@@ -491,7 +491,7 @@ test "array slicing to slice" {...@@ -491,7 +491,7 @@ test "array slicing to slice" {
491 };491 };
492492
493 try S.doTheTest();493 try S.doTheTest();
494 comptime try S.doTheTest();494 try comptime S.doTheTest();
495}495}
496496
497test "pointer to constant decl preserves alignment" {497test "pointer to constant decl preserves alignment" {
test/behavior/popcount.zig+2-2
...@@ -9,7 +9,7 @@ test "@popCount integers" {...@@ -9,7 +9,7 @@ test "@popCount integers" {
9 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO9 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
10 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;10 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1111
12 comptime try testPopCountIntegers();12 try comptime testPopCountIntegers();
13 try testPopCountIntegers();13 try testPopCountIntegers();
14}14}
1515
...@@ -75,7 +75,7 @@ test "@popCount vectors" {...@@ -75,7 +75,7 @@ test "@popCount vectors" {
75 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO75 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
76 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;76 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
7777
78 comptime try testPopCountVectors();78 try comptime testPopCountVectors();
79 try testPopCountVectors();79 try testPopCountVectors();
80}80}
8181
test/behavior/ptrcast.zig+6-6
...@@ -7,7 +7,7 @@ test "reinterpret bytes as integer with nonzero offset" {...@@ -7,7 +7,7 @@ test "reinterpret bytes as integer with nonzero offset" {
7 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO7 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
88
9 try testReinterpretBytesAsInteger();9 try testReinterpretBytesAsInteger();
10 comptime try testReinterpretBytesAsInteger();10 try comptime testReinterpretBytesAsInteger();
11}11}
1212
13fn testReinterpretBytesAsInteger() !void {13fn testReinterpretBytesAsInteger() !void {
...@@ -26,7 +26,7 @@ test "reinterpret an array over multiple elements, with no well-defined layout"...@@ -26,7 +26,7 @@ test "reinterpret an array over multiple elements, with no well-defined layout"
26 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;26 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
2727
28 try testReinterpretWithOffsetAndNoWellDefinedLayout();28 try testReinterpretWithOffsetAndNoWellDefinedLayout();
29 comptime try testReinterpretWithOffsetAndNoWellDefinedLayout();29 try comptime testReinterpretWithOffsetAndNoWellDefinedLayout();
30}30}
3131
32fn testReinterpretWithOffsetAndNoWellDefinedLayout() !void {32fn testReinterpretWithOffsetAndNoWellDefinedLayout() !void {
...@@ -41,7 +41,7 @@ test "reinterpret bytes inside auto-layout struct as integer with nonzero offset...@@ -41,7 +41,7 @@ test "reinterpret bytes inside auto-layout struct as integer with nonzero offset
41 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO41 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
4242
43 try testReinterpretStructWrappedBytesAsInteger();43 try testReinterpretStructWrappedBytesAsInteger();
44 comptime try testReinterpretStructWrappedBytesAsInteger();44 try comptime testReinterpretStructWrappedBytesAsInteger();
45}45}
4646
47fn testReinterpretStructWrappedBytesAsInteger() !void {47fn testReinterpretStructWrappedBytesAsInteger() !void {
...@@ -59,7 +59,7 @@ test "reinterpret bytes of an array into an extern struct" {...@@ -59,7 +59,7 @@ test "reinterpret bytes of an array into an extern struct" {
59 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO59 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
6060
61 try testReinterpretBytesAsExternStruct();61 try testReinterpretBytesAsExternStruct();
62 comptime try testReinterpretBytesAsExternStruct();62 try comptime testReinterpretBytesAsExternStruct();
63}63}
6464
65fn testReinterpretBytesAsExternStruct() !void {65fn testReinterpretBytesAsExternStruct() !void {
...@@ -80,7 +80,7 @@ test "reinterpret bytes of an extern struct (with under-aligned fields) into ano...@@ -80,7 +80,7 @@ test "reinterpret bytes of an extern struct (with under-aligned fields) into ano
80 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO80 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
8181
82 try testReinterpretExternStructAsExternStruct();82 try testReinterpretExternStructAsExternStruct();
83 comptime try testReinterpretExternStructAsExternStruct();83 try comptime testReinterpretExternStructAsExternStruct();
84}84}
8585
86fn testReinterpretExternStructAsExternStruct() !void {86fn testReinterpretExternStructAsExternStruct() !void {
...@@ -104,7 +104,7 @@ test "reinterpret bytes of an extern struct into another" {...@@ -104,7 +104,7 @@ test "reinterpret bytes of an extern struct into another" {
104 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO104 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
105105
106 try testReinterpretOverAlignedExternStructAsExternStruct();106 try testReinterpretOverAlignedExternStructAsExternStruct();
107 comptime try testReinterpretOverAlignedExternStructAsExternStruct();107 try comptime testReinterpretOverAlignedExternStructAsExternStruct();
108}108}
109109
110fn testReinterpretOverAlignedExternStructAsExternStruct() !void {110fn testReinterpretOverAlignedExternStructAsExternStruct() !void {
test/behavior/saturating_arithmetic.zig+32-32
...@@ -38,16 +38,16 @@ test "saturating add" {...@@ -38,16 +38,16 @@ test "saturating add" {
38 };38 };
3939
40 try S.doTheTest();40 try S.doTheTest();
41 comptime try S.doTheTest();41 try comptime S.doTheTest();
4242
43 comptime try S.testSatAdd(comptime_int, 0, 0, 0);43 try comptime S.testSatAdd(comptime_int, 0, 0, 0);
44 comptime try S.testSatAdd(comptime_int, -1, 1, 0);44 try comptime S.testSatAdd(comptime_int, -1, 1, 0);
45 comptime try S.testSatAdd(comptime_int, 3, 2, 5);45 try comptime S.testSatAdd(comptime_int, 3, 2, 5);
46 comptime try S.testSatAdd(comptime_int, -3, -2, -5);46 try comptime S.testSatAdd(comptime_int, -3, -2, -5);
47 comptime try S.testSatAdd(comptime_int, 3, -2, 1);47 try comptime S.testSatAdd(comptime_int, 3, -2, 1);
48 comptime try S.testSatAdd(comptime_int, -3, 2, -1);48 try comptime S.testSatAdd(comptime_int, -3, 2, -1);
49 comptime try S.testSatAdd(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 1119305249183743626545271163355074748512);49 try comptime S.testSatAdd(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 1119305249183743626545271163355074748512);
50 comptime try S.testSatAdd(comptime_int, 7, -593423721213448152027139550640105366508, -593423721213448152027139550640105366501);50 try comptime S.testSatAdd(comptime_int, 7, -593423721213448152027139550640105366508, -593423721213448152027139550640105366501);
51}51}
5252
53test "saturating add 128bit" {53test "saturating add 128bit" {
...@@ -74,7 +74,7 @@ test "saturating add 128bit" {...@@ -74,7 +74,7 @@ test "saturating add 128bit" {
74 };74 };
7575
76 try S.doTheTest();76 try S.doTheTest();
77 comptime try S.doTheTest();77 try comptime S.doTheTest();
78}78}
7979
80test "saturating subtraction" {80test "saturating subtraction" {
...@@ -110,16 +110,16 @@ test "saturating subtraction" {...@@ -110,16 +110,16 @@ test "saturating subtraction" {
110 };110 };
111111
112 try S.doTheTest();112 try S.doTheTest();
113 comptime try S.doTheTest();113 try comptime S.doTheTest();
114114
115 comptime try S.testSatSub(comptime_int, 0, 0, 0);115 try comptime S.testSatSub(comptime_int, 0, 0, 0);
116 comptime try S.testSatSub(comptime_int, 1, 1, 0);116 try comptime S.testSatSub(comptime_int, 1, 1, 0);
117 comptime try S.testSatSub(comptime_int, 3, 2, 1);117 try comptime S.testSatSub(comptime_int, 3, 2, 1);
118 comptime try S.testSatSub(comptime_int, -3, -2, -1);118 try comptime S.testSatSub(comptime_int, -3, -2, -1);
119 comptime try S.testSatSub(comptime_int, 3, -2, 5);119 try comptime S.testSatSub(comptime_int, 3, -2, 5);
120 comptime try S.testSatSub(comptime_int, -3, 2, -5);120 try comptime S.testSatSub(comptime_int, -3, 2, -5);
121 comptime try S.testSatSub(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 182846383813587550256162760261375991602);121 try comptime S.testSatSub(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 182846383813587550256162760261375991602);
122 comptime try S.testSatSub(comptime_int, 7, -593423721213448152027139550640105366508, 593423721213448152027139550640105366515);122 try comptime S.testSatSub(comptime_int, 7, -593423721213448152027139550640105366508, 593423721213448152027139550640105366515);
123}123}
124124
125test "saturating subtraction 128bit" {125test "saturating subtraction 128bit" {
...@@ -147,7 +147,7 @@ test "saturating subtraction 128bit" {...@@ -147,7 +147,7 @@ test "saturating subtraction 128bit" {
147 };147 };
148148
149 try S.doTheTest();149 try S.doTheTest();
150 comptime try S.doTheTest();150 try comptime S.doTheTest();
151}151}
152152
153test "saturating multiplication" {153test "saturating multiplication" {
...@@ -188,12 +188,12 @@ test "saturating multiplication" {...@@ -188,12 +188,12 @@ test "saturating multiplication" {
188 };188 };
189189
190 try S.doTheTest();190 try S.doTheTest();
191 comptime try S.doTheTest();191 try comptime S.doTheTest();
192192
193 comptime try S.testSatMul(comptime_int, 0, 0, 0);193 try comptime S.testSatMul(comptime_int, 0, 0, 0);
194 comptime try S.testSatMul(comptime_int, 3, 2, 6);194 try comptime S.testSatMul(comptime_int, 3, 2, 6);
195 comptime try S.testSatMul(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 304852860194144160265083087140337419215516305999637969803722975979232817921935);195 try comptime S.testSatMul(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 304852860194144160265083087140337419215516305999637969803722975979232817921935);
196 comptime try S.testSatMul(comptime_int, 7, -593423721213448152027139550640105366508, -4153966048494137064189976854480737565556);196 try comptime S.testSatMul(comptime_int, 7, -593423721213448152027139550640105366508, -4153966048494137064189976854480737565556);
197}197}
198198
199test "saturating shift-left" {199test "saturating shift-left" {
...@@ -228,12 +228,12 @@ test "saturating shift-left" {...@@ -228,12 +228,12 @@ test "saturating shift-left" {
228 };228 };
229229
230 try S.doTheTest();230 try S.doTheTest();
231 comptime try S.doTheTest();231 try comptime S.doTheTest();
232232
233 comptime try S.testSatShl(comptime_int, 0, 0, 0);233 try comptime S.testSatShl(comptime_int, 0, 0, 0);
234 comptime try S.testSatShl(comptime_int, 1, 2, 4);234 try comptime S.testSatShl(comptime_int, 1, 2, 4);
235 comptime try S.testSatShl(comptime_int, 13, 150, 18554220005177478453757717602843436772975706112);235 try comptime S.testSatShl(comptime_int, 13, 150, 18554220005177478453757717602843436772975706112);
236 comptime try S.testSatShl(comptime_int, -582769, 180, -893090893854873184096635538665358532628308979495815656505344);236 try comptime S.testSatShl(comptime_int, -582769, 180, -893090893854873184096635538665358532628308979495815656505344);
237}237}
238238
239test "saturating shl uses the LHS type" {239test "saturating shl uses the LHS type" {
test/behavior/select.zig+2-2
...@@ -11,7 +11,7 @@ test "@select vectors" {...@@ -11,7 +11,7 @@ test "@select vectors" {
11 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO11 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
12 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;12 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1313
14 comptime try selectVectors();14 try comptime selectVectors();
15 try selectVectors();15 try selectVectors();
16}16}
1717
...@@ -40,7 +40,7 @@ test "@select arrays" {...@@ -40,7 +40,7 @@ test "@select arrays" {
40 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO40 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
41 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;41 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
4242
43 comptime try selectArrays();43 try comptime selectArrays();
44 try selectArrays();44 try selectArrays();
45}45}
4646
test/behavior/shuffle.zig+3-3
...@@ -41,7 +41,7 @@ test "@shuffle int" {...@@ -41,7 +41,7 @@ test "@shuffle int" {
41 }41 }
42 };42 };
43 try S.doTheTest();43 try S.doTheTest();
44 comptime try S.doTheTest();44 try comptime S.doTheTest();
45}45}
4646
47test "@shuffle bool 1" {47test "@shuffle bool 1" {
...@@ -62,7 +62,7 @@ test "@shuffle bool 1" {...@@ -62,7 +62,7 @@ test "@shuffle bool 1" {
62 }62 }
63 };63 };
64 try S.doTheTest();64 try S.doTheTest();
65 comptime try S.doTheTest();65 try comptime S.doTheTest();
66}66}
6767
68test "@shuffle bool 2" {68test "@shuffle bool 2" {
...@@ -88,5 +88,5 @@ test "@shuffle bool 2" {...@@ -88,5 +88,5 @@ test "@shuffle bool 2" {
88 }88 }
89 };89 };
90 try S.doTheTest();90 try S.doTheTest();
91 comptime try S.doTheTest();91 try comptime S.doTheTest();
92}92}
test/behavior/sizeof_and_typeof.zig+8-8
...@@ -24,21 +24,21 @@ test "@TypeOf() with multiple arguments" {...@@ -24,21 +24,21 @@ test "@TypeOf() with multiple arguments" {
24 var var_1: u32 = undefined;24 var var_1: u32 = undefined;
25 var var_2: u8 = undefined;25 var var_2: u8 = undefined;
26 var var_3: u64 = undefined;26 var var_3: u64 = undefined;
27 comptime try expect(@TypeOf(var_1, var_2, var_3) == u64);27 try comptime expect(@TypeOf(var_1, var_2, var_3) == u64);
28 }28 }
29 {29 {
30 var var_1: f16 = undefined;30 var var_1: f16 = undefined;
31 var var_2: f32 = undefined;31 var var_2: f32 = undefined;
32 var var_3: f64 = undefined;32 var var_3: f64 = undefined;
33 comptime try expect(@TypeOf(var_1, var_2, var_3) == f64);33 try comptime expect(@TypeOf(var_1, var_2, var_3) == f64);
34 }34 }
35 {35 {
36 var var_1: u16 = undefined;36 var var_1: u16 = undefined;
37 comptime try expect(@TypeOf(var_1, 0xffff) == u16);37 try comptime expect(@TypeOf(var_1, 0xffff) == u16);
38 }38 }
39 {39 {
40 var var_1: f32 = undefined;40 var var_1: f32 = undefined;
41 comptime try expect(@TypeOf(var_1, 3.1415) == f32);41 try comptime expect(@TypeOf(var_1, 3.1415) == f32);
42 }42 }
43}43}
4444
...@@ -148,7 +148,7 @@ test "@TypeOf() has no runtime side effects" {...@@ -148,7 +148,7 @@ test "@TypeOf() has no runtime side effects" {
148 };148 };
149 var data: i32 = 0;149 var data: i32 = 0;
150 const T = @TypeOf(S.foo(i32, &data));150 const T = @TypeOf(S.foo(i32, &data));
151 comptime try expect(T == i32);151 try comptime expect(T == i32);
152 try expect(data == 0);152 try expect(data == 0);
153}153}
154154
...@@ -163,7 +163,7 @@ test "branching logic inside @TypeOf" {...@@ -163,7 +163,7 @@ test "branching logic inside @TypeOf" {
163 }163 }
164 };164 };
165 const T = @TypeOf(S.foo() catch undefined);165 const T = @TypeOf(S.foo() catch undefined);
166 comptime try expect(T == i32);166 try comptime expect(T == i32);
167 try expect(S.data == 0);167 try expect(S.data == 0);
168}168}
169169
...@@ -236,7 +236,7 @@ test "hardcoded address in typeof expression" {...@@ -236,7 +236,7 @@ test "hardcoded address in typeof expression" {
236 }236 }
237 };237 };
238 try expect(S.func() == 0);238 try expect(S.func() == 0);
239 comptime try expect(S.func() == 0);239 try comptime expect(S.func() == 0);
240}240}
241241
242test "array access of generic param in typeof expression" {242test "array access of generic param in typeof expression" {
...@@ -246,7 +246,7 @@ test "array access of generic param in typeof expression" {...@@ -246,7 +246,7 @@ test "array access of generic param in typeof expression" {
246 }246 }
247 };247 };
248 try expect(S.first("a") == 'a');248 try expect(S.first("a") == 'a');
249 comptime try expect(S.first("a") == 'a');249 try comptime expect(S.first("a") == 'a');
250}250}
251251
252test "lazy size cast to float" {252test "lazy size cast to float" {
test/behavior/slice.zig+75-75
...@@ -87,7 +87,7 @@ test "access len index of sentinel-terminated slice" {...@@ -87,7 +87,7 @@ test "access len index of sentinel-terminated slice" {
87 }87 }
88 };88 };
89 try S.doTheTest();89 try S.doTheTest();
90 comptime try S.doTheTest();90 try comptime S.doTheTest();
91}91}
9292
93test "comptime slice of slice preserves comptime var" {93test "comptime slice of slice preserves comptime var" {
...@@ -139,7 +139,7 @@ test "slice of hardcoded address to pointer" {...@@ -139,7 +139,7 @@ test "slice of hardcoded address to pointer" {
139 const S = struct {139 const S = struct {
140 fn doTheTest() !void {140 fn doTheTest() !void {
141 const pointer = @intToPtr([*]u8, 0x04)[0..2];141 const pointer = @intToPtr([*]u8, 0x04)[0..2];
142 comptime try expect(@TypeOf(pointer) == *[2]u8);142 try comptime expect(@TypeOf(pointer) == *[2]u8);
143 const slice: []const u8 = pointer;143 const slice: []const u8 = pointer;
144 try expect(@ptrToInt(slice.ptr) == 4);144 try expect(@ptrToInt(slice.ptr) == 4);
145 try expect(slice.len == 2);145 try expect(slice.len == 2);
...@@ -214,9 +214,9 @@ test "slice string literal has correct type" {...@@ -214,9 +214,9 @@ test "slice string literal has correct type" {
214 try expect(@TypeOf(array[0..]) == *const [4]i32);214 try expect(@TypeOf(array[0..]) == *const [4]i32);
215 }215 }
216 var runtime_zero: usize = 0;216 var runtime_zero: usize = 0;
217 comptime try expect(@TypeOf("aoeu"[runtime_zero..]) == [:0]const u8);217 try comptime expect(@TypeOf("aoeu"[runtime_zero..]) == [:0]const u8);
218 const array = [_]i32{ 1, 2, 3, 4 };218 const array = [_]i32{ 1, 2, 3, 4 };
219 comptime try expect(@TypeOf(array[runtime_zero..]) == []const i32);219 try comptime expect(@TypeOf(array[runtime_zero..]) == []const i32);
220}220}
221221
222test "result location zero sized array inside struct field implicit cast to slice" {222test "result location zero sized array inside struct field implicit cast to slice" {
...@@ -265,8 +265,8 @@ test "C pointer slice access" {...@@ -265,8 +265,8 @@ test "C pointer slice access" {
265 const c_ptr = @ptrCast([*c]const u32, &buf);265 const c_ptr = @ptrCast([*c]const u32, &buf);
266266
267 var runtime_zero: usize = 0;267 var runtime_zero: usize = 0;
268 comptime try expectEqual([]const u32, @TypeOf(c_ptr[runtime_zero..1]));268 try comptime expectEqual([]const u32, @TypeOf(c_ptr[runtime_zero..1]));
269 comptime try expectEqual(*const [1]u32, @TypeOf(c_ptr[0..1]));269 try comptime expectEqual(*const [1]u32, @TypeOf(c_ptr[0..1]));
270270
271 for (c_ptr[0..5]) |*cl| {271 for (c_ptr[0..5]) |*cl| {
272 try expect(@as(u32, 42) == cl.*);272 try expect(@as(u32, 42) == cl.*);
...@@ -320,10 +320,10 @@ test "obtaining a null terminated slice" {...@@ -320,10 +320,10 @@ test "obtaining a null terminated slice" {
320 var runtime_len: usize = 3;320 var runtime_len: usize = 3;
321 const ptr2 = buf[0..runtime_len :0];321 const ptr2 = buf[0..runtime_len :0];
322 // ptr2 is a null-terminated slice322 // ptr2 is a null-terminated slice
323 comptime try expect(@TypeOf(ptr2) == [:0]u8);323 try comptime expect(@TypeOf(ptr2) == [:0]u8);
324 comptime try expect(@TypeOf(ptr2[0..2]) == *[2]u8);324 try comptime expect(@TypeOf(ptr2[0..2]) == *[2]u8);
325 var runtime_zero: usize = 0;325 var runtime_zero: usize = 0;
326 comptime try expect(@TypeOf(ptr2[runtime_zero..2]) == []u8);326 try comptime expect(@TypeOf(ptr2[runtime_zero..2]) == []u8);
327}327}
328328
329test "empty array to slice" {329test "empty array to slice" {
...@@ -340,7 +340,7 @@ test "empty array to slice" {...@@ -340,7 +340,7 @@ test "empty array to slice" {
340 };340 };
341341
342 try S.doTheTest();342 try S.doTheTest();
343 comptime try S.doTheTest();343 try comptime S.doTheTest();
344}344}
345345
346test "@ptrCast slice to pointer" {346test "@ptrCast slice to pointer" {
...@@ -358,7 +358,7 @@ test "@ptrCast slice to pointer" {...@@ -358,7 +358,7 @@ test "@ptrCast slice to pointer" {
358 };358 };
359359
360 try S.doTheTest();360 try S.doTheTest();
361 comptime try S.doTheTest();361 try comptime S.doTheTest();
362}362}
363363
364test "slice syntax resulting in pointer-to-array" {364test "slice syntax resulting in pointer-to-array" {
...@@ -389,29 +389,29 @@ test "slice syntax resulting in pointer-to-array" {...@@ -389,29 +389,29 @@ test "slice syntax resulting in pointer-to-array" {
389 fn testArray() !void {389 fn testArray() !void {
390 var array = [5]u8{ 1, 2, 3, 4, 5 };390 var array = [5]u8{ 1, 2, 3, 4, 5 };
391 var slice = array[1..3];391 var slice = array[1..3];
392 comptime try expect(@TypeOf(slice) == *[2]u8);392 try comptime expect(@TypeOf(slice) == *[2]u8);
393 try expect(slice[0] == 2);393 try expect(slice[0] == 2);
394 try expect(slice[1] == 3);394 try expect(slice[1] == 3);
395 }395 }
396396
397 fn testArrayZ() !void {397 fn testArrayZ() !void {
398 var array = [5:0]u8{ 1, 2, 3, 4, 5 };398 var array = [5:0]u8{ 1, 2, 3, 4, 5 };
399 comptime try expect(@TypeOf(array[1..3]) == *[2]u8);399 try comptime expect(@TypeOf(array[1..3]) == *[2]u8);
400 comptime try expect(@TypeOf(array[1..5]) == *[4:0]u8);400 try comptime expect(@TypeOf(array[1..5]) == *[4:0]u8);
401 comptime try expect(@TypeOf(array[1..]) == *[4:0]u8);401 try comptime expect(@TypeOf(array[1..]) == *[4:0]u8);
402 comptime try expect(@TypeOf(array[1..3 :4]) == *[2:4]u8);402 try comptime expect(@TypeOf(array[1..3 :4]) == *[2:4]u8);
403 }403 }
404404
405 fn testArray0() !void {405 fn testArray0() !void {
406 {406 {
407 var array = [0]u8{};407 var array = [0]u8{};
408 var slice = array[0..0];408 var slice = array[0..0];
409 comptime try expect(@TypeOf(slice) == *[0]u8);409 try comptime expect(@TypeOf(slice) == *[0]u8);
410 }410 }
411 {411 {
412 var array = [0:0]u8{};412 var array = [0:0]u8{};
413 var slice = array[0..0];413 var slice = array[0..0];
414 comptime try expect(@TypeOf(slice) == *[0:0]u8);414 try comptime expect(@TypeOf(slice) == *[0:0]u8);
415 try expect(slice[0] == 0);415 try expect(slice[0] == 0);
416 }416 }
417 }417 }
...@@ -419,16 +419,16 @@ test "slice syntax resulting in pointer-to-array" {...@@ -419,16 +419,16 @@ test "slice syntax resulting in pointer-to-array" {
419 fn testArrayAlign() !void {419 fn testArrayAlign() !void {
420 var array align(4) = [5]u8{ 1, 2, 3, 4, 5 };420 var array align(4) = [5]u8{ 1, 2, 3, 4, 5 };
421 var slice = array[4..5];421 var slice = array[4..5];
422 comptime try expect(@TypeOf(slice) == *align(4) [1]u8);422 try comptime expect(@TypeOf(slice) == *align(4) [1]u8);
423 try expect(slice[0] == 5);423 try expect(slice[0] == 5);
424 comptime try expect(@TypeOf(array[0..2]) == *align(4) [2]u8);424 try comptime expect(@TypeOf(array[0..2]) == *align(4) [2]u8);
425 }425 }
426426
427 fn testPointer() !void {427 fn testPointer() !void {
428 var array = [5]u8{ 1, 2, 3, 4, 5 };428 var array = [5]u8{ 1, 2, 3, 4, 5 };
429 var pointer: [*]u8 = &array;429 var pointer: [*]u8 = &array;
430 var slice = pointer[1..3];430 var slice = pointer[1..3];
431 comptime try expect(@TypeOf(slice) == *[2]u8);431 try comptime expect(@TypeOf(slice) == *[2]u8);
432 try expect(slice[0] == 2);432 try expect(slice[0] == 2);
433 try expect(slice[1] == 3);433 try expect(slice[1] == 3);
434 }434 }
...@@ -436,14 +436,14 @@ test "slice syntax resulting in pointer-to-array" {...@@ -436,14 +436,14 @@ test "slice syntax resulting in pointer-to-array" {
436 fn testPointerZ() !void {436 fn testPointerZ() !void {
437 var array = [5:0]u8{ 1, 2, 3, 4, 5 };437 var array = [5:0]u8{ 1, 2, 3, 4, 5 };
438 var pointer: [*:0]u8 = &array;438 var pointer: [*:0]u8 = &array;
439 comptime try expect(@TypeOf(pointer[1..3]) == *[2]u8);439 try comptime expect(@TypeOf(pointer[1..3]) == *[2]u8);
440 comptime try expect(@TypeOf(pointer[1..3 :4]) == *[2:4]u8);440 try comptime expect(@TypeOf(pointer[1..3 :4]) == *[2:4]u8);
441 }441 }
442442
443 fn testPointer0() !void {443 fn testPointer0() !void {
444 var pointer: [*]const u0 = &[1]u0{0};444 var pointer: [*]const u0 = &[1]u0{0};
445 var slice = pointer[0..1];445 var slice = pointer[0..1];
446 comptime try expect(@TypeOf(slice) == *const [1]u0);446 try comptime expect(@TypeOf(slice) == *const [1]u0);
447 try expect(slice[0] == 0);447 try expect(slice[0] == 0);
448 }448 }
449449
...@@ -451,16 +451,16 @@ test "slice syntax resulting in pointer-to-array" {...@@ -451,16 +451,16 @@ test "slice syntax resulting in pointer-to-array" {
451 var array align(4) = [5]u8{ 1, 2, 3, 4, 5 };451 var array align(4) = [5]u8{ 1, 2, 3, 4, 5 };
452 var pointer: [*]align(4) u8 = &array;452 var pointer: [*]align(4) u8 = &array;
453 var slice = pointer[4..5];453 var slice = pointer[4..5];
454 comptime try expect(@TypeOf(slice) == *align(4) [1]u8);454 try comptime expect(@TypeOf(slice) == *align(4) [1]u8);
455 try expect(slice[0] == 5);455 try expect(slice[0] == 5);
456 comptime try expect(@TypeOf(pointer[0..2]) == *align(4) [2]u8);456 try comptime expect(@TypeOf(pointer[0..2]) == *align(4) [2]u8);
457 }457 }
458458
459 fn testSlice() !void {459 fn testSlice() !void {
460 var array = [5]u8{ 1, 2, 3, 4, 5 };460 var array = [5]u8{ 1, 2, 3, 4, 5 };
461 var src_slice: []u8 = &array;461 var src_slice: []u8 = &array;
462 var slice = src_slice[1..3];462 var slice = src_slice[1..3];
463 comptime try expect(@TypeOf(slice) == *[2]u8);463 try comptime expect(@TypeOf(slice) == *[2]u8);
464 try expect(slice[0] == 2);464 try expect(slice[0] == 2);
465 try expect(slice[1] == 3);465 try expect(slice[1] == 3);
466 }466 }
...@@ -468,26 +468,26 @@ test "slice syntax resulting in pointer-to-array" {...@@ -468,26 +468,26 @@ test "slice syntax resulting in pointer-to-array" {
468 fn testSliceZ() !void {468 fn testSliceZ() !void {
469 var array = [5:0]u8{ 1, 2, 3, 4, 5 };469 var array = [5:0]u8{ 1, 2, 3, 4, 5 };
470 var slice: [:0]u8 = &array;470 var slice: [:0]u8 = &array;
471 comptime try expect(@TypeOf(slice[1..3]) == *[2]u8);471 try comptime expect(@TypeOf(slice[1..3]) == *[2]u8);
472 comptime try expect(@TypeOf(slice[1..]) == [:0]u8);472 try comptime expect(@TypeOf(slice[1..]) == [:0]u8);
473 comptime try expect(@TypeOf(slice[1..3 :4]) == *[2:4]u8);473 try comptime expect(@TypeOf(slice[1..3 :4]) == *[2:4]u8);
474 }474 }
475475
476 fn testSliceOpt() !void {476 fn testSliceOpt() !void {
477 var array: [2]u8 = [2]u8{ 1, 2 };477 var array: [2]u8 = [2]u8{ 1, 2 };
478 var slice: ?[]u8 = &array;478 var slice: ?[]u8 = &array;
479 comptime try expect(@TypeOf(&array, slice) == ?[]u8);479 try comptime expect(@TypeOf(&array, slice) == ?[]u8);
480 comptime try expect(@TypeOf(slice, &array) == ?[]u8);480 try comptime expect(@TypeOf(slice, &array) == ?[]u8);
481 comptime try expect(@TypeOf(slice.?[0..2]) == *[2]u8);481 try comptime expect(@TypeOf(slice.?[0..2]) == *[2]u8);
482 }482 }
483483
484 fn testSliceAlign() !void {484 fn testSliceAlign() !void {
485 var array align(4) = [5]u8{ 1, 2, 3, 4, 5 };485 var array align(4) = [5]u8{ 1, 2, 3, 4, 5 };
486 var src_slice: []align(4) u8 = &array;486 var src_slice: []align(4) u8 = &array;
487 var slice = src_slice[4..5];487 var slice = src_slice[4..5];
488 comptime try expect(@TypeOf(slice) == *align(4) [1]u8);488 try comptime expect(@TypeOf(slice) == *align(4) [1]u8);
489 try expect(slice[0] == 5);489 try expect(slice[0] == 5);
490 comptime try expect(@TypeOf(src_slice[0..2]) == *align(4) [2]u8);490 try comptime expect(@TypeOf(src_slice[0..2]) == *align(4) [2]u8);
491 }491 }
492492
493 fn testConcatStrLiterals() !void {493 fn testConcatStrLiterals() !void {
...@@ -498,67 +498,67 @@ test "slice syntax resulting in pointer-to-array" {...@@ -498,67 +498,67 @@ test "slice syntax resulting in pointer-to-array" {
498 fn testSliceLength() !void {498 fn testSliceLength() !void {
499 var array = [5]u8{ 1, 2, 3, 4, 5 };499 var array = [5]u8{ 1, 2, 3, 4, 5 };
500 var slice: []u8 = &array;500 var slice: []u8 = &array;
501 comptime try expect(@TypeOf(slice[1..][0..2]) == *[2]u8);501 try comptime expect(@TypeOf(slice[1..][0..2]) == *[2]u8);
502 comptime try expect(@TypeOf(slice[1..][0..4]) == *[4]u8);502 try comptime expect(@TypeOf(slice[1..][0..4]) == *[4]u8);
503 comptime try expect(@TypeOf(slice[1..][0..2 :4]) == *[2:4]u8);503 try comptime expect(@TypeOf(slice[1..][0..2 :4]) == *[2:4]u8);
504 }504 }
505505
506 fn testSliceLengthZ() !void {506 fn testSliceLengthZ() !void {
507 var array = [5:0]u8{ 1, 2, 3, 4, 5 };507 var array = [5:0]u8{ 1, 2, 3, 4, 5 };
508 var slice: [:0]u8 = &array;508 var slice: [:0]u8 = &array;
509 comptime try expect(@TypeOf(slice[1..][0..2]) == *[2]u8);509 try comptime expect(@TypeOf(slice[1..][0..2]) == *[2]u8);
510 comptime try expect(@TypeOf(slice[1..][0..2 :4]) == *[2:4]u8);510 try comptime expect(@TypeOf(slice[1..][0..2 :4]) == *[2:4]u8);
511 comptime try expect(@TypeOf(slice[1.. :0][0..2]) == *[2]u8);511 try comptime expect(@TypeOf(slice[1.. :0][0..2]) == *[2]u8);
512 comptime try expect(@TypeOf(slice[1.. :0][0..2 :4]) == *[2:4]u8);512 try comptime expect(@TypeOf(slice[1.. :0][0..2 :4]) == *[2:4]u8);
513 }513 }
514514
515 fn testArrayLength() !void {515 fn testArrayLength() !void {
516 var array = [5]u8{ 1, 2, 3, 4, 5 };516 var array = [5]u8{ 1, 2, 3, 4, 5 };
517 comptime try expect(@TypeOf(array[1..][0..2]) == *[2]u8);517 try comptime expect(@TypeOf(array[1..][0..2]) == *[2]u8);
518 comptime try expect(@TypeOf(array[1..][0..4]) == *[4]u8);518 try comptime expect(@TypeOf(array[1..][0..4]) == *[4]u8);
519 comptime try expect(@TypeOf(array[1..][0..2 :4]) == *[2:4]u8);519 try comptime expect(@TypeOf(array[1..][0..2 :4]) == *[2:4]u8);
520 }520 }
521521
522 fn testArrayLengthZ() !void {522 fn testArrayLengthZ() !void {
523 var array = [5:0]u8{ 1, 2, 3, 4, 5 };523 var array = [5:0]u8{ 1, 2, 3, 4, 5 };
524 comptime try expect(@TypeOf(array[1..][0..2]) == *[2]u8);524 try comptime expect(@TypeOf(array[1..][0..2]) == *[2]u8);
525 comptime try expect(@TypeOf(array[1..][0..4]) == *[4:0]u8);525 try comptime expect(@TypeOf(array[1..][0..4]) == *[4:0]u8);
526 comptime try expect(@TypeOf(array[1..][0..2 :4]) == *[2:4]u8);526 try comptime expect(@TypeOf(array[1..][0..2 :4]) == *[2:4]u8);
527 comptime try expect(@TypeOf(array[1.. :0][0..2]) == *[2]u8);527 try comptime expect(@TypeOf(array[1.. :0][0..2]) == *[2]u8);
528 comptime try expect(@TypeOf(array[1.. :0][0..4]) == *[4:0]u8);528 try comptime expect(@TypeOf(array[1.. :0][0..4]) == *[4:0]u8);
529 comptime try expect(@TypeOf(array[1.. :0][0..2 :4]) == *[2:4]u8);529 try comptime expect(@TypeOf(array[1.. :0][0..2 :4]) == *[2:4]u8);
530 }530 }
531531
532 fn testMultiPointer() !void {532 fn testMultiPointer() !void {
533 var array = [5]u8{ 1, 2, 3, 4, 5 };533 var array = [5]u8{ 1, 2, 3, 4, 5 };
534 var ptr: [*]u8 = &array;534 var ptr: [*]u8 = &array;
535 comptime try expect(@TypeOf(ptr[1..][0..2]) == *[2]u8);535 try comptime expect(@TypeOf(ptr[1..][0..2]) == *[2]u8);
536 comptime try expect(@TypeOf(ptr[1..][0..4]) == *[4]u8);536 try comptime expect(@TypeOf(ptr[1..][0..4]) == *[4]u8);
537 comptime try expect(@TypeOf(ptr[1..][0..2 :4]) == *[2:4]u8);537 try comptime expect(@TypeOf(ptr[1..][0..2 :4]) == *[2:4]u8);
538 }538 }
539539
540 fn testMultiPointerLengthZ() !void {540 fn testMultiPointerLengthZ() !void {
541 var array = [5:0]u8{ 1, 2, 3, 4, 5 };541 var array = [5:0]u8{ 1, 2, 3, 4, 5 };
542 var ptr: [*]u8 = &array;542 var ptr: [*]u8 = &array;
543 comptime try expect(@TypeOf(ptr[1..][0..2]) == *[2]u8);543 try comptime expect(@TypeOf(ptr[1..][0..2]) == *[2]u8);
544 comptime try expect(@TypeOf(ptr[1..][0..4]) == *[4:0]u8);544 try comptime expect(@TypeOf(ptr[1..][0..4]) == *[4:0]u8);
545 comptime try expect(@TypeOf(ptr[1..][0..2 :4]) == *[2:4]u8);545 try comptime expect(@TypeOf(ptr[1..][0..2 :4]) == *[2:4]u8);
546 comptime try expect(@TypeOf(ptr[1.. :0][0..2]) == *[2]u8);546 try comptime expect(@TypeOf(ptr[1.. :0][0..2]) == *[2]u8);
547 comptime try expect(@TypeOf(ptr[1.. :0][0..4]) == *[4:0]u8);547 try comptime expect(@TypeOf(ptr[1.. :0][0..4]) == *[4:0]u8);
548 comptime try expect(@TypeOf(ptr[1.. :0][0..2 :4]) == *[2:4]u8);548 try comptime expect(@TypeOf(ptr[1.. :0][0..2 :4]) == *[2:4]u8);
549549
550 var ptr_z: [*:0]u8 = &array;550 var ptr_z: [*:0]u8 = &array;
551 comptime try expect(@TypeOf(ptr_z[1..][0..2]) == *[2]u8);551 try comptime expect(@TypeOf(ptr_z[1..][0..2]) == *[2]u8);
552 comptime try expect(@TypeOf(ptr_z[1..][0..4]) == *[4:0]u8);552 try comptime expect(@TypeOf(ptr_z[1..][0..4]) == *[4:0]u8);
553 comptime try expect(@TypeOf(ptr_z[1..][0..2 :4]) == *[2:4]u8);553 try comptime expect(@TypeOf(ptr_z[1..][0..2 :4]) == *[2:4]u8);
554 comptime try expect(@TypeOf(ptr_z[1.. :0][0..2]) == *[2]u8);554 try comptime expect(@TypeOf(ptr_z[1.. :0][0..2]) == *[2]u8);
555 comptime try expect(@TypeOf(ptr_z[1.. :0][0..4]) == *[4:0]u8);555 try comptime expect(@TypeOf(ptr_z[1.. :0][0..4]) == *[4:0]u8);
556 comptime try expect(@TypeOf(ptr_z[1.. :0][0..2 :4]) == *[2:4]u8);556 try comptime expect(@TypeOf(ptr_z[1.. :0][0..2 :4]) == *[2:4]u8);
557 }557 }
558 };558 };
559559
560 try S.doTheTest();560 try S.doTheTest();
561 comptime try S.doTheTest();561 try comptime S.doTheTest();
562}562}
563563
564test "slice pointer-to-array null terminated" {564test "slice pointer-to-array null terminated" {
...@@ -576,9 +576,9 @@ test "slice pointer-to-array null terminated" {...@@ -576,9 +576,9 @@ test "slice pointer-to-array null terminated" {
576576
577 var array = [5:0]u8{ 1, 2, 3, 4, 5 };577 var array = [5:0]u8{ 1, 2, 3, 4, 5 };
578 var slice: [:0]u8 = &array;578 var slice: [:0]u8 = &array;
579 comptime try expect(@TypeOf(slice[1..3]) == *[2]u8);579 try comptime expect(@TypeOf(slice[1..3]) == *[2]u8);
580 comptime try expect(@TypeOf(slice[1..3 :4]) == *[2:4]u8);580 try comptime expect(@TypeOf(slice[1..3 :4]) == *[2:4]u8);
581 comptime try expect(@TypeOf(slice[1..]) == [:0]u8);581 try comptime expect(@TypeOf(slice[1..]) == [:0]u8);
582}582}
583583
584test "slice pointer-to-array zero length" {584test "slice pointer-to-array zero length" {
...@@ -604,13 +604,13 @@ test "slice pointer-to-array zero length" {...@@ -604,13 +604,13 @@ test "slice pointer-to-array zero length" {
604 var array = [0]u8{};604 var array = [0]u8{};
605 var src_slice: []u8 = &array;605 var src_slice: []u8 = &array;
606 var slice = src_slice[0..0];606 var slice = src_slice[0..0];
607 comptime try expect(@TypeOf(slice) == *[0]u8);607 try comptime expect(@TypeOf(slice) == *[0]u8);
608 }608 }
609 {609 {
610 var array = [0:0]u8{};610 var array = [0:0]u8{};
611 var src_slice: [:0]u8 = &array;611 var src_slice: [:0]u8 = &array;
612 var slice = src_slice[0..0];612 var slice = src_slice[0..0];
613 comptime try expect(@TypeOf(slice) == *[0]u8);613 try comptime expect(@TypeOf(slice) == *[0]u8);
614 }614 }
615}615}
616616
...@@ -647,7 +647,7 @@ test "type coercion of pointer to anon struct literal to pointer to slice" {...@@ -647,7 +647,7 @@ test "type coercion of pointer to anon struct literal to pointer to slice" {
647 }647 }
648 };648 };
649 try S.doTheTest();649 try S.doTheTest();
650 comptime try S.doTheTest();650 try comptime S.doTheTest();
651}651}
652652
653test "array concat of slices gives ptr to array" {653test "array concat of slices gives ptr to array" {
...@@ -719,7 +719,7 @@ test "slicing array with sentinel as end index" {...@@ -719,7 +719,7 @@ test "slicing array with sentinel as end index" {
719 };719 };
720720
721 try S.do();721 try S.do();
722 comptime try S.do();722 try comptime S.do();
723}723}
724724
725test "slicing slice with sentinel as end index" {725test "slicing slice with sentinel as end index" {
...@@ -739,7 +739,7 @@ test "slicing slice with sentinel as end index" {...@@ -739,7 +739,7 @@ test "slicing slice with sentinel as end index" {
739 };739 };
740740
741 try S.do();741 try S.do();
742 comptime try S.do();742 try comptime S.do();
743}743}
744744
745test "slice len modification at comptime" {745test "slice len modification at comptime" {
test/behavior/struct.zig+18-18
...@@ -268,7 +268,7 @@ test "struct field init with catch" {...@@ -268,7 +268,7 @@ test "struct field init with catch" {
268 };268 };
269 };269 };
270 try S.doTheTest();270 try S.doTheTest();
271 comptime try S.doTheTest();271 try comptime S.doTheTest();
272}272}
273273
274const blah: packed struct {274const blah: packed struct {
...@@ -603,7 +603,7 @@ test "bit field access" {...@@ -603,7 +603,7 @@ test "bit field access" {
603 try expect(getA(&data) == 1);603 try expect(getA(&data) == 1);
604 try expect(getB(&data) == 2);604 try expect(getB(&data) == 2);
605 try expect(getC(&data) == 3);605 try expect(getC(&data) == 3);
606 comptime try expect(@sizeOf(BitField1) == 1);606 try comptime expect(@sizeOf(BitField1) == 1);
607607
608 data.b += 1;608 data.b += 1;
609 try expect(data.b == 3);609 try expect(data.b == 3);
...@@ -740,7 +740,7 @@ test "packed struct with u0 field access" {...@@ -740,7 +740,7 @@ test "packed struct with u0 field access" {
740 f0: u0,740 f0: u0,
741 };741 };
742 var s = S{ .f0 = 0 };742 var s = S{ .f0 = 0 };
743 comptime try expect(s.f0 == 0);743 try comptime expect(s.f0 == 0);
744}744}
745745
746test "access to global struct fields" {746test "access to global struct fields" {
...@@ -817,7 +817,7 @@ test "fn with C calling convention returns struct by value" {...@@ -817,7 +817,7 @@ test "fn with C calling convention returns struct by value" {
817 }817 }
818 };818 };
819 try S.entry();819 try S.entry();
820 comptime try S.entry();820 try comptime S.entry();
821}821}
822822
823test "non-packed struct with u128 entry in union" {823test "non-packed struct with u128 entry in union" {
...@@ -889,7 +889,7 @@ test "anonymous struct literal syntax" {...@@ -889,7 +889,7 @@ test "anonymous struct literal syntax" {
889 }889 }
890 };890 };
891 try S.doTheTest();891 try S.doTheTest();
892 comptime try S.doTheTest();892 try comptime S.doTheTest();
893}893}
894894
895test "fully anonymous struct" {895test "fully anonymous struct" {
...@@ -911,7 +911,7 @@ test "fully anonymous struct" {...@@ -911,7 +911,7 @@ test "fully anonymous struct" {
911 }911 }
912 };912 };
913 try S.doTheTest();913 try S.doTheTest();
914 comptime try S.doTheTest();914 try comptime S.doTheTest();
915}915}
916916
917test "fully anonymous list literal" {917test "fully anonymous list literal" {
...@@ -928,7 +928,7 @@ test "fully anonymous list literal" {...@@ -928,7 +928,7 @@ test "fully anonymous list literal" {
928 }928 }
929 };929 };
930 try S.doTheTest();930 try S.doTheTest();
931 comptime try S.doTheTest();931 try comptime S.doTheTest();
932}932}
933933
934test "tuple assigned to variable" {934test "tuple assigned to variable" {
...@@ -955,7 +955,7 @@ test "comptime struct field" {...@@ -955,7 +955,7 @@ test "comptime struct field" {
955 comptime std.debug.assert(@sizeOf(T) == 4);955 comptime std.debug.assert(@sizeOf(T) == 4);
956956
957 var foo: T = undefined;957 var foo: T = undefined;
958 comptime try expect(foo.b == 1234);958 try comptime expect(foo.b == 1234);
959}959}
960960
961test "tuple element initialized with fn call" {961test "tuple element initialized with fn call" {
...@@ -974,7 +974,7 @@ test "tuple element initialized with fn call" {...@@ -974,7 +974,7 @@ test "tuple element initialized with fn call" {
974 }974 }
975 };975 };
976 try S.doTheTest();976 try S.doTheTest();
977 comptime try S.doTheTest();977 try comptime S.doTheTest();
978}978}
979979
980test "struct with union field" {980test "struct with union field" {
...@@ -1033,7 +1033,7 @@ test "type coercion of anon struct literal to struct" {...@@ -1033,7 +1033,7 @@ test "type coercion of anon struct literal to struct" {
1033 }1033 }
1034 };1034 };
1035 try S.doTheTest();1035 try S.doTheTest();
1036 comptime try S.doTheTest();1036 try comptime S.doTheTest();
1037}1037}
10381038
1039test "type coercion of pointer to anon struct literal to pointer to struct" {1039test "type coercion of pointer to anon struct literal to pointer to struct" {
...@@ -1071,7 +1071,7 @@ test "type coercion of pointer to anon struct literal to pointer to struct" {...@@ -1071,7 +1071,7 @@ test "type coercion of pointer to anon struct literal to pointer to struct" {
1071 }1071 }
1072 };1072 };
1073 try S.doTheTest();1073 try S.doTheTest();
1074 comptime try S.doTheTest();1074 try comptime S.doTheTest();
1075}1075}
10761076
1077test "packed struct with undefined initializers" {1077test "packed struct with undefined initializers" {
...@@ -1104,7 +1104,7 @@ test "packed struct with undefined initializers" {...@@ -1104,7 +1104,7 @@ test "packed struct with undefined initializers" {
1104 };1104 };
11051105
1106 try S.doTheTest();1106 try S.doTheTest();
1107 comptime try S.doTheTest();1107 try comptime S.doTheTest();
1108}1108}
11091109
1110test "for loop over pointers to struct, getting field from struct pointer" {1110test "for loop over pointers to struct, getting field from struct pointer" {
...@@ -1169,7 +1169,7 @@ test "anon init through error unions and optionals" {...@@ -1169,7 +1169,7 @@ test "anon init through error unions and optionals" {
1169 };1169 };
11701170
1171 try S.doTheTest();1171 try S.doTheTest();
1172 comptime try S.doTheTest();1172 try comptime S.doTheTest();
1173}1173}
11741174
1175test "anon init through optional" {1175test "anon init through optional" {
...@@ -1189,7 +1189,7 @@ test "anon init through optional" {...@@ -1189,7 +1189,7 @@ test "anon init through optional" {
1189 };1189 };
11901190
1191 try S.doTheTest();1191 try S.doTheTest();
1192 comptime try S.doTheTest();1192 try comptime S.doTheTest();
1193}1193}
11941194
1195test "anon init through error union" {1195test "anon init through error union" {
...@@ -1209,7 +1209,7 @@ test "anon init through error union" {...@@ -1209,7 +1209,7 @@ test "anon init through error union" {
1209 };1209 };
12101210
1211 try S.doTheTest();1211 try S.doTheTest();
1212 comptime try S.doTheTest();1212 try comptime S.doTheTest();
1213}1213}
12141214
1215test "typed init through error unions and optionals" {1215test "typed init through error unions and optionals" {
...@@ -1236,7 +1236,7 @@ test "typed init through error unions and optionals" {...@@ -1236,7 +1236,7 @@ test "typed init through error unions and optionals" {
1236 };1236 };
12371237
1238 try S.doTheTest();1238 try S.doTheTest();
1239 comptime try S.doTheTest();1239 try comptime S.doTheTest();
1240}1240}
12411241
1242test "initialize struct with empty literal" {1242test "initialize struct with empty literal" {
...@@ -1311,7 +1311,7 @@ test "packed struct field access via pointer" {...@@ -1311,7 +1311,7 @@ test "packed struct field access via pointer" {
1311 }1311 }
1312 };1312 };
1313 try S.doTheTest();1313 try S.doTheTest();
1314 comptime try S.doTheTest();1314 try comptime S.doTheTest();
1315}1315}
13161316
1317test "store to comptime field" {1317test "store to comptime field" {
...@@ -1416,7 +1416,7 @@ test "fieldParentPtr of a zero-bit field" {...@@ -1416,7 +1416,7 @@ test "fieldParentPtr of a zero-bit field" {
1416 }1416 }
1417 };1417 };
1418 try S.doTheTest();1418 try S.doTheTest();
1419 comptime try S.doTheTest();1419 try comptime S.doTheTest();
1420}1420}
14211421
1422test "struct field has a pointer to an aligned version of itself" {1422test "struct field has a pointer to an aligned version of itself" {
test/behavior/switch.zig+20-20
...@@ -121,7 +121,7 @@ test "switching on booleans" {...@@ -121,7 +121,7 @@ test "switching on booleans" {
121 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;121 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
122122
123 try testSwitchOnBools();123 try testSwitchOnBools();
124 comptime try testSwitchOnBools();124 try comptime testSwitchOnBools();
125}125}
126126
127fn testSwitchOnBools() !void {127fn testSwitchOnBools() !void {
...@@ -186,10 +186,10 @@ test "switch variable for range and multiple prongs" {...@@ -186,10 +186,10 @@ test "switch variable for range and multiple prongs" {
186 fn doTheTest() !void {186 fn doTheTest() !void {
187 var u: u8 = 16;187 var u: u8 = 16;
188 try doTheSwitch(u);188 try doTheSwitch(u);
189 comptime try doTheSwitch(u);189 try comptime doTheSwitch(u);
190 var v: u8 = 42;190 var v: u8 = 42;
191 try doTheSwitch(v);191 try doTheSwitch(v);
192 comptime try doTheSwitch(v);192 try comptime doTheSwitch(v);
193 }193 }
194 fn doTheSwitch(q: u8) !void {194 fn doTheSwitch(q: u8) !void {
195 switch (q) {195 switch (q) {
...@@ -260,7 +260,7 @@ test "switch on enum using pointer capture" {...@@ -260,7 +260,7 @@ test "switch on enum using pointer capture" {
260 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;260 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
261261
262 try testSwitchEnumPtrCapture();262 try testSwitchEnumPtrCapture();
263 comptime try testSwitchEnumPtrCapture();263 try comptime testSwitchEnumPtrCapture();
264}264}
265265
266fn testSwitchEnumPtrCapture() !void {266fn testSwitchEnumPtrCapture() !void {
...@@ -279,7 +279,7 @@ test "switch handles all cases of number" {...@@ -279,7 +279,7 @@ test "switch handles all cases of number" {
279 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO279 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
280280
281 try testSwitchHandleAllCases();281 try testSwitchHandleAllCases();
282 comptime try testSwitchHandleAllCases();282 try comptime testSwitchHandleAllCases();
283}283}
284284
285fn testSwitchHandleAllCases() !void {285fn testSwitchHandleAllCases() !void {
...@@ -373,7 +373,7 @@ test "switch all prongs unreachable" {...@@ -373,7 +373,7 @@ test "switch all prongs unreachable" {
373 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO373 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
374374
375 try testAllProngsUnreachable();375 try testAllProngsUnreachable();
376 comptime try testAllProngsUnreachable();376 try comptime testAllProngsUnreachable();
377}377}
378378
379fn testAllProngsUnreachable() !void {379fn testAllProngsUnreachable() !void {
...@@ -421,7 +421,7 @@ test "switch on integer with else capturing expr" {...@@ -421,7 +421,7 @@ test "switch on integer with else capturing expr" {
421 }421 }
422 };422 };
423 try S.doTheTest();423 try S.doTheTest();
424 comptime try S.doTheTest();424 try comptime S.doTheTest();
425}425}
426426
427test "else prong of switch on error set excludes other cases" {427test "else prong of switch on error set excludes other cases" {
...@@ -456,7 +456,7 @@ test "else prong of switch on error set excludes other cases" {...@@ -456,7 +456,7 @@ test "else prong of switch on error set excludes other cases" {
456 }456 }
457 };457 };
458 try S.doTheTest();458 try S.doTheTest();
459 comptime try S.doTheTest();459 try comptime S.doTheTest();
460}460}
461461
462test "switch prongs with error set cases make a new error set type for capture value" {462test "switch prongs with error set cases make a new error set type for capture value" {
...@@ -493,7 +493,7 @@ test "switch prongs with error set cases make a new error set type for capture v...@@ -493,7 +493,7 @@ test "switch prongs with error set cases make a new error set type for capture v
493 }493 }
494 };494 };
495 try S.doTheTest();495 try S.doTheTest();
496 comptime try S.doTheTest();496 try comptime S.doTheTest();
497}497}
498498
499test "return result loc and then switch with range implicit casted to error union" {499test "return result loc and then switch with range implicit casted to error union" {
...@@ -512,7 +512,7 @@ test "return result loc and then switch with range implicit casted to error unio...@@ -512,7 +512,7 @@ test "return result loc and then switch with range implicit casted to error unio
512 }512 }
513 };513 };
514 try S.doTheTest();514 try S.doTheTest();
515 comptime try S.doTheTest();515 try comptime S.doTheTest();
516}516}
517517
518test "switch with null and T peer types and inferred result location type" {518test "switch with null and T peer types and inferred result location type" {
...@@ -532,7 +532,7 @@ test "switch with null and T peer types and inferred result location type" {...@@ -532,7 +532,7 @@ test "switch with null and T peer types and inferred result location type" {
532 }532 }
533 };533 };
534 try S.doTheTest(1);534 try S.doTheTest(1);
535 comptime try S.doTheTest(1);535 try comptime S.doTheTest(1);
536}536}
537537
538test "switch prongs with cases with identical payload types" {538test "switch prongs with cases with identical payload types" {
...@@ -577,7 +577,7 @@ test "switch prongs with cases with identical payload types" {...@@ -577,7 +577,7 @@ test "switch prongs with cases with identical payload types" {
577 }577 }
578 };578 };
579 try S.doTheTest();579 try S.doTheTest();
580 comptime try S.doTheTest();580 try comptime S.doTheTest();
581}581}
582582
583test "switch on pointer type" {583test "switch on pointer type" {
...@@ -606,9 +606,9 @@ test "switch on pointer type" {...@@ -606,9 +606,9 @@ test "switch on pointer type" {
606 try expect(1 == S.doTheTest(S.P1));606 try expect(1 == S.doTheTest(S.P1));
607 try expect(2 == S.doTheTest(S.P2));607 try expect(2 == S.doTheTest(S.P2));
608 try expect(3 == S.doTheTest(S.P3));608 try expect(3 == S.doTheTest(S.P3));
609 comptime try expect(1 == S.doTheTest(S.P1));609 try comptime expect(1 == S.doTheTest(S.P1));
610 comptime try expect(2 == S.doTheTest(S.P2));610 try comptime expect(2 == S.doTheTest(S.P2));
611 comptime try expect(3 == S.doTheTest(S.P3));611 try comptime expect(3 == S.doTheTest(S.P3));
612}612}
613613
614test "switch on error set with single else" {614test "switch on error set with single else" {
...@@ -624,7 +624,7 @@ test "switch on error set with single else" {...@@ -624,7 +624,7 @@ test "switch on error set with single else" {
624 };624 };
625625
626 try S.doTheTest();626 try S.doTheTest();
627 comptime try S.doTheTest();627 try comptime S.doTheTest();
628}628}
629629
630test "switch capture copies its payload" {630test "switch capture copies its payload" {
...@@ -650,7 +650,7 @@ test "switch capture copies its payload" {...@@ -650,7 +650,7 @@ test "switch capture copies its payload" {
650 }650 }
651 };651 };
652 try S.doTheTest();652 try S.doTheTest();
653 comptime try S.doTheTest();653 try comptime S.doTheTest();
654}654}
655655
656test "capture of integer forwards the switch condition directly" {656test "capture of integer forwards the switch condition directly" {
...@@ -670,8 +670,8 @@ test "capture of integer forwards the switch condition directly" {...@@ -670,8 +670,8 @@ test "capture of integer forwards the switch condition directly" {
670 };670 };
671 try S.foo(42);671 try S.foo(42);
672 try S.foo(100);672 try S.foo(100);
673 comptime try S.foo(42);673 try comptime S.foo(42);
674 comptime try S.foo(100);674 try comptime S.foo(100);
675}675}
676676
677test "enum value without tag name used as switch item" {677test "enum value without tag name used as switch item" {
...@@ -702,7 +702,7 @@ test "switch item sizeof" {...@@ -702,7 +702,7 @@ test "switch item sizeof" {
702 }702 }
703 };703 };
704 try S.doTheTest();704 try S.doTheTest();
705 comptime try S.doTheTest();705 try comptime S.doTheTest();
706}706}
707707
708test "comptime inline switch" {708test "comptime inline switch" {
test/behavior/truncate.zig+3-3
...@@ -5,7 +5,7 @@ const expect = std.testing.expect;...@@ -5,7 +5,7 @@ const expect = std.testing.expect;
5test "truncate u0 to larger integer allowed and has comptime-known result" {5test "truncate u0 to larger integer allowed and has comptime-known result" {
6 var x: u0 = 0;6 var x: u0 = 0;
7 const y = @truncate(u8, x);7 const y = @truncate(u8, x);
8 comptime try expect(y == 0);8 try comptime expect(y == 0);
9}9}
1010
11test "truncate.u0.literal" {11test "truncate.u0.literal" {
...@@ -28,7 +28,7 @@ test "truncate.u0.var" {...@@ -28,7 +28,7 @@ test "truncate.u0.var" {
28test "truncate i0 to larger integer allowed and has comptime-known result" {28test "truncate i0 to larger integer allowed and has comptime-known result" {
29 var x: i0 = 0;29 var x: i0 = 0;
30 const y = @truncate(i8, x);30 const y = @truncate(i8, x);
31 comptime try expect(y == 0);31 try comptime expect(y == 0);
32}32}
3333
34test "truncate.i0.literal" {34test "truncate.i0.literal" {
...@@ -73,6 +73,6 @@ test "truncate on vectors" {...@@ -73,6 +73,6 @@ test "truncate on vectors" {
73 try expect(std.mem.eql(u8, &@as([4]u8, v2), &[4]u8{ 0xbb, 0xdd, 0xff, 0x22 }));73 try expect(std.mem.eql(u8, &@as([4]u8, v2), &[4]u8{ 0xbb, 0xdd, 0xff, 0x22 }));
74 }74 }
75 };75 };
76 comptime try S.doTheTest();76 try comptime S.doTheTest();
77 try S.doTheTest();77 try S.doTheTest();
78}78}
test/behavior/try.zig+1-1
...@@ -7,7 +7,7 @@ test "try on error union" {...@@ -7,7 +7,7 @@ test "try on error union" {
7 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;7 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
88
9 try tryOnErrorUnionImpl();9 try tryOnErrorUnionImpl();
10 comptime try tryOnErrorUnionImpl();10 try comptime tryOnErrorUnionImpl();
11}11}
1212
13fn tryOnErrorUnionImpl() !void {13fn tryOnErrorUnionImpl() !void {
test/behavior/tuple.zig+7-7
...@@ -23,7 +23,7 @@ test "tuple concatenation" {...@@ -23,7 +23,7 @@ test "tuple concatenation" {
23 }23 }
24 };24 };
25 try S.doTheTest();25 try S.doTheTest();
26 comptime try S.doTheTest();26 try comptime S.doTheTest();
27}27}
2828
29test "tuple multiplication" {29test "tuple multiplication" {
...@@ -46,7 +46,7 @@ test "tuple multiplication" {...@@ -46,7 +46,7 @@ test "tuple multiplication" {
46 }46 }
47 };47 };
48 try S.doTheTest();48 try S.doTheTest();
49 comptime try S.doTheTest();49 try comptime S.doTheTest();
50}50}
5151
52test "more tuple concatenation" {52test "more tuple concatenation" {
...@@ -91,7 +91,7 @@ test "more tuple concatenation" {...@@ -91,7 +91,7 @@ test "more tuple concatenation" {
91 };91 };
9292
93 try T.doTheTest();93 try T.doTheTest();
94 comptime try T.doTheTest();94 try comptime T.doTheTest();
95}95}
9696
97test "pass tuple to comptime var parameter" {97test "pass tuple to comptime var parameter" {
...@@ -105,7 +105,7 @@ test "pass tuple to comptime var parameter" {...@@ -105,7 +105,7 @@ test "pass tuple to comptime var parameter" {
105 }105 }
106 };106 };
107 try S.doTheTest();107 try S.doTheTest();
108 comptime try S.doTheTest();108 try comptime S.doTheTest();
109}109}
110110
111test "tuple initializer for var" {111test "tuple initializer for var" {
...@@ -163,7 +163,7 @@ test "array-like initializer for tuple types" {...@@ -163,7 +163,7 @@ test "array-like initializer for tuple types" {
163 };163 };
164164
165 try S.doTheTest();165 try S.doTheTest();
166 comptime try S.doTheTest();166 try comptime S.doTheTest();
167}167}
168168
169test "anon struct as the result from a labeled block" {169test "anon struct as the result from a labeled block" {
...@@ -180,7 +180,7 @@ test "anon struct as the result from a labeled block" {...@@ -180,7 +180,7 @@ test "anon struct as the result from a labeled block" {
180 };180 };
181181
182 try S.doTheTest();182 try S.doTheTest();
183 comptime try S.doTheTest();183 try comptime S.doTheTest();
184}184}
185185
186test "tuple as the result from a labeled block" {186test "tuple as the result from a labeled block" {
...@@ -195,7 +195,7 @@ test "tuple as the result from a labeled block" {...@@ -195,7 +195,7 @@ test "tuple as the result from a labeled block" {
195 };195 };
196196
197 try S.doTheTest();197 try S.doTheTest();
198 comptime try S.doTheTest();198 try comptime S.doTheTest();
199}199}
200200
201test "initializing tuple with explicit type" {201test "initializing tuple with explicit type" {
test/behavior/type_info.zig+20-20
...@@ -10,7 +10,7 @@ const expectEqualStrings = std.testing.expectEqualStrings;...@@ -10,7 +10,7 @@ const expectEqualStrings = std.testing.expectEqualStrings;
1010
11test "type info: integer, floating point type info" {11test "type info: integer, floating point type info" {
12 try testIntFloat();12 try testIntFloat();
13 comptime try testIntFloat();13 try comptime testIntFloat();
14}14}
1515
16fn testIntFloat() !void {16fn testIntFloat() !void {
...@@ -26,7 +26,7 @@ fn testIntFloat() !void {...@@ -26,7 +26,7 @@ fn testIntFloat() !void {
2626
27test "type info: optional type info" {27test "type info: optional type info" {
28 try testOptional();28 try testOptional();
29 comptime try testOptional();29 try comptime testOptional();
30}30}
3131
32fn testOptional() !void {32fn testOptional() !void {
...@@ -37,7 +37,7 @@ fn testOptional() !void {...@@ -37,7 +37,7 @@ fn testOptional() !void {
3737
38test "type info: C pointer type info" {38test "type info: C pointer type info" {
39 try testCPtr();39 try testCPtr();
40 comptime try testCPtr();40 try comptime testCPtr();
41}41}
4242
43fn testCPtr() !void {43fn testCPtr() !void {
...@@ -60,7 +60,7 @@ test "type info: value is correctly copied" {...@@ -60,7 +60,7 @@ test "type info: value is correctly copied" {
6060
61test "type info: tag type, void info" {61test "type info: tag type, void info" {
62 try testBasic();62 try testBasic();
63 comptime try testBasic();63 try comptime testBasic();
64}64}
6565
66fn testBasic() !void {66fn testBasic() !void {
...@@ -72,7 +72,7 @@ fn testBasic() !void {...@@ -72,7 +72,7 @@ fn testBasic() !void {
7272
73test "type info: pointer type info" {73test "type info: pointer type info" {
74 try testPointer();74 try testPointer();
75 comptime try testPointer();75 try comptime testPointer();
76}76}
7777
78fn testPointer() !void {78fn testPointer() !void {
...@@ -88,7 +88,7 @@ fn testPointer() !void {...@@ -88,7 +88,7 @@ fn testPointer() !void {
8888
89test "type info: unknown length pointer type info" {89test "type info: unknown length pointer type info" {
90 try testUnknownLenPtr();90 try testUnknownLenPtr();
91 comptime try testUnknownLenPtr();91 try comptime testUnknownLenPtr();
92}92}
9393
94fn testUnknownLenPtr() !void {94fn testUnknownLenPtr() !void {
...@@ -104,7 +104,7 @@ fn testUnknownLenPtr() !void {...@@ -104,7 +104,7 @@ fn testUnknownLenPtr() !void {
104104
105test "type info: null terminated pointer type info" {105test "type info: null terminated pointer type info" {
106 try testNullTerminatedPtr();106 try testNullTerminatedPtr();
107 comptime try testNullTerminatedPtr();107 try comptime testNullTerminatedPtr();
108}108}
109109
110fn testNullTerminatedPtr() !void {110fn testNullTerminatedPtr() !void {
...@@ -120,7 +120,7 @@ fn testNullTerminatedPtr() !void {...@@ -120,7 +120,7 @@ fn testNullTerminatedPtr() !void {
120120
121test "type info: slice type info" {121test "type info: slice type info" {
122 try testSlice();122 try testSlice();
123 comptime try testSlice();123 try comptime testSlice();
124}124}
125125
126fn testSlice() !void {126fn testSlice() !void {
...@@ -135,7 +135,7 @@ fn testSlice() !void {...@@ -135,7 +135,7 @@ fn testSlice() !void {
135135
136test "type info: array type info" {136test "type info: array type info" {
137 try testArray();137 try testArray();
138 comptime try testArray();138 try comptime testArray();
139}139}
140140
141fn testArray() !void {141fn testArray() !void {
...@@ -163,7 +163,7 @@ test "type info: error set, error union info, anyerror" {...@@ -163,7 +163,7 @@ test "type info: error set, error union info, anyerror" {
163 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;163 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
164164
165 try testErrorSet();165 try testErrorSet();
166 comptime try testErrorSet();166 try comptime testErrorSet();
167}167}
168168
169fn testErrorSet() !void {169fn testErrorSet() !void {
...@@ -225,7 +225,7 @@ test "type info: enum info" {...@@ -225,7 +225,7 @@ test "type info: enum info" {
225 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;225 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
226226
227 try testEnum();227 try testEnum();
228 comptime try testEnum();228 try comptime testEnum();
229}229}
230230
231fn testEnum() !void {231fn testEnum() !void {
...@@ -247,7 +247,7 @@ fn testEnum() !void {...@@ -247,7 +247,7 @@ fn testEnum() !void {
247247
248test "type info: union info" {248test "type info: union info" {
249 try testUnion();249 try testUnion();
250 comptime try testUnion();250 try comptime testUnion();
251}251}
252252
253fn testUnion() !void {253fn testUnion() !void {
...@@ -257,7 +257,7 @@ fn testUnion() !void {...@@ -257,7 +257,7 @@ fn testUnion() !void {
257 try expect(typeinfo_info.Union.tag_type.? == TypeId);257 try expect(typeinfo_info.Union.tag_type.? == TypeId);
258 try expect(typeinfo_info.Union.fields.len == 24);258 try expect(typeinfo_info.Union.fields.len == 24);
259 try expect(typeinfo_info.Union.fields[4].type == @TypeOf(@typeInfo(u8).Int));259 try expect(typeinfo_info.Union.fields[4].type == @TypeOf(@typeInfo(u8).Int));
260 try expect(typeinfo_info.Union.decls.len == 22);260 try expect(typeinfo_info.Union.decls.len == 21);
261261
262 const TestNoTagUnion = union {262 const TestNoTagUnion = union {
263 Foo: void,263 Foo: void,
...@@ -287,7 +287,7 @@ test "type info: struct info" {...@@ -287,7 +287,7 @@ test "type info: struct info" {
287 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO287 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
288288
289 try testStruct();289 try testStruct();
290 comptime try testStruct();290 try comptime testStruct();
291}291}
292292
293fn testStruct() !void {293fn testStruct() !void {
...@@ -306,7 +306,7 @@ const TestStruct = struct {...@@ -306,7 +306,7 @@ const TestStruct = struct {
306306
307test "type info: packed struct info" {307test "type info: packed struct info" {
308 try testPackedStruct();308 try testPackedStruct();
309 comptime try testPackedStruct();309 try comptime testPackedStruct();
310}310}
311311
312fn testPackedStruct() !void {312fn testPackedStruct() !void {
...@@ -339,7 +339,7 @@ const TestPackedStruct = packed struct {...@@ -339,7 +339,7 @@ const TestPackedStruct = packed struct {
339339
340test "type info: opaque info" {340test "type info: opaque info" {
341 try testOpaque();341 try testOpaque();
342 comptime try testOpaque();342 try comptime testOpaque();
343}343}
344344
345fn testOpaque() !void {345fn testOpaque() !void {
...@@ -356,7 +356,7 @@ test "type info: function type info" {...@@ -356,7 +356,7 @@ test "type info: function type info" {
356 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;356 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
357357
358 try testFunction();358 try testFunction();
359 comptime try testFunction();359 try comptime testFunction();
360}360}
361361
362fn testFunction() !void {362fn testFunction() !void {
...@@ -427,7 +427,7 @@ test "typeInfo with comptime parameter in struct fn def" {...@@ -427,7 +427,7 @@ test "typeInfo with comptime parameter in struct fn def" {
427427
428test "type info: vectors" {428test "type info: vectors" {
429 try testVector();429 try testVector();
430 comptime try testVector();430 try comptime testVector();
431}431}
432432
433fn testVector() !void {433fn testVector() !void {
...@@ -444,7 +444,7 @@ test "type info: anyframe and anyframe->T" {...@@ -444,7 +444,7 @@ test "type info: anyframe and anyframe->T" {
444 }444 }
445445
446 try testAnyFrame();446 try testAnyFrame();
447 comptime try testAnyFrame();447 try comptime testAnyFrame();
448}448}
449449
450fn testAnyFrame() !void {450fn testAnyFrame() !void {
...@@ -489,7 +489,7 @@ test "@typeInfo does not force declarations into existence" {...@@ -489,7 +489,7 @@ test "@typeInfo does not force declarations into existence" {
489 @compileError("test failed");489 @compileError("test failed");
490 }490 }
491 };491 };
492 comptime try expect(@typeInfo(S).Struct.fields.len == 1);492 try comptime expect(@typeInfo(S).Struct.fields.len == 1);
493}493}
494494
495fn add(a: i32, b: i32) i32 {495fn add(a: i32, b: i32) i32 {
test/behavior/union.zig+28-28
...@@ -113,7 +113,7 @@ const ExternPtrOrInt = extern union {...@@ -113,7 +113,7 @@ const ExternPtrOrInt = extern union {
113 int: u64,113 int: u64,
114};114};
115test "extern union size" {115test "extern union size" {
116 comptime try expect(@sizeOf(ExternPtrOrInt) == 8);116 try comptime expect(@sizeOf(ExternPtrOrInt) == 8);
117}117}
118118
119test "0-sized extern union definition" {119test "0-sized extern union definition" {
...@@ -165,7 +165,7 @@ test "access a member of tagged union with conflicting enum tag name" {...@@ -165,7 +165,7 @@ test "access a member of tagged union with conflicting enum tag name" {
165 const B = void;165 const B = void;
166 };166 };
167167
168 comptime try expect(Bar.A == u8);168 try comptime expect(Bar.A == u8);
169}169}
170170
171test "constant tagged union with payload" {171test "constant tagged union with payload" {
...@@ -225,7 +225,7 @@ test "union with specified enum tag" {...@@ -225,7 +225,7 @@ test "union with specified enum tag" {
225 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;225 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
226226
227 try doTest();227 try doTest();
228 comptime try doTest();228 try comptime doTest();
229}229}
230230
231test "packed union generates correctly aligned type" {231test "packed union generates correctly aligned type" {
...@@ -274,7 +274,7 @@ test "comparison between union and enum literal" {...@@ -274,7 +274,7 @@ test "comparison between union and enum literal" {
274 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO274 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
275275
276 try testComparison();276 try testComparison();
277 comptime try testComparison();277 try comptime testComparison();
278}278}
279279
280const TheTag = enum { A, B, C };280const TheTag = enum { A, B, C };
...@@ -289,7 +289,7 @@ test "cast union to tag type of union" {...@@ -289,7 +289,7 @@ test "cast union to tag type of union" {
289 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO289 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
290290
291 try testCastUnionToTag();291 try testCastUnionToTag();
292 comptime try testCastUnionToTag();292 try comptime testCastUnionToTag();
293}293}
294294
295fn testCastUnionToTag() !void {295fn testCastUnionToTag() !void {
...@@ -372,14 +372,14 @@ const PackedPtrOrInt = packed union {...@@ -372,14 +372,14 @@ const PackedPtrOrInt = packed union {
372 int: u64,372 int: u64,
373};373};
374test "packed union size" {374test "packed union size" {
375 comptime try expect(@sizeOf(PackedPtrOrInt) == 8);375 try comptime expect(@sizeOf(PackedPtrOrInt) == 8);
376}376}
377377
378const ZeroBits = union {378const ZeroBits = union {
379 OnlyField: void,379 OnlyField: void,
380};380};
381test "union with only 1 field which is void should be zero bits" {381test "union with only 1 field which is void should be zero bits" {
382 comptime try expect(@sizeOf(ZeroBits) == 0);382 try comptime expect(@sizeOf(ZeroBits) == 0);
383}383}
384384
385test "tagged union initialization with runtime void" {385test "tagged union initialization with runtime void" {
...@@ -430,7 +430,7 @@ test "union with only 1 field casted to its enum type" {...@@ -430,7 +430,7 @@ test "union with only 1 field casted to its enum type" {
430430
431 var e = Expr{ .Literal = Literal{ .Bool = true } };431 var e = Expr{ .Literal = Literal{ .Bool = true } };
432 const ExprTag = Tag(Expr);432 const ExprTag = Tag(Expr);
433 comptime try expect(Tag(ExprTag) == u0);433 try comptime expect(Tag(ExprTag) == u0);
434 var t = @as(ExprTag, e);434 var t = @as(ExprTag, e);
435 try expect(t == Expr.Literal);435 try expect(t == Expr.Literal);
436}436}
...@@ -439,7 +439,7 @@ test "union with one member defaults to u0 tag type" {...@@ -439,7 +439,7 @@ test "union with one member defaults to u0 tag type" {
439 const U0 = union(enum) {439 const U0 = union(enum) {
440 X: u32,440 X: u32,
441 };441 };
442 comptime try expect(Tag(Tag(U0)) == u0);442 try comptime expect(Tag(Tag(U0)) == u0);
443}443}
444444
445const Foo1 = union(enum) {445const Foo1 = union(enum) {
...@@ -547,7 +547,7 @@ test "method call on an empty union" {...@@ -547,7 +547,7 @@ test "method call on an empty union" {
547 }547 }
548 };548 };
549 try S.doTheTest();549 try S.doTheTest();
550 comptime try S.doTheTest();550 try comptime S.doTheTest();
551}551}
552552
553const Point = struct {553const Point = struct {
...@@ -628,7 +628,7 @@ test "tagged union with all void fields but a meaningful tag" {...@@ -628,7 +628,7 @@ test "tagged union with all void fields but a meaningful tag" {
628 }628 }
629 };629 };
630 try S.doTheTest();630 try S.doTheTest();
631 comptime try S.doTheTest();631 try comptime S.doTheTest();
632}632}
633633
634test "union(enum(u32)) with specified and unspecified tag values" {634test "union(enum(u32)) with specified and unspecified tag values" {
...@@ -637,9 +637,9 @@ test "union(enum(u32)) with specified and unspecified tag values" {...@@ -637,9 +637,9 @@ test "union(enum(u32)) with specified and unspecified tag values" {
637 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO637 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
638 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;638 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
639639
640 comptime try expect(Tag(Tag(MultipleChoice2)) == u32);640 try comptime expect(Tag(Tag(MultipleChoice2)) == u32);
641 try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2{ .C = 123 });641 try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2{ .C = 123 });
642 comptime try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2{ .C = 123 });642 try comptime testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2{ .C = 123 });
643}643}
644644
645const MultipleChoice2 = union(enum(u32)) {645const MultipleChoice2 = union(enum(u32)) {
...@@ -718,11 +718,11 @@ test "union with only 1 field casted to its enum type which has enum value speci...@@ -718,11 +718,11 @@ test "union with only 1 field casted to its enum type which has enum value speci
718 };718 };
719719
720 var e = Expr{ .Literal = Literal{ .Bool = true } };720 var e = Expr{ .Literal = Literal{ .Bool = true } };
721 comptime try expect(Tag(ExprTag) == comptime_int);721 try comptime expect(Tag(ExprTag) == comptime_int);
722 comptime var t = @as(ExprTag, e);722 comptime var t = @as(ExprTag, e);
723 try expect(t == Expr.Literal);723 try expect(t == Expr.Literal);
724 try expect(@enumToInt(t) == 33);724 try expect(@enumToInt(t) == 33);
725 comptime try expect(@enumToInt(t) == 33);725 try comptime expect(@enumToInt(t) == 33);
726}726}
727727
728test "@enumToInt works on unions" {728test "@enumToInt works on unions" {
...@@ -805,7 +805,7 @@ test "return union init with void payload" {...@@ -805,7 +805,7 @@ test "return union init with void payload" {
805 }805 }
806 };806 };
807 try S.entry();807 try S.entry();
808 comptime try S.entry();808 try comptime S.entry();
809}809}
810810
811test "@unionInit stored to a const" {811test "@unionInit stored to a const" {
...@@ -833,7 +833,7 @@ test "@unionInit stored to a const" {...@@ -833,7 +833,7 @@ test "@unionInit stored to a const" {
833 }833 }
834 };834 };
835835
836 comptime try S.doTheTest();836 try comptime S.doTheTest();
837 try S.doTheTest();837 try S.doTheTest();
838}838}
839839
...@@ -905,7 +905,7 @@ test "union with comptime_int tag" {...@@ -905,7 +905,7 @@ test "union with comptime_int tag" {
905 Y: u16,905 Y: u16,
906 Z: u8,906 Z: u8,
907 };907 };
908 comptime try expect(Tag(Tag(Union)) == comptime_int);908 try comptime expect(Tag(Tag(Union)) == comptime_int);
909}909}
910910
911test "extern union doesn't trigger field check at comptime" {911test "extern union doesn't trigger field check at comptime" {
...@@ -915,7 +915,7 @@ test "extern union doesn't trigger field check at comptime" {...@@ -915,7 +915,7 @@ test "extern union doesn't trigger field check at comptime" {
915 };915 };
916916
917 const x = U{ .x = 0x55AAAA55 };917 const x = U{ .x = 0x55AAAA55 };
918 comptime try expect(x.y == 0x55);918 try comptime expect(x.y == 0x55);
919}919}
920920
921test "anonymous union literal syntax" {921test "anonymous union literal syntax" {
...@@ -942,7 +942,7 @@ test "anonymous union literal syntax" {...@@ -942,7 +942,7 @@ test "anonymous union literal syntax" {
942 }942 }
943 };943 };
944 try S.doTheTest();944 try S.doTheTest();
945 comptime try S.doTheTest();945 try comptime S.doTheTest();
946}946}
947947
948test "function call result coerces from tagged union to the tag" {948test "function call result coerces from tagged union to the tag" {
...@@ -975,7 +975,7 @@ test "function call result coerces from tagged union to the tag" {...@@ -975,7 +975,7 @@ test "function call result coerces from tagged union to the tag" {
975 }975 }
976 };976 };
977 try S.doTheTest();977 try S.doTheTest();
978 comptime try S.doTheTest();978 try comptime S.doTheTest();
979}979}
980980
981test "cast from anonymous struct to union" {981test "cast from anonymous struct to union" {
...@@ -1007,7 +1007,7 @@ test "cast from anonymous struct to union" {...@@ -1007,7 +1007,7 @@ test "cast from anonymous struct to union" {
1007 }1007 }
1008 };1008 };
1009 try S.doTheTest();1009 try S.doTheTest();
1010 comptime try S.doTheTest();1010 try comptime S.doTheTest();
1011}1011}
10121012
1013test "cast from pointer to anonymous struct to pointer to union" {1013test "cast from pointer to anonymous struct to pointer to union" {
...@@ -1039,7 +1039,7 @@ test "cast from pointer to anonymous struct to pointer to union" {...@@ -1039,7 +1039,7 @@ test "cast from pointer to anonymous struct to pointer to union" {
1039 }1039 }
1040 };1040 };
1041 try S.doTheTest();1041 try S.doTheTest();
1042 comptime try S.doTheTest();1042 try comptime S.doTheTest();
1043}1043}
10441044
1045test "switching on non exhaustive union" {1045test "switching on non exhaustive union" {
...@@ -1067,7 +1067,7 @@ test "switching on non exhaustive union" {...@@ -1067,7 +1067,7 @@ test "switching on non exhaustive union" {
1067 }1067 }
1068 };1068 };
1069 try S.doTheTest();1069 try S.doTheTest();
1070 comptime try S.doTheTest();1070 try comptime S.doTheTest();
1071}1071}
10721072
1073test "containers with single-field enums" {1073test "containers with single-field enums" {
...@@ -1096,7 +1096,7 @@ test "containers with single-field enums" {...@@ -1096,7 +1096,7 @@ test "containers with single-field enums" {
1096 };1096 };
10971097
1098 try S.doTheTest();1098 try S.doTheTest();
1099 comptime try S.doTheTest();1099 try comptime S.doTheTest();
1100}1100}
11011101
1102test "@unionInit on union with tag but no fields" {1102test "@unionInit on union with tag but no fields" {
...@@ -1130,7 +1130,7 @@ test "@unionInit on union with tag but no fields" {...@@ -1130,7 +1130,7 @@ test "@unionInit on union with tag but no fields" {
1130 };1130 };
11311131
1132 try S.doTheTest();1132 try S.doTheTest();
1133 comptime try S.doTheTest();1133 try comptime S.doTheTest();
1134}1134}
11351135
1136test "union enum type gets a separate scope" {1136test "union enum type gets a separate scope" {
...@@ -1552,7 +1552,7 @@ test "reinterpreting enum value inside packed union" {...@@ -1552,7 +1552,7 @@ test "reinterpreting enum value inside packed union" {
1552 }1552 }
1553 };1553 };
1554 try U.doTest();1554 try U.doTest();
1555 comptime try U.doTest();1555 try comptime U.doTest();
1556}1556}
15571557
1558test "access the tag of a global tagged union" {1558test "access the tag of a global tagged union" {
...@@ -1581,5 +1581,5 @@ test "coerce enum literal to union in result loc" {...@@ -1581,5 +1581,5 @@ test "coerce enum literal to union in result loc" {
1581 }1581 }
1582 };1582 };
1583 try U.doTest(true);1583 try U.doTest(true);
1584 comptime try U.doTest(true);1584 try comptime U.doTest(true);
1585}1585}
test/behavior/usingnamespace.zig+1-1
...@@ -32,7 +32,7 @@ usingnamespace struct {...@@ -32,7 +32,7 @@ usingnamespace struct {
32};32};
3333
34test "usingnamespace does not redeclare an imported variable" {34test "usingnamespace does not redeclare an imported variable" {
35 comptime try std.testing.expect(@This().foo == 42);35 try comptime std.testing.expect(@This().foo == 42);
36}36}
3737
38usingnamespace @import("usingnamespace/foo.zig");38usingnamespace @import("usingnamespace/foo.zig");
test/behavior/vector.zig+34-34
...@@ -21,7 +21,7 @@ test "implicit cast vector to array - bool" {...@@ -21,7 +21,7 @@ test "implicit cast vector to array - bool" {
21 }21 }
22 };22 };
23 try S.doTheTest();23 try S.doTheTest();
24 comptime try S.doTheTest();24 try comptime S.doTheTest();
25}25}
2626
27test "vector wrap operators" {27test "vector wrap operators" {
...@@ -45,7 +45,7 @@ test "vector wrap operators" {...@@ -45,7 +45,7 @@ test "vector wrap operators" {
45 }45 }
46 };46 };
47 try S.doTheTest();47 try S.doTheTest();
48 comptime try S.doTheTest();48 try comptime S.doTheTest();
49}49}
5050
51test "vector bin compares with mem.eql" {51test "vector bin compares with mem.eql" {
...@@ -69,7 +69,7 @@ test "vector bin compares with mem.eql" {...@@ -69,7 +69,7 @@ test "vector bin compares with mem.eql" {
69 }69 }
70 };70 };
71 try S.doTheTest();71 try S.doTheTest();
72 comptime try S.doTheTest();72 try comptime S.doTheTest();
73}73}
7474
75test "vector int operators" {75test "vector int operators" {
...@@ -91,7 +91,7 @@ test "vector int operators" {...@@ -91,7 +91,7 @@ test "vector int operators" {
91 }91 }
92 };92 };
93 try S.doTheTest();93 try S.doTheTest();
94 comptime try S.doTheTest();94 try comptime S.doTheTest();
95}95}
9696
97test "vector float operators" {97test "vector float operators" {
...@@ -114,7 +114,7 @@ test "vector float operators" {...@@ -114,7 +114,7 @@ test "vector float operators" {
114 }114 }
115 };115 };
116 try S.doTheTest();116 try S.doTheTest();
117 comptime try S.doTheTest();117 try comptime S.doTheTest();
118 }118 }
119}119}
120120
...@@ -135,7 +135,7 @@ test "vector bit operators" {...@@ -135,7 +135,7 @@ test "vector bit operators" {
135 }135 }
136 };136 };
137 try S.doTheTest();137 try S.doTheTest();
138 comptime try S.doTheTest();138 try comptime S.doTheTest();
139}139}
140140
141test "implicit cast vector to array" {141test "implicit cast vector to array" {
...@@ -153,7 +153,7 @@ test "implicit cast vector to array" {...@@ -153,7 +153,7 @@ test "implicit cast vector to array" {
153 }153 }
154 };154 };
155 try S.doTheTest();155 try S.doTheTest();
156 comptime try S.doTheTest();156 try comptime S.doTheTest();
157}157}
158158
159test "array to vector" {159test "array to vector" {
...@@ -171,7 +171,7 @@ test "array to vector" {...@@ -171,7 +171,7 @@ test "array to vector" {
171 }171 }
172 };172 };
173 try S.doTheTest();173 try S.doTheTest();
174 comptime try S.doTheTest();174 try comptime S.doTheTest();
175}175}
176176
177test "array to vector with element type coercion" {177test "array to vector with element type coercion" {
...@@ -192,7 +192,7 @@ test "array to vector with element type coercion" {...@@ -192,7 +192,7 @@ test "array to vector with element type coercion" {
192 }192 }
193 };193 };
194 try S.doTheTest();194 try S.doTheTest();
195 comptime try S.doTheTest();195 try comptime S.doTheTest();
196}196}
197197
198test "peer type resolution with coercible element types" {198test "peer type resolution with coercible element types" {
...@@ -212,7 +212,7 @@ test "peer type resolution with coercible element types" {...@@ -212,7 +212,7 @@ test "peer type resolution with coercible element types" {
212 try std.testing.expect(@TypeOf(c) == @Vector(2, u16));212 try std.testing.expect(@TypeOf(c) == @Vector(2, u16));
213 }213 }
214 };214 };
215 comptime try S.doTheTest();215 try comptime S.doTheTest();
216}216}
217217
218test "tuple to vector" {218test "tuple to vector" {
...@@ -242,7 +242,7 @@ test "tuple to vector" {...@@ -242,7 +242,7 @@ test "tuple to vector" {
242 }242 }
243 };243 };
244 try S.doTheTest();244 try S.doTheTest();
245 comptime try S.doTheTest();245 try comptime S.doTheTest();
246}246}
247247
248test "vector casts of sizes not divisible by 8" {248test "vector casts of sizes not divisible by 8" {
...@@ -278,7 +278,7 @@ test "vector casts of sizes not divisible by 8" {...@@ -278,7 +278,7 @@ test "vector casts of sizes not divisible by 8" {
278 }278 }
279 };279 };
280 try S.doTheTest();280 try S.doTheTest();
281 comptime try S.doTheTest();281 try comptime S.doTheTest();
282}282}
283283
284test "vector @splat" {284test "vector @splat" {
...@@ -326,7 +326,7 @@ test "vector @splat" {...@@ -326,7 +326,7 @@ test "vector @splat" {
326 }326 }
327 };327 };
328 try S.doTheTest();328 try S.doTheTest();
329 comptime try S.doTheTest();329 try comptime S.doTheTest();
330}330}
331331
332test "load vector elements via comptime index" {332test "load vector elements via comptime index" {
...@@ -348,7 +348,7 @@ test "load vector elements via comptime index" {...@@ -348,7 +348,7 @@ test "load vector elements via comptime index" {
348 };348 };
349349
350 try S.doTheTest();350 try S.doTheTest();
351 comptime try S.doTheTest();351 try comptime S.doTheTest();
352}352}
353353
354test "store vector elements via comptime index" {354test "store vector elements via comptime index" {
...@@ -376,7 +376,7 @@ test "store vector elements via comptime index" {...@@ -376,7 +376,7 @@ test "store vector elements via comptime index" {
376 };376 };
377377
378 try S.doTheTest();378 try S.doTheTest();
379 comptime try S.doTheTest();379 try comptime S.doTheTest();
380}380}
381381
382test "load vector elements via runtime index" {382test "load vector elements via runtime index" {
...@@ -398,7 +398,7 @@ test "load vector elements via runtime index" {...@@ -398,7 +398,7 @@ test "load vector elements via runtime index" {
398 };398 };
399399
400 try S.doTheTest();400 try S.doTheTest();
401 comptime try S.doTheTest();401 try comptime S.doTheTest();
402}402}
403403
404test "store vector elements via runtime index" {404test "store vector elements via runtime index" {
...@@ -421,7 +421,7 @@ test "store vector elements via runtime index" {...@@ -421,7 +421,7 @@ test "store vector elements via runtime index" {
421 };421 };
422422
423 try S.doTheTest();423 try S.doTheTest();
424 comptime try S.doTheTest();424 try comptime S.doTheTest();
425}425}
426426
427test "initialize vector which is a struct field" {427test "initialize vector which is a struct field" {
...@@ -443,7 +443,7 @@ test "initialize vector which is a struct field" {...@@ -443,7 +443,7 @@ test "initialize vector which is a struct field" {
443 }443 }
444 };444 };
445 try S.doTheTest();445 try S.doTheTest();
446 comptime try S.doTheTest();446 try comptime S.doTheTest();
447}447}
448448
449test "vector comparison operators" {449test "vector comparison operators" {
...@@ -484,7 +484,7 @@ test "vector comparison operators" {...@@ -484,7 +484,7 @@ test "vector comparison operators" {
484 }484 }
485 };485 };
486 try S.doTheTest();486 try S.doTheTest();
487 comptime try S.doTheTest();487 try comptime S.doTheTest();
488}488}
489489
490test "vector division operators" {490test "vector division operators" {
...@@ -567,7 +567,7 @@ test "vector division operators" {...@@ -567,7 +567,7 @@ test "vector division operators" {
567 };567 };
568568
569 try S.doTheTest();569 try S.doTheTest();
570 comptime try S.doTheTest();570 try comptime S.doTheTest();
571}571}
572572
573test "vector bitwise not operator" {573test "vector bitwise not operator" {
...@@ -599,7 +599,7 @@ test "vector bitwise not operator" {...@@ -599,7 +599,7 @@ test "vector bitwise not operator" {
599 };599 };
600600
601 try S.doTheTest();601 try S.doTheTest();
602 comptime try S.doTheTest();602 try comptime S.doTheTest();
603}603}
604604
605test "vector shift operators" {605test "vector shift operators" {
...@@ -693,7 +693,7 @@ test "vector shift operators" {...@@ -693,7 +693,7 @@ test "vector shift operators" {
693 }693 }
694694
695 try S.doTheTest();695 try S.doTheTest();
696 comptime try S.doTheTest();696 try comptime S.doTheTest();
697}697}
698698
699test "vector reduce operation" {699test "vector reduce operation" {
...@@ -837,7 +837,7 @@ test "vector reduce operation" {...@@ -837,7 +837,7 @@ test "vector reduce operation" {
837 };837 };
838838
839 try S.doTheTest();839 try S.doTheTest();
840 comptime try S.doTheTest();840 try comptime S.doTheTest();
841}841}
842842
843test "vector @reduce comptime" {843test "vector @reduce comptime" {
...@@ -849,9 +849,9 @@ test "vector @reduce comptime" {...@@ -849,9 +849,9 @@ test "vector @reduce comptime" {
849 const value = @Vector(4, i32){ 1, -1, 1, -1 };849 const value = @Vector(4, i32){ 1, -1, 1, -1 };
850 const result = value > @splat(4, @as(i32, 0));850 const result = value > @splat(4, @as(i32, 0));
851 // result is { true, false, true, false };851 // result is { true, false, true, false };
852 comptime try expect(@TypeOf(result) == @Vector(4, bool));852 try comptime expect(@TypeOf(result) == @Vector(4, bool));
853 const is_all_true = @reduce(.And, result);853 const is_all_true = @reduce(.And, result);
854 comptime try expect(@TypeOf(is_all_true) == bool);854 try comptime expect(@TypeOf(is_all_true) == bool);
855 try expect(is_all_true == false);855 try expect(is_all_true == false);
856}856}
857857
...@@ -903,7 +903,7 @@ test "saturating add" {...@@ -903,7 +903,7 @@ test "saturating add" {
903 }903 }
904 };904 };
905 try S.doTheTest();905 try S.doTheTest();
906 comptime try S.doTheTest();906 try comptime S.doTheTest();
907}907}
908908
909test "saturating subtraction" {909test "saturating subtraction" {
...@@ -926,7 +926,7 @@ test "saturating subtraction" {...@@ -926,7 +926,7 @@ test "saturating subtraction" {
926 }926 }
927 };927 };
928 try S.doTheTest();928 try S.doTheTest();
929 comptime try S.doTheTest();929 try comptime S.doTheTest();
930}930}
931931
932test "saturating multiplication" {932test "saturating multiplication" {
...@@ -953,7 +953,7 @@ test "saturating multiplication" {...@@ -953,7 +953,7 @@ test "saturating multiplication" {
953 };953 };
954954
955 try S.doTheTest();955 try S.doTheTest();
956 comptime try S.doTheTest();956 try comptime S.doTheTest();
957}957}
958958
959test "saturating shift-left" {959test "saturating shift-left" {
...@@ -976,7 +976,7 @@ test "saturating shift-left" {...@@ -976,7 +976,7 @@ test "saturating shift-left" {
976 }976 }
977 };977 };
978 try S.doTheTest();978 try S.doTheTest();
979 comptime try S.doTheTest();979 try comptime S.doTheTest();
980}980}
981981
982test "multiplication-assignment operator with an array operand" {982test "multiplication-assignment operator with an array operand" {
...@@ -997,7 +997,7 @@ test "multiplication-assignment operator with an array operand" {...@@ -997,7 +997,7 @@ test "multiplication-assignment operator with an array operand" {
997 }997 }
998 };998 };
999 try S.doTheTest();999 try S.doTheTest();
1000 comptime try S.doTheTest();1000 try comptime S.doTheTest();
1001}1001}
10021002
1003test "@addWithOverflow" {1003test "@addWithOverflow" {
...@@ -1041,7 +1041,7 @@ test "@addWithOverflow" {...@@ -1041,7 +1041,7 @@ test "@addWithOverflow" {
1041 }1041 }
1042 };1042 };
1043 try S.doTheTest();1043 try S.doTheTest();
1044 comptime try S.doTheTest();1044 try comptime S.doTheTest();
1045}1045}
10461046
1047test "@subWithOverflow" {1047test "@subWithOverflow" {
...@@ -1071,7 +1071,7 @@ test "@subWithOverflow" {...@@ -1071,7 +1071,7 @@ test "@subWithOverflow" {
1071 }1071 }
1072 };1072 };
1073 try S.doTheTest();1073 try S.doTheTest();
1074 comptime try S.doTheTest();1074 try comptime S.doTheTest();
1075}1075}
10761076
1077test "@mulWithOverflow" {1077test "@mulWithOverflow" {
...@@ -1092,7 +1092,7 @@ test "@mulWithOverflow" {...@@ -1092,7 +1092,7 @@ test "@mulWithOverflow" {
1092 }1092 }
1093 };1093 };
1094 try S.doTheTest();1094 try S.doTheTest();
1095 comptime try S.doTheTest();1095 try comptime S.doTheTest();
1096}1096}
10971097
1098test "@shlWithOverflow" {1098test "@shlWithOverflow" {
...@@ -1113,7 +1113,7 @@ test "@shlWithOverflow" {...@@ -1113,7 +1113,7 @@ test "@shlWithOverflow" {
1113 }1113 }
1114 };1114 };
1115 try S.doTheTest();1115 try S.doTheTest();
1116 comptime try S.doTheTest();1116 try comptime S.doTheTest();
1117}1117}
11181118
1119test "alignment of vectors" {1119test "alignment of vectors" {
test/behavior/while.zig+4-4
...@@ -122,7 +122,7 @@ test "while copies its payload" {...@@ -122,7 +122,7 @@ test "while copies its payload" {
122 }122 }
123 };123 };
124 try S.doTheTest();124 try S.doTheTest();
125 comptime try S.doTheTest();125 try comptime S.doTheTest();
126}126}
127127
128test "continue and break" {128test "continue and break" {
...@@ -293,7 +293,7 @@ test "while bool 2 break statements and an else" {...@@ -293,7 +293,7 @@ test "while bool 2 break statements and an else" {
293 }293 }
294 };294 };
295 try S.entry(true, false);295 try S.entry(true, false);
296 comptime try S.entry(true, false);296 try comptime S.entry(true, false);
297}297}
298298
299test "while optional 2 break statements and an else" {299test "while optional 2 break statements and an else" {
...@@ -312,7 +312,7 @@ test "while optional 2 break statements and an else" {...@@ -312,7 +312,7 @@ test "while optional 2 break statements and an else" {
312 }312 }
313 };313 };
314 try S.entry(true, false);314 try S.entry(true, false);
315 comptime try S.entry(true, false);315 try comptime S.entry(true, false);
316}316}
317317
318test "while error 2 break statements and an else" {318test "while error 2 break statements and an else" {
...@@ -332,7 +332,7 @@ test "while error 2 break statements and an else" {...@@ -332,7 +332,7 @@ test "while error 2 break statements and an else" {
332 }332 }
333 };333 };
334 try S.entry(true, false);334 try S.entry(true, false);
335 comptime try S.entry(true, false);335 try comptime S.entry(true, false);
336}336}
337337
338test "continue inline while loop" {338test "continue inline while loop" {
test/behavior/wrapping_arithmetic.zig+15-15
...@@ -31,12 +31,12 @@ test "wrapping add" {...@@ -31,12 +31,12 @@ test "wrapping add" {
31 };31 };
3232
33 try S.doTheTest();33 try S.doTheTest();
34 comptime try S.doTheTest();34 try comptime S.doTheTest();
3535
36 comptime try S.testWrapAdd(comptime_int, 0, 0, 0);36 try comptime S.testWrapAdd(comptime_int, 0, 0, 0);
37 comptime try S.testWrapAdd(comptime_int, 3, 2, 5);37 try comptime S.testWrapAdd(comptime_int, 3, 2, 5);
38 comptime try S.testWrapAdd(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 1119305249183743626545271163355074748512);38 try comptime S.testWrapAdd(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 1119305249183743626545271163355074748512);
39 comptime try S.testWrapAdd(comptime_int, 7, -593423721213448152027139550640105366508, -593423721213448152027139550640105366501);39 try comptime S.testWrapAdd(comptime_int, 7, -593423721213448152027139550640105366508, -593423721213448152027139550640105366501);
40}40}
4141
42test "wrapping subtraction" {42test "wrapping subtraction" {
...@@ -64,12 +64,12 @@ test "wrapping subtraction" {...@@ -64,12 +64,12 @@ test "wrapping subtraction" {
64 };64 };
6565
66 try S.doTheTest();66 try S.doTheTest();
67 comptime try S.doTheTest();67 try comptime S.doTheTest();
6868
69 comptime try S.testWrapSub(comptime_int, 0, 0, 0);69 try comptime S.testWrapSub(comptime_int, 0, 0, 0);
70 comptime try S.testWrapSub(comptime_int, 3, 2, 1);70 try comptime S.testWrapSub(comptime_int, 3, 2, 1);
71 comptime try S.testWrapSub(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 182846383813587550256162760261375991602);71 try comptime S.testWrapSub(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 182846383813587550256162760261375991602);
72 comptime try S.testWrapSub(comptime_int, 7, -593423721213448152027139550640105366508, 593423721213448152027139550640105366515);72 try comptime S.testWrapSub(comptime_int, 7, -593423721213448152027139550640105366508, 593423721213448152027139550640105366515);
73}73}
7474
75test "wrapping multiplication" {75test "wrapping multiplication" {
...@@ -101,10 +101,10 @@ test "wrapping multiplication" {...@@ -101,10 +101,10 @@ test "wrapping multiplication" {
101 };101 };
102102
103 try S.doTheTest();103 try S.doTheTest();
104 comptime try S.doTheTest();104 try comptime S.doTheTest();
105105
106 comptime try S.testWrapMul(comptime_int, 0, 0, 0);106 try comptime S.testWrapMul(comptime_int, 0, 0, 0);
107 comptime try S.testWrapMul(comptime_int, 3, 2, 6);107 try comptime S.testWrapMul(comptime_int, 3, 2, 6);
108 comptime try S.testWrapMul(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 304852860194144160265083087140337419215516305999637969803722975979232817921935);108 try comptime S.testWrapMul(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 304852860194144160265083087140337419215516305999637969803722975979232817921935);
109 comptime try S.testWrapMul(comptime_int, 7, -593423721213448152027139550640105366508, -4153966048494137064189976854480737565556);109 try comptime S.testWrapMul(comptime_int, 7, -593423721213448152027139550640105366508, -4153966048494137064189976854480737565556);
110}110}
test/cases/compile_errors/Issue_5586_Make_unary_minus_for_unsigned_types_a_compile_error.zig+2-3
...@@ -2,8 +2,7 @@ export fn f1(x: u32) u32 {...@@ -2,8 +2,7 @@ export fn f1(x: u32) u32 {
2 const y = -%x;2 const y = -%x;
3 return -y;3 return -y;
4}4}
5const V = @import("std").meta.Vector;5export fn f2(x: @Vector(4, u32)) @Vector(4, u32) {
6export fn f2(x: V(4, u32)) V(4, u32) {
7 const y = -%x;6 const y = -%x;
8 return -y;7 return -y;
9}8}
...@@ -13,4 +12,4 @@ export fn f2(x: V(4, u32)) V(4, u32) {...@@ -13,4 +12,4 @@ export fn f2(x: V(4, u32)) V(4, u32) {
13// target=native12// target=native
14//13//
15// :3:12: error: negation of type 'u32'14// :3:12: error: negation of type 'u32'
16// :8:12: error: negation of type '@Vector(4, u32)'15// :7:12: error: negation of type '@Vector(4, u32)'
test/cases/compile_errors/comptime_vector_overflow_shows_the_index.zig+2-2
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1comptime {1comptime {
2 var a: @import("std").meta.Vector(4, u8) = [_]u8{ 1, 2, 255, 4 };2 var a: @Vector(4, u8) = [_]u8{ 1, 2, 255, 4 };
3 var b: @import("std").meta.Vector(4, u8) = [_]u8{ 5, 6, 1, 8 };3 var b: @Vector(4, u8) = [_]u8{ 5, 6, 1, 8 };
4 var x = a + b;4 var x = a + b;
5 _ = x;5 _ = x;
6}6}
test/cases/compile_errors/nested_vectors.zig+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1export fn entry() void {1export fn entry() void {
2 const V1 = @import("std").meta.Vector(4, u8);2 const V1 = @Vector(4, u8);
3 const V2 = @Type(.{ .Vector = .{ .len = 4, .child = V1 } });3 const V2 = @Type(.{ .Vector = .{ .len = 4, .child = V1 } });
4 var v: V2 = undefined;4 var v: V2 = undefined;
5 _ = v;5 _ = v;
test/cases/compile_errors/shuffle_with_selected_index_past_first_vector_length.zig+2-2
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1export fn entry() void {1export fn entry() void {
2 const v: @import("std").meta.Vector(4, u32) = [4]u32{ 10, 11, 12, 13 };2 const v: @Vector(4, u32) = [4]u32{ 10, 11, 12, 13 };
3 const x: @import("std").meta.Vector(4, u32) = [4]u32{ 14, 15, 16, 17 };3 const x: @Vector(4, u32) = [4]u32{ 14, 15, 16, 17 };
4 var z = @shuffle(u32, v, x, [8]i32{ 0, 1, 2, 3, 7, 6, 5, 4 });4 var z = @shuffle(u32, v, x, [8]i32{ 0, 1, 2, 3, 7, 6, 5, 4 });
5 _ = z;5 _ = z;
6}6}
test/cases/compile_errors/vector_index_out_of_bounds.zig+2-2
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1export fn entry() void {1export fn entry() void {
2 const x = @import("std").meta.Vector(3, f32){ 25, 75, 5, 0 };2 const x = @Vector(3, f32){ 25, 75, 5, 0 };
3 _ = x;3 _ = x;
4}4}
55
...@@ -7,4 +7,4 @@ export fn entry() void {...@@ -7,4 +7,4 @@ export fn entry() void {
7// backend=stage27// backend=stage2
8// target=native8// target=native
9//9//
10// :2:49: error: expected 3 vector elements; found 410// :2:30: error: expected 3 vector elements; found 4
test/standalone/issue_794/main.zig+1-1
...@@ -3,5 +3,5 @@ const std = @import("std");...@@ -3,5 +3,5 @@ const std = @import("std");
3const testing = std.testing;3const testing = std.testing;
44
5test "c import" {5test "c import" {
6 comptime try testing.expect(c.NUMBER == 1234);6 try comptime testing.expect(c.NUMBER == 1234);
7}7}