| author | |
| committer | |
| log | 38fc826a5a82bbe11a893be11d3cc1439c477ee8 |
| tree | a6f1d07274887a20818b8e9f0798f1f74c318de5 |
| parent | 700ea694b293565ececb7571e4d9613d2c143ca6 |
| parent | d884d7050e061c620324aaaabfba507e08cb40f4 |
| signature |
std.*: remove stuff that was deprecated in older versions83 files changed, 1091 insertions(+), 1045 deletions(-)
doc/langref.html.in+11-11| ... | ... | @@ -3306,7 +3306,7 @@ const Divided = packed struct { |
| 3306 | 3306 | |
| 3307 | 3307 | test "@bitCast between packed structs" { |
| 3308 | 3308 | try doTheTest(); |
| 3309 | comptime try doTheTest(); | |
| 3309 | try comptime doTheTest(); | |
| 3310 | 3310 | } |
| 3311 | 3311 | |
| 3312 | 3312 | fn doTheTest() !void { |
| ... | ... | @@ -5815,10 +5815,10 @@ test "error union" { |
| 5815 | 5815 | foo = error.SomeError; |
| 5816 | 5816 | |
| 5817 | 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); | |
| 5819 | 5819 | |
| 5820 | 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 | 5823 | {#code_end#} |
| 5824 | 5824 | {#header_open|Merging Error Sets#} |
| ... | ... | @@ -6199,7 +6199,7 @@ test "optional type" { |
| 6199 | 6199 | foo = 1234; |
| 6200 | 6200 | |
| 6201 | 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 | 6204 | {#code_end#} |
| 6205 | 6205 | {#header_close#} |
| ... | ... | @@ -6632,8 +6632,8 @@ test "peer resolve int widening" { |
| 6632 | 6632 | test "peer resolve arrays of different size to const slice" { |
| 6633 | 6633 | try expect(mem.eql(u8, boolToStr(true), "true")); |
| 6634 | 6634 | try expect(mem.eql(u8, boolToStr(false), "false")); |
| 6635 | comptime try expect(mem.eql(u8, boolToStr(true), "true")); | |
| 6636 | comptime try expect(mem.eql(u8, boolToStr(false), "false")); | |
| 6635 | try comptime expect(mem.eql(u8, boolToStr(true), "true")); | |
| 6636 | try comptime expect(mem.eql(u8, boolToStr(false), "false")); | |
| 6637 | 6637 | } |
| 6638 | 6638 | fn boolToStr(b: bool) []const u8 { |
| 6639 | 6639 | return if (b) "true" else "false"; |
| ... | ... | @@ -6641,7 +6641,7 @@ fn boolToStr(b: bool) []const u8 { |
| 6641 | 6641 | |
| 6642 | 6642 | test "peer resolve array and const slice" { |
| 6643 | 6643 | try testPeerResolveArrayConstSlice(true); |
| 6644 | comptime try testPeerResolveArrayConstSlice(true); | |
| 6644 | try comptime testPeerResolveArrayConstSlice(true); | |
| 6645 | 6645 | } |
| 6646 | 6646 | fn testPeerResolveArrayConstSlice(b: bool) !void { |
| 6647 | 6647 | const value1 = if (b) "aoeu" else @as([]const u8, "zz"); |
| ... | ... | @@ -9184,7 +9184,7 @@ const expect = std.testing.expect; |
| 9184 | 9184 | test "vector @splat" { |
| 9185 | 9185 | const scalar: u32 = 5; |
| 9186 | 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 | 9188 | try expect(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 })); |
| 9189 | 9189 | } |
| 9190 | 9190 | {#code_end#} |
| ... | ... | @@ -9228,9 +9228,9 @@ test "vector @reduce" { |
| 9228 | 9228 | const value = @Vector(4, i32){ 1, -1, 1, -1 }; |
| 9229 | 9229 | const result = value > @splat(4, @as(i32, 0)); |
| 9230 | 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 | 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 | 9234 | try expect(is_all_true == false); |
| 9235 | 9235 | } |
| 9236 | 9236 | {#code_end#} |
| ... | ... | @@ -9571,7 +9571,7 @@ const expect = std.testing.expect; |
| 9571 | 9571 | test "no runtime side effects" { |
| 9572 | 9572 | var data: i32 = 0; |
| 9573 | 9573 | const T = @TypeOf(foo(i32, &data)); |
| 9574 | comptime try expect(T == i32); | |
| 9574 | try comptime expect(T == i32); | |
| 9575 | 9575 | try expect(data == 0); |
| 9576 | 9576 | } |
| 9577 | 9577 |
lib/compiler_rt/powiXf2_test.zig+235-230| ... | ... | @@ -32,17 +32,18 @@ fn test__powixf2(a: f80, b: i32, expected: f80) !void { |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | test "powihf2" { |
| 35 | const inf_f16 = math.inf(f16); | |
| 35 | 36 | try test__powisf2(0, 0, 1); |
| 36 | 37 | try test__powihf2(1, 0, 1); |
| 37 | 38 | try test__powihf2(1.5, 0, 1); |
| 38 | 39 | try test__powihf2(2, 0, 1); |
| 39 | try test__powihf2(math.inf_f16, 0, 1); | |
| 40 | try test__powihf2(inf_f16, 0, 1); | |
| 40 | 41 | |
| 41 | 42 | try test__powihf2(-0.0, 0, 1); |
| 42 | 43 | try test__powihf2(-1, 0, 1); |
| 43 | 44 | try test__powihf2(-1.5, 0, 1); |
| 44 | 45 | try test__powihf2(-2, 0, 1); |
| 45 | try test__powihf2(-math.inf_f16, 0, 1); | |
| 46 | try test__powihf2(-inf_f16, 0, 1); | |
| 46 | 47 | |
| 47 | 48 | try test__powihf2(0, 1, 0); |
| 48 | 49 | try test__powihf2(0, 2, 0); |
| ... | ... | @@ -65,35 +66,35 @@ test "powihf2" { |
| 65 | 66 | try test__powihf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1); |
| 66 | 67 | try test__powihf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1); |
| 67 | 68 | |
| 68 | try test__powihf2(math.inf_f16, 1, math.inf_f16); | |
| 69 | try test__powihf2(math.inf_f16, 2, math.inf_f16); | |
| 70 | try test__powihf2(math.inf_f16, 3, math.inf_f16); | |
| 71 | try test__powihf2(math.inf_f16, 4, math.inf_f16); | |
| 72 | try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f16); | |
| 73 | try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f16); | |
| 74 | ||
| 75 | try test__powihf2(-math.inf_f16, 1, -math.inf_f16); | |
| 76 | try test__powihf2(-math.inf_f16, 2, math.inf_f16); | |
| 77 | try test__powihf2(-math.inf_f16, 3, -math.inf_f16); | |
| 78 | try test__powihf2(-math.inf_f16, 4, math.inf_f16); | |
| 79 | try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f16); | |
| 80 | try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f16); | |
| 69 | try test__powihf2(inf_f16, 1, inf_f16); | |
| 70 | try test__powihf2(inf_f16, 2, inf_f16); | |
| 71 | try test__powihf2(inf_f16, 3, inf_f16); | |
| 72 | try test__powihf2(inf_f16, 4, inf_f16); | |
| 73 | try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f16); | |
| 74 | try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f16); | |
| 75 | ||
| 76 | try test__powihf2(-inf_f16, 1, -inf_f16); | |
| 77 | try test__powihf2(-inf_f16, 2, inf_f16); | |
| 78 | try test__powihf2(-inf_f16, 3, -inf_f16); | |
| 79 | try test__powihf2(-inf_f16, 4, inf_f16); | |
| 80 | try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 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, -2, math.inf_f16); | |
| 84 | try test__powihf2(0, -3, math.inf_f16); | |
| 85 | try test__powihf2(0, -4, math.inf_f16); | |
| 86 | try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.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, 0x80000000)), math.inf_f16); | |
| 89 | ||
| 90 | try test__powihf2(-0.0, -1, -math.inf_f16); | |
| 91 | try test__powihf2(-0.0, -2, math.inf_f16); | |
| 92 | try test__powihf2(-0.0, -3, -math.inf_f16); | |
| 93 | try test__powihf2(-0.0, -4, math.inf_f16); | |
| 94 | try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f16); // -0 ^ anything even = +inf | |
| 95 | try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f16); // -0 ^ anything odd = -inf | |
| 96 | try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f16); | |
| 83 | try test__powihf2(0, -1, inf_f16); | |
| 84 | try test__powihf2(0, -2, inf_f16); | |
| 85 | try test__powihf2(0, -3, inf_f16); | |
| 86 | try test__powihf2(0, -4, inf_f16); | |
| 87 | try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f16); // 0 ^ anything = +inf | |
| 88 | try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f16); | |
| 89 | try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f16); | |
| 90 | ||
| 91 | try test__powihf2(-0.0, -1, -inf_f16); | |
| 92 | try test__powihf2(-0.0, -2, inf_f16); | |
| 93 | try test__powihf2(-0.0, -3, -inf_f16); | |
| 94 | try test__powihf2(-0.0, -4, inf_f16); | |
| 95 | try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f16); // -0 ^ anything even = +inf | |
| 96 | try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f16); // -0 ^ anything odd = -inf | |
| 97 | try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f16); | |
| 97 | 98 | |
| 98 | 99 | try test__powihf2(1, -1, 1); |
| 99 | 100 | try test__powihf2(1, -2, 1); |
| ... | ... | @@ -103,21 +104,21 @@ test "powihf2" { |
| 103 | 104 | try test__powihf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1); |
| 104 | 105 | try test__powihf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1); |
| 105 | 106 | |
| 106 | try test__powihf2(math.inf_f16, -1, 0); | |
| 107 | try test__powihf2(math.inf_f16, -2, 0); | |
| 108 | try test__powihf2(math.inf_f16, -3, 0); | |
| 109 | try test__powihf2(math.inf_f16, -4, 0); | |
| 110 | try test__powihf2(math.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(math.inf_f16, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 107 | try test__powihf2(inf_f16, -1, 0); | |
| 108 | try test__powihf2(inf_f16, -2, 0); | |
| 109 | try test__powihf2(inf_f16, -3, 0); | |
| 110 | try test__powihf2(inf_f16, -4, 0); | |
| 111 | try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 112 | try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x80000001)), 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(-math.inf_f16, -2, 0); | |
| 116 | try test__powihf2(-math.inf_f16, -3, -0.0); | |
| 117 | try test__powihf2(-math.inf_f16, -4, 0); | |
| 118 | try test__powihf2(-math.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(-math.inf_f16, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 115 | try test__powihf2(-inf_f16, -1, -0.0); | |
| 116 | try test__powihf2(-inf_f16, -2, 0); | |
| 117 | try test__powihf2(-inf_f16, -3, -0.0); | |
| 118 | try test__powihf2(-inf_f16, -4, 0); | |
| 119 | try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 120 | try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x80000001)), -0.0); | |
| 121 | try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 121 | 122 | |
| 122 | 123 | try test__powihf2(2, 10, 1024.0); |
| 123 | 124 | try test__powihf2(-2, 10, 1024.0); |
| ... | ... | @@ -128,8 +129,8 @@ test "powihf2" { |
| 128 | 129 | try test__powihf2(-2, 14, 16384.0); |
| 129 | 130 | try test__powihf2(2, 15, 32768.0); |
| 130 | 131 | try test__powihf2(-2, 15, -32768.0); |
| 131 | try test__powihf2(2, 16, math.inf_f16); | |
| 132 | try test__powihf2(-2, 16, math.inf_f16); | |
| 132 | try test__powihf2(2, 16, inf_f16); | |
| 133 | try test__powihf2(-2, 16, inf_f16); | |
| 133 | 134 | |
| 134 | 135 | try test__powihf2(2, -13, 1.0 / 8192.0); |
| 135 | 136 | try test__powihf2(-2, -13, -1.0 / 8192.0); |
| ... | ... | @@ -140,17 +141,18 @@ test "powihf2" { |
| 140 | 141 | } |
| 141 | 142 | |
| 142 | 143 | test "powisf2" { |
| 144 | const inf_f32 = math.inf(f32); | |
| 143 | 145 | try test__powisf2(0, 0, 1); |
| 144 | 146 | try test__powisf2(1, 0, 1); |
| 145 | 147 | try test__powisf2(1.5, 0, 1); |
| 146 | 148 | try test__powisf2(2, 0, 1); |
| 147 | try test__powisf2(math.inf_f32, 0, 1); | |
| 149 | try test__powisf2(inf_f32, 0, 1); | |
| 148 | 150 | |
| 149 | 151 | try test__powisf2(-0.0, 0, 1); |
| 150 | 152 | try test__powisf2(-1, 0, 1); |
| 151 | 153 | try test__powisf2(-1.5, 0, 1); |
| 152 | 154 | try test__powisf2(-2, 0, 1); |
| 153 | try test__powisf2(-math.inf_f32, 0, 1); | |
| 155 | try test__powisf2(-inf_f32, 0, 1); | |
| 154 | 156 | |
| 155 | 157 | try test__powisf2(0, 1, 0); |
| 156 | 158 | try test__powisf2(0, 2, 0); |
| ... | ... | @@ -173,35 +175,35 @@ test "powisf2" { |
| 173 | 175 | try test__powisf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1); |
| 174 | 176 | try test__powisf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1); |
| 175 | 177 | |
| 176 | try test__powisf2(math.inf_f32, 1, math.inf_f32); | |
| 177 | try test__powisf2(math.inf_f32, 2, math.inf_f32); | |
| 178 | try test__powisf2(math.inf_f32, 3, math.inf_f32); | |
| 179 | try test__powisf2(math.inf_f32, 4, math.inf_f32); | |
| 180 | try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f32); | |
| 181 | try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f32); | |
| 182 | ||
| 183 | try test__powisf2(-math.inf_f32, 1, -math.inf_f32); | |
| 184 | try test__powisf2(-math.inf_f32, 2, math.inf_f32); | |
| 185 | try test__powisf2(-math.inf_f32, 3, -math.inf_f32); | |
| 186 | try test__powisf2(-math.inf_f32, 4, math.inf_f32); | |
| 187 | try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f32); | |
| 188 | try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f32); | |
| 189 | ||
| 190 | try test__powisf2(0, -1, math.inf_f32); | |
| 191 | try test__powisf2(0, -2, math.inf_f32); | |
| 192 | try test__powisf2(0, -3, math.inf_f32); | |
| 193 | try test__powisf2(0, -4, math.inf_f32); | |
| 194 | try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f32); | |
| 195 | try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f32); | |
| 196 | try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f32); | |
| 197 | ||
| 198 | try test__powisf2(-0.0, -1, -math.inf_f32); | |
| 199 | try test__powisf2(-0.0, -2, math.inf_f32); | |
| 200 | try test__powisf2(-0.0, -3, -math.inf_f32); | |
| 201 | try test__powisf2(-0.0, -4, math.inf_f32); | |
| 202 | try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f32); | |
| 203 | try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f32); | |
| 204 | try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f32); | |
| 178 | try test__powisf2(inf_f32, 1, inf_f32); | |
| 179 | try test__powisf2(inf_f32, 2, inf_f32); | |
| 180 | try test__powisf2(inf_f32, 3, inf_f32); | |
| 181 | try test__powisf2(inf_f32, 4, inf_f32); | |
| 182 | try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f32); | |
| 183 | try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f32); | |
| 184 | ||
| 185 | try test__powisf2(-inf_f32, 1, -inf_f32); | |
| 186 | try test__powisf2(-inf_f32, 2, inf_f32); | |
| 187 | try test__powisf2(-inf_f32, 3, -inf_f32); | |
| 188 | try test__powisf2(-inf_f32, 4, inf_f32); | |
| 189 | try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f32); | |
| 190 | try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f32); | |
| 191 | ||
| 192 | try test__powisf2(0, -1, inf_f32); | |
| 193 | try test__powisf2(0, -2, inf_f32); | |
| 194 | try test__powisf2(0, -3, inf_f32); | |
| 195 | try test__powisf2(0, -4, inf_f32); | |
| 196 | try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f32); | |
| 197 | try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f32); | |
| 198 | try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f32); | |
| 199 | ||
| 200 | try test__powisf2(-0.0, -1, -inf_f32); | |
| 201 | try test__powisf2(-0.0, -2, inf_f32); | |
| 202 | try test__powisf2(-0.0, -3, -inf_f32); | |
| 203 | try test__powisf2(-0.0, -4, inf_f32); | |
| 204 | try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f32); | |
| 205 | try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f32); | |
| 206 | try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f32); | |
| 205 | 207 | |
| 206 | 208 | try test__powisf2(1, -1, 1); |
| 207 | 209 | try test__powisf2(1, -2, 1); |
| ... | ... | @@ -211,21 +213,21 @@ test "powisf2" { |
| 211 | 213 | try test__powisf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1); |
| 212 | 214 | try test__powisf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1); |
| 213 | 215 | |
| 214 | try test__powisf2(math.inf_f32, -1, 0); | |
| 215 | try test__powisf2(math.inf_f32, -2, 0); | |
| 216 | try test__powisf2(math.inf_f32, -3, 0); | |
| 217 | try test__powisf2(math.inf_f32, -4, 0); | |
| 218 | try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 219 | try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x80000001)), 0); | |
| 220 | try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 221 | ||
| 222 | try test__powisf2(-math.inf_f32, -1, -0.0); | |
| 223 | try test__powisf2(-math.inf_f32, -2, 0); | |
| 224 | try test__powisf2(-math.inf_f32, -3, -0.0); | |
| 225 | try test__powisf2(-math.inf_f32, -4, 0); | |
| 226 | try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 227 | try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x80000001)), -0.0); | |
| 228 | try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 216 | try test__powisf2(inf_f32, -1, 0); | |
| 217 | try test__powisf2(inf_f32, -2, 0); | |
| 218 | try test__powisf2(inf_f32, -3, 0); | |
| 219 | try test__powisf2(inf_f32, -4, 0); | |
| 220 | try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 221 | try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x80000001)), 0); | |
| 222 | try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 223 | ||
| 224 | try test__powisf2(-inf_f32, -1, -0.0); | |
| 225 | try test__powisf2(-inf_f32, -2, 0); | |
| 226 | try test__powisf2(-inf_f32, -3, -0.0); | |
| 227 | try test__powisf2(-inf_f32, -4, 0); | |
| 228 | try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 229 | try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x80000001)), -0.0); | |
| 230 | try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 229 | 231 | |
| 230 | 232 | try test__powisf2(2.0, 10, 1024.0); |
| 231 | 233 | try test__powisf2(-2, 10, 1024.0); |
| ... | ... | @@ -244,17 +246,18 @@ test "powisf2" { |
| 244 | 246 | } |
| 245 | 247 | |
| 246 | 248 | test "powidf2" { |
| 249 | const inf_f64 = math.inf(f64); | |
| 247 | 250 | try test__powidf2(0, 0, 1); |
| 248 | 251 | try test__powidf2(1, 0, 1); |
| 249 | 252 | try test__powidf2(1.5, 0, 1); |
| 250 | 253 | try test__powidf2(2, 0, 1); |
| 251 | try test__powidf2(math.inf_f64, 0, 1); | |
| 254 | try test__powidf2(inf_f64, 0, 1); | |
| 252 | 255 | |
| 253 | 256 | try test__powidf2(-0.0, 0, 1); |
| 254 | 257 | try test__powidf2(-1, 0, 1); |
| 255 | 258 | try test__powidf2(-1.5, 0, 1); |
| 256 | 259 | try test__powidf2(-2, 0, 1); |
| 257 | try test__powidf2(-math.inf_f64, 0, 1); | |
| 260 | try test__powidf2(-inf_f64, 0, 1); | |
| 258 | 261 | |
| 259 | 262 | try test__powidf2(0, 1, 0); |
| 260 | 263 | try test__powidf2(0, 2, 0); |
| ... | ... | @@ -277,35 +280,35 @@ test "powidf2" { |
| 277 | 280 | try test__powidf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1); |
| 278 | 281 | try test__powidf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1); |
| 279 | 282 | |
| 280 | try test__powidf2(math.inf_f64, 1, math.inf_f64); | |
| 281 | try test__powidf2(math.inf_f64, 2, math.inf_f64); | |
| 282 | try test__powidf2(math.inf_f64, 3, math.inf_f64); | |
| 283 | try test__powidf2(math.inf_f64, 4, math.inf_f64); | |
| 284 | try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f64); | |
| 285 | try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f64); | |
| 286 | ||
| 287 | try test__powidf2(-math.inf_f64, 1, -math.inf_f64); | |
| 288 | try test__powidf2(-math.inf_f64, 2, math.inf_f64); | |
| 289 | try test__powidf2(-math.inf_f64, 3, -math.inf_f64); | |
| 290 | try test__powidf2(-math.inf_f64, 4, math.inf_f64); | |
| 291 | try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f64); | |
| 292 | try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f64); | |
| 293 | ||
| 294 | try test__powidf2(0, -1, math.inf_f64); | |
| 295 | try test__powidf2(0, -2, math.inf_f64); | |
| 296 | try test__powidf2(0, -3, math.inf_f64); | |
| 297 | try test__powidf2(0, -4, math.inf_f64); | |
| 298 | try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f64); | |
| 299 | try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f64); | |
| 300 | try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f64); | |
| 301 | ||
| 302 | try test__powidf2(-0.0, -1, -math.inf_f64); | |
| 303 | try test__powidf2(-0.0, -2, math.inf_f64); | |
| 304 | try test__powidf2(-0.0, -3, -math.inf_f64); | |
| 305 | try test__powidf2(-0.0, -4, math.inf_f64); | |
| 306 | try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f64); | |
| 307 | try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f64); | |
| 308 | try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f64); | |
| 283 | try test__powidf2(inf_f64, 1, inf_f64); | |
| 284 | try test__powidf2(inf_f64, 2, inf_f64); | |
| 285 | try test__powidf2(inf_f64, 3, inf_f64); | |
| 286 | try test__powidf2(inf_f64, 4, inf_f64); | |
| 287 | try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f64); | |
| 288 | try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f64); | |
| 289 | ||
| 290 | try test__powidf2(-inf_f64, 1, -inf_f64); | |
| 291 | try test__powidf2(-inf_f64, 2, inf_f64); | |
| 292 | try test__powidf2(-inf_f64, 3, -inf_f64); | |
| 293 | try test__powidf2(-inf_f64, 4, inf_f64); | |
| 294 | try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f64); | |
| 295 | try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f64); | |
| 296 | ||
| 297 | try test__powidf2(0, -1, inf_f64); | |
| 298 | try test__powidf2(0, -2, inf_f64); | |
| 299 | try test__powidf2(0, -3, inf_f64); | |
| 300 | try test__powidf2(0, -4, inf_f64); | |
| 301 | try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f64); | |
| 302 | try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f64); | |
| 303 | try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f64); | |
| 304 | ||
| 305 | try test__powidf2(-0.0, -1, -inf_f64); | |
| 306 | try test__powidf2(-0.0, -2, inf_f64); | |
| 307 | try test__powidf2(-0.0, -3, -inf_f64); | |
| 308 | try test__powidf2(-0.0, -4, inf_f64); | |
| 309 | try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f64); | |
| 310 | try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f64); | |
| 311 | try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f64); | |
| 309 | 312 | |
| 310 | 313 | try test__powidf2(1, -1, 1); |
| 311 | 314 | try test__powidf2(1, -2, 1); |
| ... | ... | @@ -315,21 +318,21 @@ test "powidf2" { |
| 315 | 318 | try test__powidf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1); |
| 316 | 319 | try test__powidf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1); |
| 317 | 320 | |
| 318 | try test__powidf2(math.inf_f64, -1, 0); | |
| 319 | try test__powidf2(math.inf_f64, -2, 0); | |
| 320 | try test__powidf2(math.inf_f64, -3, 0); | |
| 321 | try test__powidf2(math.inf_f64, -4, 0); | |
| 322 | try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 323 | try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x80000001)), 0); | |
| 324 | try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 325 | ||
| 326 | try test__powidf2(-math.inf_f64, -1, -0.0); | |
| 327 | try test__powidf2(-math.inf_f64, -2, 0); | |
| 328 | try test__powidf2(-math.inf_f64, -3, -0.0); | |
| 329 | try test__powidf2(-math.inf_f64, -4, 0); | |
| 330 | try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 331 | try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x80000001)), -0.0); | |
| 332 | try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 321 | try test__powidf2(inf_f64, -1, 0); | |
| 322 | try test__powidf2(inf_f64, -2, 0); | |
| 323 | try test__powidf2(inf_f64, -3, 0); | |
| 324 | try test__powidf2(inf_f64, -4, 0); | |
| 325 | try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 326 | try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x80000001)), 0); | |
| 327 | try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 328 | ||
| 329 | try test__powidf2(-inf_f64, -1, -0.0); | |
| 330 | try test__powidf2(-inf_f64, -2, 0); | |
| 331 | try test__powidf2(-inf_f64, -3, -0.0); | |
| 332 | try test__powidf2(-inf_f64, -4, 0); | |
| 333 | try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 334 | try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x80000001)), -0.0); | |
| 335 | try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 333 | 336 | |
| 334 | 337 | try test__powidf2(2, 10, 1024.0); |
| 335 | 338 | try test__powidf2(-2, 10, 1024.0); |
| ... | ... | @@ -348,17 +351,18 @@ test "powidf2" { |
| 348 | 351 | } |
| 349 | 352 | |
| 350 | 353 | test "powitf2" { |
| 354 | const inf_f128 = math.inf(f128); | |
| 351 | 355 | try test__powitf2(0, 0, 1); |
| 352 | 356 | try test__powitf2(1, 0, 1); |
| 353 | 357 | try test__powitf2(1.5, 0, 1); |
| 354 | 358 | try test__powitf2(2, 0, 1); |
| 355 | try test__powitf2(math.inf_f128, 0, 1); | |
| 359 | try test__powitf2(inf_f128, 0, 1); | |
| 356 | 360 | |
| 357 | 361 | try test__powitf2(-0.0, 0, 1); |
| 358 | 362 | try test__powitf2(-1, 0, 1); |
| 359 | 363 | try test__powitf2(-1.5, 0, 1); |
| 360 | 364 | try test__powitf2(-2, 0, 1); |
| 361 | try test__powitf2(-math.inf_f128, 0, 1); | |
| 365 | try test__powitf2(-inf_f128, 0, 1); | |
| 362 | 366 | |
| 363 | 367 | try test__powitf2(0, 1, 0); |
| 364 | 368 | try test__powitf2(0, 2, 0); |
| ... | ... | @@ -381,35 +385,35 @@ test "powitf2" { |
| 381 | 385 | try test__powitf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1); |
| 382 | 386 | try test__powitf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1); |
| 383 | 387 | |
| 384 | try test__powitf2(math.inf_f128, 1, math.inf_f128); | |
| 385 | try test__powitf2(math.inf_f128, 2, math.inf_f128); | |
| 386 | try test__powitf2(math.inf_f128, 3, math.inf_f128); | |
| 387 | try test__powitf2(math.inf_f128, 4, math.inf_f128); | |
| 388 | try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f128); | |
| 389 | try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f128); | |
| 390 | ||
| 391 | try test__powitf2(-math.inf_f128, 1, -math.inf_f128); | |
| 392 | try test__powitf2(-math.inf_f128, 2, math.inf_f128); | |
| 393 | try test__powitf2(-math.inf_f128, 3, -math.inf_f128); | |
| 394 | try test__powitf2(-math.inf_f128, 4, math.inf_f128); | |
| 395 | try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f128); | |
| 396 | try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f128); | |
| 397 | ||
| 398 | try test__powitf2(0, -1, math.inf_f128); | |
| 399 | try test__powitf2(0, -2, math.inf_f128); | |
| 400 | try test__powitf2(0, -3, math.inf_f128); | |
| 401 | try test__powitf2(0, -4, math.inf_f128); | |
| 402 | try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f128); | |
| 403 | try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f128); | |
| 404 | try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f128); | |
| 405 | ||
| 406 | try test__powitf2(-0.0, -1, -math.inf_f128); | |
| 407 | try test__powitf2(-0.0, -2, math.inf_f128); | |
| 408 | try test__powitf2(-0.0, -3, -math.inf_f128); | |
| 409 | try test__powitf2(-0.0, -4, math.inf_f128); | |
| 410 | try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f128); | |
| 411 | try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f128); | |
| 412 | try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f128); | |
| 388 | try test__powitf2(inf_f128, 1, inf_f128); | |
| 389 | try test__powitf2(inf_f128, 2, inf_f128); | |
| 390 | try test__powitf2(inf_f128, 3, inf_f128); | |
| 391 | try test__powitf2(inf_f128, 4, inf_f128); | |
| 392 | try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f128); | |
| 393 | try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f128); | |
| 394 | ||
| 395 | try test__powitf2(-inf_f128, 1, -inf_f128); | |
| 396 | try test__powitf2(-inf_f128, 2, inf_f128); | |
| 397 | try test__powitf2(-inf_f128, 3, -inf_f128); | |
| 398 | try test__powitf2(-inf_f128, 4, inf_f128); | |
| 399 | try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f128); | |
| 400 | try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f128); | |
| 401 | ||
| 402 | try test__powitf2(0, -1, inf_f128); | |
| 403 | try test__powitf2(0, -2, inf_f128); | |
| 404 | try test__powitf2(0, -3, inf_f128); | |
| 405 | try test__powitf2(0, -4, inf_f128); | |
| 406 | try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f128); | |
| 407 | try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f128); | |
| 408 | try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f128); | |
| 409 | ||
| 410 | try test__powitf2(-0.0, -1, -inf_f128); | |
| 411 | try test__powitf2(-0.0, -2, inf_f128); | |
| 412 | try test__powitf2(-0.0, -3, -inf_f128); | |
| 413 | try test__powitf2(-0.0, -4, inf_f128); | |
| 414 | try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f128); | |
| 415 | try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f128); | |
| 416 | try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f128); | |
| 413 | 417 | |
| 414 | 418 | try test__powitf2(1, -1, 1); |
| 415 | 419 | try test__powitf2(1, -2, 1); |
| ... | ... | @@ -419,21 +423,21 @@ test "powitf2" { |
| 419 | 423 | try test__powitf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1); |
| 420 | 424 | try test__powitf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1); |
| 421 | 425 | |
| 422 | try test__powitf2(math.inf_f128, -1, 0); | |
| 423 | try test__powitf2(math.inf_f128, -2, 0); | |
| 424 | try test__powitf2(math.inf_f128, -3, 0); | |
| 425 | try test__powitf2(math.inf_f128, -4, 0); | |
| 426 | try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 427 | try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x80000001)), 0); | |
| 428 | try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 429 | ||
| 430 | try test__powitf2(-math.inf_f128, -1, -0.0); | |
| 431 | try test__powitf2(-math.inf_f128, -2, 0); | |
| 432 | try test__powitf2(-math.inf_f128, -3, -0.0); | |
| 433 | try test__powitf2(-math.inf_f128, -4, 0); | |
| 434 | try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 435 | try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x80000001)), -0.0); | |
| 436 | try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 426 | try test__powitf2(inf_f128, -1, 0); | |
| 427 | try test__powitf2(inf_f128, -2, 0); | |
| 428 | try test__powitf2(inf_f128, -3, 0); | |
| 429 | try test__powitf2(inf_f128, -4, 0); | |
| 430 | try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 431 | try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x80000001)), 0); | |
| 432 | try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 433 | ||
| 434 | try test__powitf2(-inf_f128, -1, -0.0); | |
| 435 | try test__powitf2(-inf_f128, -2, 0); | |
| 436 | try test__powitf2(-inf_f128, -3, -0.0); | |
| 437 | try test__powitf2(-inf_f128, -4, 0); | |
| 438 | try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 439 | try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x80000001)), -0.0); | |
| 440 | try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 437 | 441 | |
| 438 | 442 | try test__powitf2(2, 10, 1024.0); |
| 439 | 443 | try test__powitf2(-2, 10, 1024.0); |
| ... | ... | @@ -452,17 +456,18 @@ test "powitf2" { |
| 452 | 456 | } |
| 453 | 457 | |
| 454 | 458 | test "powixf2" { |
| 459 | const inf_f80 = math.inf(f80); | |
| 455 | 460 | try test__powixf2(0, 0, 1); |
| 456 | 461 | try test__powixf2(1, 0, 1); |
| 457 | 462 | try test__powixf2(1.5, 0, 1); |
| 458 | 463 | try test__powixf2(2, 0, 1); |
| 459 | try test__powixf2(math.inf_f80, 0, 1); | |
| 464 | try test__powixf2(inf_f80, 0, 1); | |
| 460 | 465 | |
| 461 | 466 | try test__powixf2(-0.0, 0, 1); |
| 462 | 467 | try test__powixf2(-1, 0, 1); |
| 463 | 468 | try test__powixf2(-1.5, 0, 1); |
| 464 | 469 | try test__powixf2(-2, 0, 1); |
| 465 | try test__powixf2(-math.inf_f80, 0, 1); | |
| 470 | try test__powixf2(-inf_f80, 0, 1); | |
| 466 | 471 | |
| 467 | 472 | try test__powixf2(0, 1, 0); |
| 468 | 473 | try test__powixf2(0, 2, 0); |
| ... | ... | @@ -485,35 +490,35 @@ test "powixf2" { |
| 485 | 490 | try test__powixf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1); |
| 486 | 491 | try test__powixf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1); |
| 487 | 492 | |
| 488 | try test__powixf2(math.inf_f80, 1, math.inf_f80); | |
| 489 | try test__powixf2(math.inf_f80, 2, math.inf_f80); | |
| 490 | try test__powixf2(math.inf_f80, 3, math.inf_f80); | |
| 491 | try test__powixf2(math.inf_f80, 4, math.inf_f80); | |
| 492 | try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f80); | |
| 493 | try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f80); | |
| 494 | ||
| 495 | try test__powixf2(-math.inf_f80, 1, -math.inf_f80); | |
| 496 | try test__powixf2(-math.inf_f80, 2, math.inf_f80); | |
| 497 | try test__powixf2(-math.inf_f80, 3, -math.inf_f80); | |
| 498 | try test__powixf2(-math.inf_f80, 4, math.inf_f80); | |
| 499 | try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f80); | |
| 500 | try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f80); | |
| 501 | ||
| 502 | try test__powixf2(0, -1, math.inf_f80); | |
| 503 | try test__powixf2(0, -2, math.inf_f80); | |
| 504 | try test__powixf2(0, -3, math.inf_f80); | |
| 505 | try test__powixf2(0, -4, math.inf_f80); | |
| 506 | try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f80); | |
| 507 | try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f80); | |
| 508 | try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f80); | |
| 509 | ||
| 510 | try test__powixf2(-0.0, -1, -math.inf_f80); | |
| 511 | try test__powixf2(-0.0, -2, math.inf_f80); | |
| 512 | try test__powixf2(-0.0, -3, -math.inf_f80); | |
| 513 | try test__powixf2(-0.0, -4, math.inf_f80); | |
| 514 | try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f80); | |
| 515 | try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f80); | |
| 516 | try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f80); | |
| 493 | try test__powixf2(inf_f80, 1, inf_f80); | |
| 494 | try test__powixf2(inf_f80, 2, inf_f80); | |
| 495 | try test__powixf2(inf_f80, 3, inf_f80); | |
| 496 | try test__powixf2(inf_f80, 4, inf_f80); | |
| 497 | try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f80); | |
| 498 | try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f80); | |
| 499 | ||
| 500 | try test__powixf2(-inf_f80, 1, -inf_f80); | |
| 501 | try test__powixf2(-inf_f80, 2, inf_f80); | |
| 502 | try test__powixf2(-inf_f80, 3, -inf_f80); | |
| 503 | try test__powixf2(-inf_f80, 4, inf_f80); | |
| 504 | try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f80); | |
| 505 | try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f80); | |
| 506 | ||
| 507 | try test__powixf2(0, -1, inf_f80); | |
| 508 | try test__powixf2(0, -2, inf_f80); | |
| 509 | try test__powixf2(0, -3, inf_f80); | |
| 510 | try test__powixf2(0, -4, inf_f80); | |
| 511 | try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f80); | |
| 512 | try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f80); | |
| 513 | try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f80); | |
| 514 | ||
| 515 | try test__powixf2(-0.0, -1, -inf_f80); | |
| 516 | try test__powixf2(-0.0, -2, inf_f80); | |
| 517 | try test__powixf2(-0.0, -3, -inf_f80); | |
| 518 | try test__powixf2(-0.0, -4, inf_f80); | |
| 519 | try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f80); | |
| 520 | try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f80); | |
| 521 | try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f80); | |
| 517 | 522 | |
| 518 | 523 | try test__powixf2(1, -1, 1); |
| 519 | 524 | try test__powixf2(1, -2, 1); |
| ... | ... | @@ -523,21 +528,21 @@ test "powixf2" { |
| 523 | 528 | try test__powixf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1); |
| 524 | 529 | try test__powixf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1); |
| 525 | 530 | |
| 526 | try test__powixf2(math.inf_f80, -1, 0); | |
| 527 | try test__powixf2(math.inf_f80, -2, 0); | |
| 528 | try test__powixf2(math.inf_f80, -3, 0); | |
| 529 | try test__powixf2(math.inf_f80, -4, 0); | |
| 530 | try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 531 | try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x80000001)), 0); | |
| 532 | try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 533 | ||
| 534 | try test__powixf2(-math.inf_f80, -1, -0.0); | |
| 535 | try test__powixf2(-math.inf_f80, -2, 0); | |
| 536 | try test__powixf2(-math.inf_f80, -3, -0.0); | |
| 537 | try test__powixf2(-math.inf_f80, -4, 0); | |
| 538 | try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 539 | try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x80000001)), -0.0); | |
| 540 | try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 531 | try test__powixf2(inf_f80, -1, 0); | |
| 532 | try test__powixf2(inf_f80, -2, 0); | |
| 533 | try test__powixf2(inf_f80, -3, 0); | |
| 534 | try test__powixf2(inf_f80, -4, 0); | |
| 535 | try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 536 | try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x80000001)), 0); | |
| 537 | try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 538 | ||
| 539 | try test__powixf2(-inf_f80, -1, -0.0); | |
| 540 | try test__powixf2(-inf_f80, -2, 0); | |
| 541 | try test__powixf2(-inf_f80, -3, -0.0); | |
| 542 | try test__powixf2(-inf_f80, -4, 0); | |
| 543 | try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0); | |
| 544 | try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x80000001)), -0.0); | |
| 545 | try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0); | |
| 541 | 546 | |
| 542 | 547 | try test__powixf2(2, 10, 1024.0); |
| 543 | 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 | 1032 | self.linkLibraryOrObject(obj); |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | pub const addSystemIncludeDir = @compileError("deprecated; use addSystemIncludePath"); | |
| 1036 | pub const addIncludeDir = @compileError("deprecated; use addIncludePath"); | |
| 1037 | pub const addLibPath = @compileError("deprecated, use addLibraryPath"); | |
| 1038 | pub const addFrameworkDir = @compileError("deprecated, use addFrameworkPath"); | |
| 1039 | ||
| 1040 | 1035 | pub fn addSystemIncludePath(self: *Compile, path: []const u8) void { |
| 1041 | 1036 | const b = self.step.owner; |
| 1042 | 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 | 302 | test "base64" { |
| 303 | 303 | @setEvalBranchQuota(8000); |
| 304 | 304 | try testBase64(); |
| 305 | comptime try testAllApis(standard, "comptime", "Y29tcHRpbWU="); | |
| 305 | try comptime testAllApis(standard, "comptime", "Y29tcHRpbWU="); | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | test "base64 padding dest overflow" { |
| ... | ... | @@ -322,7 +322,7 @@ test "base64 padding dest overflow" { |
| 322 | 322 | test "base64 url_safe_no_pad" { |
| 323 | 323 | @setEvalBranchQuota(8000); |
| 324 | 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 | } |
| 327 | 327 | |
| 328 | 328 | fn testBase64() !void { |
lib/std/builtin.zig-3| ... | ... | @@ -221,7 +221,6 @@ pub const SourceLocation = struct { |
| 221 | 221 | }; |
| 222 | 222 | |
| 223 | 223 | pub const TypeId = std.meta.Tag(Type); |
| 224 | pub const TypeInfo = @compileError("deprecated; use Type"); | |
| 225 | 224 | |
| 226 | 225 | /// This data structure is used by the Zig language code generation and |
| 227 | 226 | /// therefore must be kept in sync with the compiler implementation. |
| ... | ... | @@ -388,8 +387,6 @@ pub const Type = union(enum) { |
| 388 | 387 | decls: []const Declaration, |
| 389 | 388 | }; |
| 390 | 389 | |
| 391 | pub const FnArg = @compileError("deprecated; use Fn.Param"); | |
| 392 | ||
| 393 | 390 | /// This data structure is used by the Zig language code generation and |
| 394 | 391 | /// therefore must be kept in sync with the compiler implementation. |
| 395 | 392 | pub const Fn = struct { |
lib/std/crypto/25519/ed25519.zig-6| ... | ... | @@ -480,13 +480,7 @@ pub const Ed25519 = struct { |
| 480 | 480 | hx.final(&blind_h); |
| 481 | 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 | }; |
| 491 | 485 | |
| 492 | 486 | test "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 | 22 | } |
| 23 | 23 | |
| 24 | 24 | test "cstr fns" { |
| 25 | comptime try testCStrFnsImpl(); | |
| 25 | try comptime testCStrFnsImpl(); | |
| 26 | 26 | try testCStrFnsImpl(); |
| 27 | 27 | } |
| 28 | 28 |
lib/std/debug.zig-2| ... | ... | @@ -81,8 +81,6 @@ const PdbOrDwarf = union(enum) { |
| 81 | 81 | |
| 82 | 82 | var stderr_mutex = std.Thread.Mutex{}; |
| 83 | 83 | |
| 84 | pub const warn = @compileError("deprecated; use `std.log` functions for logging or `std.debug.print` for 'printf debugging'"); | |
| 85 | ||
| 86 | 84 | /// Print to stderr, unbuffered, and silently returning on failure. Intended |
| 87 | 85 | /// for use in "printf debugging." Use `std.log` functions for proper logging. |
| 88 | 86 | pub fn print(comptime fmt: []const u8, args: anytype) void { |
lib/std/fifo.zig-2| ... | ... | @@ -117,8 +117,6 @@ pub fn LinearFifo( |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | pub const ensureCapacity = @compileError("deprecated; call `ensureUnusedCapacity` or `ensureTotalCapacity`"); | |
| 121 | ||
| 122 | 120 | /// Ensure that the buffer can fit at least `size` items |
| 123 | 121 | pub fn ensureTotalCapacity(self: *Self, size: usize) !void { |
| 124 | 122 | if (self.buf.len >= size) return; |
lib/std/fmt.zig+2-10| ... | ... | @@ -727,12 +727,6 @@ fn formatValue( |
| 727 | 727 | options: FormatOptions, |
| 728 | 728 | writer: anytype, |
| 729 | 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 | 730 | const T = @TypeOf(value); |
| 737 | 731 | switch (@typeInfo(T)) { |
| 738 | 732 | .Float, .ComptimeFloat => return formatFloatValue(value, fmt, options, writer), |
| ... | ... | @@ -977,12 +971,10 @@ fn checkTextFmt(comptime fmt: []const u8) void { |
| 977 | 971 | if (fmt.len != 1) |
| 978 | 972 | @compileError("unsupported format string '" ++ fmt ++ "' when formatting text"); |
| 979 | 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 | 976 | 'x' => @compileError("specifier 'x' has been deprecated, wrap your argument in std.fmt.fmtSliceHexLower instead"), |
| 981 | 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 | 978 | else => {}, |
| 987 | 979 | } |
| 988 | 980 | } |
lib/std/hash/auto_hash.zig+4-4| ... | ... | @@ -408,13 +408,13 @@ test "testHash union" { |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | test "testHash vector" { |
| 411 | const a: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 4 }; | |
| 412 | const b: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 5 }; | |
| 411 | const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 }; | |
| 412 | const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 }; | |
| 413 | 413 | try testing.expect(testHash(a) == testHash(a)); |
| 414 | 414 | try testing.expect(testHash(a) != testHash(b)); |
| 415 | 415 | |
| 416 | const c: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 4 }; | |
| 417 | const d: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 5 }; | |
| 416 | const c: @Vector(4, u31) = [_]u31{ 1, 2, 3, 4 }; | |
| 417 | const d: @Vector(4, u31) = [_]u31{ 1, 2, 3, 5 }; | |
| 418 | 418 | try testing.expect(testHash(c) == testHash(c)); |
| 419 | 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 | 148 | pub const FindByteWriter = @import("io/find_byte_writer.zig").FindByteWriter; |
| 149 | 149 | pub const findByteWriter = @import("io/find_byte_writer.zig").findByteWriter; |
| 150 | 150 | |
| 151 | pub const FindByteOutStream = @compileError("deprecated; use `FindByteWriter`"); | |
| 152 | pub const findByteOutStream = @compileError("deprecated; use `findByteWriter`"); | |
| 153 | ||
| 154 | 151 | pub const BufferedAtomicFile = @import("io/buffered_atomic_file.zig").BufferedAtomicFile; |
| 155 | 152 | |
| 156 | 153 | pub 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 | 48 | pub const floatEps = @import("math/float.zig").floatEps; |
| 49 | 49 | pub const inf = @import("math/float.zig").inf; |
| 50 | 50 | |
| 51 | // TODO Replace with @compileError("deprecated for foobar") after 0.10.0 is released. | |
| 52 | pub const f16_true_min: comptime_float = floatTrueMin(f16); // prev: 0.000000059604644775390625 | |
| 53 | pub const f32_true_min: comptime_float = floatTrueMin(f32); // prev: 1.40129846432481707092e-45 | |
| 54 | pub const f64_true_min: comptime_float = floatTrueMin(f64); // prev: 4.94065645841246544177e-324 | |
| 55 | pub const f80_true_min = floatTrueMin(f80); // prev: make_f80(.{ .fraction = 1, .exp = 0 }) | |
| 56 | pub const f128_true_min = floatTrueMin(f128); // prev: @bitCast(f128, @as(u128, 0x00000000000000000000000000000001)) | |
| 57 | pub const f16_min: comptime_float = floatMin(f16); // prev: 0.00006103515625 | |
| 58 | pub const f32_min: comptime_float = floatMin(f32); // prev: 1.17549435082228750797e-38 | |
| 59 | pub const f64_min: comptime_float = floatMin(f64); // prev: 2.2250738585072014e-308 | |
| 60 | pub const f80_min = floatMin(f80); // prev: make_f80(.{ .fraction = 0x8000000000000000, .exp = 1 }) | |
| 61 | pub const f128_min = floatMin(f128); // prev: @bitCast(f128, @as(u128, 0x00010000000000000000000000000000)) | |
| 62 | pub const f16_max: comptime_float = floatMax(f16); // prev: 65504 | |
| 63 | pub const f32_max: comptime_float = floatMax(f32); // prev: 3.40282346638528859812e+38 | |
| 64 | pub const f64_max: comptime_float = floatMax(f64); // prev: 1.79769313486231570815e+308 | |
| 65 | pub const f80_max = floatMax(f80); // prev: make_f80(.{ .fraction = 0xFFFFFFFFFFFFFFFF, .exp = 0x7FFE }) | |
| 66 | pub const f128_max = floatMax(f128); // prev: @bitCast(f128, @as(u128, 0x7FFEFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) | |
| 67 | pub const f16_epsilon: comptime_float = floatEps(f16); // prev: 0.0009765625 | |
| 68 | pub const f32_epsilon: comptime_float = floatEps(f32); // prev: 1.1920928955078125e-07 | |
| 69 | pub const f64_epsilon: comptime_float = floatEps(f64); // prev: 2.22044604925031308085e-16 | |
| 70 | pub const f80_epsilon = floatEps(f80); // prev: make_f80(.{ .fraction = 0x8000000000000000, .exp = 0x3FC0 }) | |
| 71 | pub const f128_epsilon = floatEps(f128); // prev: @bitCast(f128, @as(u128, 0x3F8F0000000000000000000000000000)) | |
| 72 | pub const f16_toint: comptime_float = 1.0 / f16_epsilon; // same as before | |
| 73 | pub const f32_toint: comptime_float = 1.0 / f32_epsilon; // same as before | |
| 74 | pub const f64_toint: comptime_float = 1.0 / f64_epsilon; // same as before | |
| 75 | pub const f80_toint = 1.0 / f80_epsilon; // same as before | |
| 76 | pub const f128_toint = 1.0 / f128_epsilon; // same as before | |
| 77 | pub const inf_u16 = @bitCast(u16, inf_f16); // prev: @as(u16, 0x7C00) | |
| 78 | pub const inf_f16 = inf(f16); // prev: @bitCast(f16, inf_u16) | |
| 79 | pub const inf_u32 = @bitCast(u32, inf_f32); // prev: @as(u32, 0x7F800000) | |
| 80 | pub const inf_f32 = inf(f32); // prev: @bitCast(f32, inf_u32) | |
| 81 | pub const inf_u64 = @bitCast(u64, inf_f64); // prev: @as(u64, 0x7FF << 52) | |
| 82 | pub const inf_f64 = inf(f64); // prev: @bitCast(f64, inf_u64) | |
| 83 | pub const inf_f80 = inf(f80); // prev: make_f80(F80{ .fraction = 0x8000000000000000, .exp = 0x7fff }) | |
| 84 | pub const inf_u128 = @bitCast(u128, inf_f128); // prev: @as(u128, 0x7fff0000000000000000000000000000) | |
| 85 | pub const inf_f128 = inf(f128); // prev: @bitCast(f128, inf_u128) | |
| 86 | pub const epsilon = floatEps; | |
| 87 | // End of "soft deprecated" section | |
| 51 | pub const f16_true_min = @compileError("Deprecated: use `floatTrueMin(f16)` instead"); | |
| 52 | pub const f32_true_min = @compileError("Deprecated: use `floatTrueMin(f32)` instead"); | |
| 53 | pub const f64_true_min = @compileError("Deprecated: use `floatTrueMin(f64)` instead"); | |
| 54 | pub const f80_true_min = @compileError("Deprecated: use `floatTrueMin(f80)` instead"); | |
| 55 | pub const f128_true_min = @compileError("Deprecated: use `floatTrueMin(f128)` instead"); | |
| 56 | pub const f16_min = @compileError("Deprecated: use `floatMin(f16)` instead"); | |
| 57 | pub const f32_min = @compileError("Deprecated: use `floatMin(f32)` instead"); | |
| 58 | pub const f64_min = @compileError("Deprecated: use `floatMin(f64)` instead"); | |
| 59 | pub const f80_min = @compileError("Deprecated: use `floatMin(f80)` instead"); | |
| 60 | pub const f128_min = @compileError("Deprecated: use `floatMin(f128)` instead"); | |
| 61 | pub const f16_max = @compileError("Deprecated: use `floatMax(f16)` instead"); | |
| 62 | pub const f32_max = @compileError("Deprecated: use `floatMax(f32)` instead"); | |
| 63 | pub const f64_max = @compileError("Deprecated: use `floatMax(f64)` instead"); | |
| 64 | pub const f80_max = @compileError("Deprecated: use `floatMax(f80)` instead"); | |
| 65 | pub const f128_max = @compileError("Deprecated: use `floatMax(f128)` instead"); | |
| 66 | pub const f16_epsilon = @compileError("Deprecated: use `floatEps(f16)` instead"); | |
| 67 | pub const f32_epsilon = @compileError("Deprecated: use `floatEps(f32)` instead"); | |
| 68 | pub const f64_epsilon = @compileError("Deprecated: use `floatEps(f64)` instead"); | |
| 69 | pub const f80_epsilon = @compileError("Deprecated: use `floatEps(f80)` instead"); | |
| 70 | pub const f128_epsilon = @compileError("Deprecated: use `floatEps(f128)` instead"); | |
| 71 | pub const f16_toint = @compileError("Deprecated: use `1.0 / floatEps(f16)` instead"); | |
| 72 | pub const f32_toint = @compileError("Deprecated: use `1.0 / floatEps(f32)` instead"); | |
| 73 | pub const f64_toint = @compileError("Deprecated: use `1.0 / floatEps(f64)` instead"); | |
| 74 | pub const f80_toint = @compileError("Deprecated: use `1.0 / floatEps(f80)` instead"); | |
| 75 | pub const f128_toint = @compileError("Deprecated: use `1.0 / floatEps(f128)` instead"); | |
| 76 | pub const inf_u16 = @compileError("Deprecated: use `@bitCast(u16, inf(f16))` instead"); | |
| 77 | pub const inf_f16 = @compileError("Deprecated: use `inf(f16)` instead"); | |
| 78 | pub const inf_u32 = @compileError("Deprecated: use `@bitCast(u32, inf(f32))` instead"); | |
| 79 | pub const inf_f32 = @compileError("Deprecated: use `inf(f32)` instead"); | |
| 80 | pub const inf_u64 = @compileError("Deprecated: use `@bitCast(u64, inf(f64))` instead"); | |
| 81 | pub const inf_f64 = @compileError("Deprecated: use `inf(f64)` instead"); | |
| 82 | pub const inf_f80 = @compileError("Deprecated: use `inf(f80)` instead"); | |
| 83 | pub const inf_u128 = @compileError("Deprecated: use `@bitCast(u128, inf(f128))` instead"); | |
| 84 | pub const inf_f128 = @compileError("Deprecated: use `inf(f128)` instead"); | |
| 85 | pub const epsilon = @compileError("Deprecated: use `floatEps` instead"); | |
| 88 | 86 | |
| 89 | 87 | pub const nan_u16 = @as(u16, 0x7C01); |
| 90 | 88 | pub const nan_f16 = @bitCast(f16, nan_u16); |
| ... | ... | @@ -329,7 +327,92 @@ pub const Complex = complex.Complex; |
| 329 | 327 | pub const big = @import("math/big.zig"); |
| 330 | 328 | |
| 331 | 329 | test { |
| 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 | } |
| 334 | 417 | |
| 335 | 418 | /// Given two types, returns the smallest one which is capable of holding the |
| ... | ... | @@ -771,7 +854,7 @@ test "IntFittingRange" { |
| 771 | 854 | |
| 772 | 855 | test "overflow functions" { |
| 773 | 856 | try testOverflow(); |
| 774 | comptime try testOverflow(); | |
| 857 | try comptime testOverflow(); | |
| 775 | 858 | } |
| 776 | 859 | |
| 777 | 860 | fn testOverflow() !void { |
| ... | ... | @@ -815,7 +898,7 @@ pub fn absInt(x: anytype) !@TypeOf(x) { |
| 815 | 898 | |
| 816 | 899 | test "absInt" { |
| 817 | 900 | try testAbsInt(); |
| 818 | comptime try testAbsInt(); | |
| 901 | try comptime testAbsInt(); | |
| 819 | 902 | } |
| 820 | 903 | fn testAbsInt() !void { |
| 821 | 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 | 920 | |
| 838 | 921 | test "divTrunc" { |
| 839 | 922 | try testDivTrunc(); |
| 840 | comptime try testDivTrunc(); | |
| 923 | try comptime testDivTrunc(); | |
| 841 | 924 | } |
| 842 | 925 | fn testDivTrunc() !void { |
| 843 | 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 | 944 | |
| 862 | 945 | test "divFloor" { |
| 863 | 946 | try testDivFloor(); |
| 864 | comptime try testDivFloor(); | |
| 947 | try comptime testDivFloor(); | |
| 865 | 948 | } |
| 866 | 949 | fn testDivFloor() !void { |
| 867 | 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 | 981 | |
| 899 | 982 | test "divCeil" { |
| 900 | 983 | try testDivCeil(); |
| 901 | comptime try testDivCeil(); | |
| 984 | try comptime testDivCeil(); | |
| 902 | 985 | } |
| 903 | 986 | fn testDivCeil() !void { |
| 904 | 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 | 1025 | |
| 943 | 1026 | test "divExact" { |
| 944 | 1027 | try testDivExact(); |
| 945 | comptime try testDivExact(); | |
| 1028 | try comptime testDivExact(); | |
| 946 | 1029 | } |
| 947 | 1030 | fn testDivExact() !void { |
| 948 | 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 | 1051 | |
| 969 | 1052 | test "mod" { |
| 970 | 1053 | try testMod(); |
| 971 | comptime try testMod(); | |
| 1054 | try comptime testMod(); | |
| 972 | 1055 | } |
| 973 | 1056 | fn testMod() !void { |
| 974 | 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 | 1077 | |
| 995 | 1078 | test "rem" { |
| 996 | 1079 | try testRem(); |
| 997 | comptime try testRem(); | |
| 1080 | try comptime testRem(); | |
| 998 | 1081 | } |
| 999 | 1082 | fn testRem() !void { |
| 1000 | 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 | 1253 | |
| 1171 | 1254 | test "floorPowerOfTwo" { |
| 1172 | 1255 | try testFloorPowerOfTwo(); |
| 1173 | comptime try testFloorPowerOfTwo(); | |
| 1256 | try comptime testFloorPowerOfTwo(); | |
| 1174 | 1257 | } |
| 1175 | 1258 | |
| 1176 | 1259 | fn testFloorPowerOfTwo() !void { |
| ... | ... | @@ -1232,7 +1315,7 @@ pub fn ceilPowerOfTwoAssert(comptime T: type, value: T) T { |
| 1232 | 1315 | |
| 1233 | 1316 | test "ceilPowerOfTwoPromote" { |
| 1234 | 1317 | try testCeilPowerOfTwoPromote(); |
| 1235 | comptime try testCeilPowerOfTwoPromote(); | |
| 1318 | try comptime testCeilPowerOfTwoPromote(); | |
| 1236 | 1319 | } |
| 1237 | 1320 | |
| 1238 | 1321 | fn testCeilPowerOfTwoPromote() !void { |
| ... | ... | @@ -1249,7 +1332,7 @@ fn testCeilPowerOfTwoPromote() !void { |
| 1249 | 1332 | |
| 1250 | 1333 | test "ceilPowerOfTwo" { |
| 1251 | 1334 | try testCeilPowerOfTwo(); |
| 1252 | comptime try testCeilPowerOfTwo(); | |
| 1335 | try comptime testCeilPowerOfTwo(); | |
| 1253 | 1336 | } |
| 1254 | 1337 | |
| 1255 | 1338 | fn testCeilPowerOfTwo() !void { |
| ... | ... | @@ -1668,7 +1751,7 @@ test "boolMask" { |
| 1668 | 1751 | } |
| 1669 | 1752 | }.runTest; |
| 1670 | 1753 | try runTest(); |
| 1671 | comptime try runTest(); | |
| 1754 | try comptime runTest(); | |
| 1672 | 1755 | } |
| 1673 | 1756 | |
| 1674 | 1757 | /// Return the mod of `num` with the smallest integer type |
| ... | ... | @@ -1799,5 +1882,5 @@ test "sign" { |
| 1799 | 1882 | return error.SkipZigTest; |
| 1800 | 1883 | } |
| 1801 | 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 | 3101 | |
| 3102 | 3102 | test "testReadInt" { |
| 3103 | 3103 | try testReadIntImpl(); |
| 3104 | comptime try testReadIntImpl(); | |
| 3104 | try comptime testReadIntImpl(); | |
| 3105 | 3105 | } |
| 3106 | 3106 | fn testReadIntImpl() !void { |
| 3107 | 3107 | { |
| ... | ... | @@ -3152,7 +3152,7 @@ fn testReadIntImpl() !void { |
| 3152 | 3152 | |
| 3153 | 3153 | test writeIntSlice { |
| 3154 | 3154 | try testWriteIntImpl(); |
| 3155 | comptime try testWriteIntImpl(); | |
| 3155 | try comptime testWriteIntImpl(); | |
| 3156 | 3156 | } |
| 3157 | 3157 | fn testWriteIntImpl() !void { |
| 3158 | 3158 | var bytes: [8]u8 = undefined; |
| ... | ... | @@ -4069,13 +4069,13 @@ test "bytesAsSlice keeps pointer alignment" { |
| 4069 | 4069 | { |
| 4070 | 4070 | var bytes = [_]u8{ 0x01, 0x02, 0x03, 0x04 }; |
| 4071 | 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 | 4075 | var bytes = [_]u8{ 0x01, 0x02, 0x03, 0x04 }; |
| 4076 | 4076 | var runtime_zero: usize = 0; |
| 4077 | 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 | } |
| 4081 | 4081 | |
| ... | ... | @@ -4168,7 +4168,7 @@ test "sliceAsBytes packed struct at runtime and comptime" { |
| 4168 | 4168 | } |
| 4169 | 4169 | }; |
| 4170 | 4170 | try S.doTheTest(); |
| 4171 | comptime try S.doTheTest(); | |
| 4171 | try comptime S.doTheTest(); | |
| 4172 | 4172 | } |
| 4173 | 4173 | |
| 4174 | 4174 | test "sliceAsBytes and bytesAsSlice back" { |
| ... | ... | @@ -4557,7 +4557,7 @@ test "read/write(Var)PackedInt" { |
| 4557 | 4557 | } |
| 4558 | 4558 | |
| 4559 | 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 | 4561 | const ui64 = std.meta.Int(signedness, 64); |
| 4562 | 4562 | inline for ([_]type{ PackedType, NextPowerOfTwoInt, ui64 }) |U| { |
| 4563 | 4563 | { // Variable-size Read/Write (Native-endian) |
lib/std/meta.zig+4-16| ... | ... | @@ -146,7 +146,7 @@ test "std.meta.Child" { |
| 146 | 146 | try testing.expect(Child(*u8) == u8); |
| 147 | 147 | try testing.expect(Child([]u8) == u8); |
| 148 | 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 | } |
| 151 | 151 | |
| 152 | 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 | 173 | try testing.expect(Elem([*]u8) == u8); |
| 174 | 174 | try testing.expect(Elem([]u8) == u8); |
| 175 | 175 | try testing.expect(Elem(*[10]u8) == u8); |
| 176 | try testing.expect(Elem(Vector(2, u8)) == u8); | |
| 177 | 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); | |
| 178 | 178 | try testing.expect(Elem(?[*]u8) == u8); |
| 179 | 179 | } |
| 180 | 180 | |
| ... | ... | @@ -210,7 +210,7 @@ pub fn sentinel(comptime T: type) ?Elem(T) { |
| 210 | 210 | |
| 211 | 211 | test "std.meta.sentinel" { |
| 212 | 212 | try testSentinel(); |
| 213 | comptime try testSentinel(); | |
| 213 | try comptime testSentinel(); | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | fn testSentinel() !void { |
| ... | ... | @@ -711,8 +711,6 @@ test "std.meta.DeclEnum" { |
| 711 | 711 | try expectEqualEnum(enum { a, b, c }, DeclEnum(C)); |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | pub const TagType = @compileError("deprecated; use Tag"); | |
| 715 | ||
| 716 | 714 | pub fn Tag(comptime T: type) type { |
| 717 | 715 | return switch (@typeInfo(T)) { |
| 718 | 716 | .Enum => |info| info.tag_type, |
| ... | ... | @@ -1014,16 +1012,6 @@ test "std.meta.Float" { |
| 1014 | 1012 | try testing.expectEqual(f128, Float(128)); |
| 1015 | 1013 | } |
| 1016 | 1014 | |
| 1017 | /// Deprecated. Use `@Vector`. | |
| 1018 | pub 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 | 1015 | /// For a given function type, returns a tuple type which fields will |
| 1028 | 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 | 222 | |
| 223 | 223 | test "isSingleItemPtr" { |
| 224 | 224 | const array = [_]u8{0} ** 10; |
| 225 | comptime try testing.expect(isSingleItemPtr(@TypeOf(&array[0]))); | |
| 226 | comptime try testing.expect(!isSingleItemPtr(@TypeOf(array))); | |
| 225 | try comptime testing.expect(isSingleItemPtr(@TypeOf(&array[0]))); | |
| 226 | try comptime testing.expect(!isSingleItemPtr(@TypeOf(array))); | |
| 227 | 227 | var runtime_zero: usize = 0; |
| 228 | 228 | try testing.expect(!isSingleItemPtr(@TypeOf(array[runtime_zero..1]))); |
| 229 | 229 | } |
| ... | ... | @@ -271,7 +271,7 @@ pub fn isIndexable(comptime T: type) bool { |
| 271 | 271 | test "isIndexable" { |
| 272 | 272 | const array = [_]u8{0} ** 10; |
| 273 | 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 | 275 | const tuple = .{ 1, 2, 3 }; |
| 276 | 276 | |
| 277 | 277 | try testing.expect(isIndexable(@TypeOf(array))); |
lib/std/rand.zig+1-1| ... | ... | @@ -410,7 +410,7 @@ pub const Random = struct { |
| 410 | 410 | r.uintLessThan(T, sum) |
| 411 | 411 | else if (comptime std.meta.trait.isFloat(T)) |
| 412 | 412 | // 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 | 414 | else |
| 415 | 415 | @compileError("weightedIndex does not support proportions of type " ++ @typeName(T)); |
| 416 | 416 |
lib/std/rand/test.zig+5-5| ... | ... | @@ -79,7 +79,7 @@ const Dilbert = struct { |
| 79 | 79 | |
| 80 | 80 | test "Random int" { |
| 81 | 81 | try testRandomInt(); |
| 82 | comptime try testRandomInt(); | |
| 82 | try comptime testRandomInt(); | |
| 83 | 83 | } |
| 84 | 84 | fn testRandomInt() !void { |
| 85 | 85 | var rng = SequentialPrng.init(); |
| ... | ... | @@ -126,7 +126,7 @@ fn testRandomInt() !void { |
| 126 | 126 | |
| 127 | 127 | test "Random boolean" { |
| 128 | 128 | try testRandomBoolean(); |
| 129 | comptime try testRandomBoolean(); | |
| 129 | try comptime testRandomBoolean(); | |
| 130 | 130 | } |
| 131 | 131 | fn testRandomBoolean() !void { |
| 132 | 132 | var rng = SequentialPrng.init(); |
| ... | ... | @@ -140,7 +140,7 @@ fn testRandomBoolean() !void { |
| 140 | 140 | |
| 141 | 141 | test "Random enum" { |
| 142 | 142 | try testRandomEnumValue(); |
| 143 | comptime try testRandomEnumValue(); | |
| 143 | try comptime testRandomEnumValue(); | |
| 144 | 144 | } |
| 145 | 145 | fn testRandomEnumValue() !void { |
| 146 | 146 | const TestEnum = enum { |
| ... | ... | @@ -159,7 +159,7 @@ fn testRandomEnumValue() !void { |
| 159 | 159 | test "Random intLessThan" { |
| 160 | 160 | @setEvalBranchQuota(10000); |
| 161 | 161 | try testRandomIntLessThan(); |
| 162 | comptime try testRandomIntLessThan(); | |
| 162 | try comptime testRandomIntLessThan(); | |
| 163 | 163 | } |
| 164 | 164 | fn testRandomIntLessThan() !void { |
| 165 | 165 | var rng = SequentialPrng.init(); |
| ... | ... | @@ -201,7 +201,7 @@ fn testRandomIntLessThan() !void { |
| 201 | 201 | test "Random intAtMost" { |
| 202 | 202 | @setEvalBranchQuota(10000); |
| 203 | 203 | try testRandomIntAtMost(); |
| 204 | comptime try testRandomIntAtMost(); | |
| 204 | try comptime testRandomIntAtMost(); | |
| 205 | 205 | } |
| 206 | 206 | fn testRandomIntAtMost() !void { |
| 207 | 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 | 263 | |
| 264 | 264 | test "expectApproxEqRel" { |
| 265 | 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 | 267 | const sqrt_eps_value = comptime @sqrt(eps_value); |
| 268 | 268 | |
| 269 | 269 | const pos_x: T = 12.0; |
lib/std/unicode.zig+15-15| ... | ... | @@ -354,11 +354,11 @@ fn testUtf16CountCodepoints() !void { |
| 354 | 354 | |
| 355 | 355 | test "utf16 count codepoints" { |
| 356 | 356 | try testUtf16CountCodepoints(); |
| 357 | comptime try testUtf16CountCodepoints(); | |
| 357 | try comptime testUtf16CountCodepoints(); | |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | test "utf8 encode" { |
| 361 | comptime try testUtf8Encode(); | |
| 361 | try comptime testUtf8Encode(); | |
| 362 | 362 | try testUtf8Encode(); |
| 363 | 363 | } |
| 364 | 364 | fn testUtf8Encode() !void { |
| ... | ... | @@ -384,7 +384,7 @@ fn testUtf8Encode() !void { |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | test "utf8 encode error" { |
| 387 | comptime try testUtf8EncodeError(); | |
| 387 | try comptime testUtf8EncodeError(); | |
| 388 | 388 | try testUtf8EncodeError(); |
| 389 | 389 | } |
| 390 | 390 | fn testUtf8EncodeError() !void { |
| ... | ... | @@ -400,7 +400,7 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void { |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | test "utf8 iterator on ascii" { |
| 403 | comptime try testUtf8IteratorOnAscii(); | |
| 403 | try comptime testUtf8IteratorOnAscii(); | |
| 404 | 404 | try testUtf8IteratorOnAscii(); |
| 405 | 405 | } |
| 406 | 406 | fn testUtf8IteratorOnAscii() !void { |
| ... | ... | @@ -420,7 +420,7 @@ fn testUtf8IteratorOnAscii() !void { |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | test "utf8 view bad" { |
| 423 | comptime try testUtf8ViewBad(); | |
| 423 | try comptime testUtf8ViewBad(); | |
| 424 | 424 | try testUtf8ViewBad(); |
| 425 | 425 | } |
| 426 | 426 | fn testUtf8ViewBad() !void { |
| ... | ... | @@ -430,7 +430,7 @@ fn testUtf8ViewBad() !void { |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | test "utf8 view ok" { |
| 433 | comptime try testUtf8ViewOk(); | |
| 433 | try comptime testUtf8ViewOk(); | |
| 434 | 434 | try testUtf8ViewOk(); |
| 435 | 435 | } |
| 436 | 436 | fn testUtf8ViewOk() !void { |
| ... | ... | @@ -450,7 +450,7 @@ fn testUtf8ViewOk() !void { |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | test "bad utf8 slice" { |
| 453 | comptime try testBadUtf8Slice(); | |
| 453 | try comptime testBadUtf8Slice(); | |
| 454 | 454 | try testBadUtf8Slice(); |
| 455 | 455 | } |
| 456 | 456 | fn testBadUtf8Slice() !void { |
| ... | ... | @@ -461,7 +461,7 @@ fn testBadUtf8Slice() !void { |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | test "valid utf8" { |
| 464 | comptime try testValidUtf8(); | |
| 464 | try comptime testValidUtf8(); | |
| 465 | 465 | try testValidUtf8(); |
| 466 | 466 | } |
| 467 | 467 | fn testValidUtf8() !void { |
| ... | ... | @@ -480,7 +480,7 @@ fn testValidUtf8() !void { |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | test "invalid utf8 continuation bytes" { |
| 483 | comptime try testInvalidUtf8ContinuationBytes(); | |
| 483 | try comptime testInvalidUtf8ContinuationBytes(); | |
| 484 | 484 | try testInvalidUtf8ContinuationBytes(); |
| 485 | 485 | } |
| 486 | 486 | fn testInvalidUtf8ContinuationBytes() !void { |
| ... | ... | @@ -512,7 +512,7 @@ fn testInvalidUtf8ContinuationBytes() !void { |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | test "overlong utf8 codepoint" { |
| 515 | comptime try testOverlongUtf8Codepoint(); | |
| 515 | try comptime testOverlongUtf8Codepoint(); | |
| 516 | 516 | try testOverlongUtf8Codepoint(); |
| 517 | 517 | } |
| 518 | 518 | fn testOverlongUtf8Codepoint() !void { |
| ... | ... | @@ -525,7 +525,7 @@ fn testOverlongUtf8Codepoint() !void { |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | test "misc invalid utf8" { |
| 528 | comptime try testMiscInvalidUtf8(); | |
| 528 | try comptime testMiscInvalidUtf8(); | |
| 529 | 529 | try testMiscInvalidUtf8(); |
| 530 | 530 | } |
| 531 | 531 | fn testMiscInvalidUtf8() !void { |
| ... | ... | @@ -540,7 +540,7 @@ fn testMiscInvalidUtf8() !void { |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | test "utf8 iterator peeking" { |
| 543 | comptime try testUtf8Peeking(); | |
| 543 | try comptime testUtf8Peeking(); | |
| 544 | 544 | try testUtf8Peeking(); |
| 545 | 545 | } |
| 546 | 546 | |
| ... | ... | @@ -813,7 +813,7 @@ fn testCalcUtf16LeLen() !void { |
| 813 | 813 | |
| 814 | 814 | test "calculate utf16 string length of given utf8 string in u16" { |
| 815 | 815 | try testCalcUtf16LeLen(); |
| 816 | comptime try testCalcUtf16LeLen(); | |
| 816 | try comptime testCalcUtf16LeLen(); | |
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | /// Print the given `utf16le` string |
| ... | ... | @@ -919,7 +919,7 @@ fn testUtf8CountCodepoints() !void { |
| 919 | 919 | |
| 920 | 920 | test "utf8 count codepoints" { |
| 921 | 921 | try testUtf8CountCodepoints(); |
| 922 | comptime try testUtf8CountCodepoints(); | |
| 922 | try comptime testUtf8CountCodepoints(); | |
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | fn testUtf8ValidCodepoint() !void { |
| ... | ... | @@ -935,5 +935,5 @@ fn testUtf8ValidCodepoint() !void { |
| 935 | 935 | |
| 936 | 936 | test "utf8 valid codepoint" { |
| 937 | 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 | 7 | var foo: u8 align(4) = 100; |
| 8 | 8 | |
| 9 | 9 | test "global variable alignment" { |
| 10 | comptime try expect(@typeInfo(@TypeOf(&foo)).Pointer.alignment == 4); | |
| 11 | comptime try expect(@TypeOf(&foo) == *align(4) u8); | |
| 10 | try comptime expect(@typeInfo(@TypeOf(&foo)).Pointer.alignment == 4); | |
| 11 | try comptime expect(@TypeOf(&foo) == *align(4) u8); | |
| 12 | 12 | { |
| 13 | 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 | } |
| 17 | 17 | |
| ... | ... | @@ -396,7 +396,7 @@ test "function align expression depends on generic parameter" { |
| 396 | 396 | } |
| 397 | 397 | }; |
| 398 | 398 | try S.doTheTest(); |
| 399 | comptime try S.doTheTest(); | |
| 399 | try comptime S.doTheTest(); | |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | 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 | 416 | try S.doTheTest(); |
| 417 | comptime try S.doTheTest(); | |
| 417 | try comptime S.doTheTest(); | |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | test "runtime-known array index has best alignment possible" { |
| ... | ... | @@ -452,10 +452,10 @@ test "runtime-known array index has best alignment possible" { |
| 452 | 452 | try testIndex2(&array, 3, *u8); |
| 453 | 453 | } |
| 454 | 454 | fn 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 | } |
| 457 | 457 | fn 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 | } |
| 460 | 460 | |
| 461 | 461 | test "alignment of function with c calling convention" { |
| ... | ... | @@ -517,7 +517,7 @@ test "struct field explicit alignment" { |
| 517 | 517 | var node: S.Node = undefined; |
| 518 | 518 | node.massive_byte = 100; |
| 519 | 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 | 521 | try expect(@ptrToInt(&node.massive_byte) % 64 == 0); |
| 522 | 522 | } |
| 523 | 523 |
test/behavior/alignof.zig+2-2| ... | ... | @@ -11,9 +11,9 @@ const Foo = struct { |
| 11 | 11 | }; |
| 12 | 12 | |
| 13 | 13 | test "@alignOf(T) before referencing T" { |
| 14 | comptime try expect(@alignOf(Foo) != maxInt(usize)); | |
| 14 | try comptime expect(@alignOf(Foo) != maxInt(usize)); | |
| 15 | 15 | if (native_arch == .x86_64) { |
| 16 | comptime try expect(@alignOf(Foo) == 4); | |
| 16 | try comptime expect(@alignOf(Foo) == 4); | |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 |
test/behavior/array.zig+15-15| ... | ... | @@ -67,7 +67,7 @@ test "array concat with undefined" { |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | 69 | try S.doTheTest(); |
| 70 | comptime try S.doTheTest(); | |
| 70 | try comptime S.doTheTest(); | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | test "array concat with tuple" { |
| ... | ... | @@ -154,9 +154,9 @@ test "array len field" { |
| 154 | 154 | var arr = [4]u8{ 0, 0, 0, 0 }; |
| 155 | 155 | var ptr = &arr; |
| 156 | 156 | try expect(arr.len == 4); |
| 157 | comptime try expect(arr.len == 4); | |
| 157 | try comptime expect(arr.len == 4); | |
| 158 | 158 | try expect(ptr.len == 4); |
| 159 | comptime try expect(ptr.len == 4); | |
| 159 | try comptime expect(ptr.len == 4); | |
| 160 | 160 | try expect(@TypeOf(arr.len) == usize); |
| 161 | 161 | } |
| 162 | 162 | |
| ... | ... | @@ -186,7 +186,7 @@ test "array with sentinels" { |
| 186 | 186 | }; |
| 187 | 187 | |
| 188 | 188 | try S.doTheTest(false); |
| 189 | comptime try S.doTheTest(true); | |
| 189 | try comptime S.doTheTest(true); | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | test "void arrays" { |
| ... | ... | @@ -247,7 +247,7 @@ test "single-item pointer to array indexing and slicing" { |
| 247 | 247 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 248 | 248 | |
| 249 | 249 | try testSingleItemPtrArrayIndexSlice(); |
| 250 | comptime try testSingleItemPtrArrayIndexSlice(); | |
| 250 | try comptime testSingleItemPtrArrayIndexSlice(); | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | fn testSingleItemPtrArrayIndexSlice() !void { |
| ... | ... | @@ -300,7 +300,7 @@ test "anonymous list literal syntax" { |
| 300 | 300 | } |
| 301 | 301 | }; |
| 302 | 302 | try S.doTheTest(); |
| 303 | comptime try S.doTheTest(); | |
| 303 | try comptime S.doTheTest(); | |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | var s_array: [8]Sub = undefined; |
| ... | ... | @@ -349,7 +349,7 @@ test "implicit cast single-item pointer" { |
| 349 | 349 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 350 | 350 | |
| 351 | 351 | try testImplicitCastSingleItemPtr(); |
| 352 | comptime try testImplicitCastSingleItemPtr(); | |
| 352 | try comptime testImplicitCastSingleItemPtr(); | |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | fn testImplicitCastSingleItemPtr() !void { |
| ... | ... | @@ -410,7 +410,7 @@ test "array literal as argument to function" { |
| 410 | 410 | } |
| 411 | 411 | }; |
| 412 | 412 | try S.entry(2); |
| 413 | comptime try S.entry(2); | |
| 413 | try comptime S.entry(2); | |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | 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 | 474 | try S.entry(2); |
| 475 | comptime try S.entry(2); | |
| 475 | try comptime S.entry(2); | |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | test "anonymous literal in array" { |
| ... | ... | @@ -498,7 +498,7 @@ test "anonymous literal in array" { |
| 498 | 498 | } |
| 499 | 499 | }; |
| 500 | 500 | try S.doTheTest(); |
| 501 | comptime try S.doTheTest(); | |
| 501 | try comptime S.doTheTest(); | |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | 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 | 517 | try S.doTheTest(); |
| 518 | comptime try S.doTheTest(); | |
| 518 | try comptime S.doTheTest(); | |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | test "type deduction for array subscript expression" { |
| ... | ... | @@ -534,7 +534,7 @@ test "type deduction for array subscript expression" { |
| 534 | 534 | } |
| 535 | 535 | }; |
| 536 | 536 | try S.doTheTest(); |
| 537 | comptime try S.doTheTest(); | |
| 537 | try comptime S.doTheTest(); | |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | test "sentinel element count towards the ABI size calculation" { |
| ... | ... | @@ -558,7 +558,7 @@ test "sentinel element count towards the ABI size calculation" { |
| 558 | 558 | }; |
| 559 | 559 | |
| 560 | 560 | try S.doTheTest(); |
| 561 | comptime try S.doTheTest(); | |
| 561 | try comptime S.doTheTest(); | |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | test "zero-sized array with recursive type definition" { |
| ... | ... | @@ -613,7 +613,7 @@ test "type coercion of anon struct literal to array" { |
| 613 | 613 | } |
| 614 | 614 | }; |
| 615 | 615 | try S.doTheTest(); |
| 616 | comptime try S.doTheTest(); | |
| 616 | try comptime S.doTheTest(); | |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | 619 | 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 | 648 | try S.doTheTest(); |
| 649 | comptime try S.doTheTest(); | |
| 649 | try comptime S.doTheTest(); | |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | test "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 | 331 | var foo = Foo{ .bar = simpleAsyncFn2 }; |
| 332 | 332 | var bytes: [64]u8 align(16) = undefined; |
| 333 | 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 | 335 | try expect(data == 2); |
| 336 | 336 | resume f; |
| 337 | 337 | try expect(data == 4); |
| ... | ... | @@ -1143,7 +1143,7 @@ test "@asyncCall using the result location inside the frame" { |
| 1143 | 1143 | var foo = Foo{ .bar = S.simple2 }; |
| 1144 | 1144 | var bytes: [64]u8 align(16) = undefined; |
| 1145 | 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 | 1147 | try expect(data == 2); |
| 1148 | 1148 | resume f; |
| 1149 | 1149 | try expect(data == 4); |
| ... | ... | @@ -1158,7 +1158,7 @@ test "@TypeOf an async function call of generic fn with error union type" { |
| 1158 | 1158 | const S = struct { |
| 1159 | 1159 | fn func(comptime x: anytype) anyerror!i32 { |
| 1160 | 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 | 1162 | return undefined; |
| 1163 | 1163 | } |
| 1164 | 1164 | }; |
test/behavior/atomics.zig+8-8| ... | ... | @@ -17,7 +17,7 @@ test "cmpxchg" { |
| 17 | 17 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 18 | 18 | |
| 19 | 19 | try testCmpxchg(); |
| 20 | comptime try testCmpxchg(); | |
| 20 | try comptime testCmpxchg(); | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | fn testCmpxchg() !void { |
| ... | ... | @@ -122,7 +122,7 @@ test "128-bit cmpxchg" { |
| 122 | 122 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 123 | 123 | |
| 124 | 124 | try test_u128_cmpxchg(); |
| 125 | comptime try test_u128_cmpxchg(); | |
| 125 | try comptime test_u128_cmpxchg(); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | fn test_u128_cmpxchg() !void { |
| ... | ... | @@ -195,7 +195,7 @@ test "atomic store comptime" { |
| 195 | 195 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 196 | 196 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 197 | 197 | |
| 198 | comptime try testAtomicStore(); | |
| 198 | try comptime testAtomicStore(); | |
| 199 | 199 | try testAtomicStore(); |
| 200 | 200 | } |
| 201 | 201 | |
| ... | ... | @@ -219,7 +219,7 @@ test "atomicrmw with floats" { |
| 219 | 219 | return error.SkipZigTest; |
| 220 | 220 | } |
| 221 | 221 | try testAtomicRmwFloat(); |
| 222 | comptime try testAtomicRmwFloat(); | |
| 222 | try comptime testAtomicRmwFloat(); | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | fn testAtomicRmwFloat() !void { |
| ... | ... | @@ -244,7 +244,7 @@ test "atomicrmw with ints" { |
| 244 | 244 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 245 | 245 | |
| 246 | 246 | try testAtomicRmwInts(); |
| 247 | comptime try testAtomicRmwInts(); | |
| 247 | try comptime testAtomicRmwInts(); | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | fn testAtomicRmwInts() !void { |
| ... | ... | @@ -318,8 +318,8 @@ test "atomicrmw with 128-bit ints" { |
| 318 | 318 | |
| 319 | 319 | try testAtomicRmwInt128(.signed); |
| 320 | 320 | try testAtomicRmwInt128(.unsigned); |
| 321 | comptime try testAtomicRmwInt128(.signed); | |
| 322 | comptime try testAtomicRmwInt128(.unsigned); | |
| 321 | try comptime testAtomicRmwInt128(.signed); | |
| 322 | try comptime testAtomicRmwInt128(.unsigned); | |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | fn testAtomicRmwInt128(comptime signedness: std.builtin.Signedness) !void { |
| ... | ... | @@ -441,5 +441,5 @@ test "return @atomicStore, using it as a void value" { |
| 441 | 441 | } |
| 442 | 442 | }; |
| 443 | 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 | 17 | |
| 18 | 18 | test "truncate" { |
| 19 | 19 | try expect(testTruncate(0x10fd) == 0xfd); |
| 20 | comptime try expect(testTruncate(0x10fd) == 0xfd); | |
| 20 | try comptime expect(testTruncate(0x10fd) == 0xfd); | |
| 21 | 21 | } |
| 22 | 22 | fn testTruncate(x: u32) u8 { |
| 23 | 23 | return @truncate(u8, x); |
| ... | ... | @@ -462,7 +462,7 @@ test "struct inside function" { |
| 462 | 462 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 463 | 463 | |
| 464 | 464 | try testStructInFn(); |
| 465 | comptime try testStructInFn(); | |
| 465 | try comptime testStructInFn(); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | fn testStructInFn() !void { |
| ... | ... | @@ -577,7 +577,7 @@ fn emptyFn() void {} |
| 577 | 577 | const addr1 = @ptrCast(*const u8, &emptyFn); |
| 578 | 578 | test "comptime cast fn to ptr" { |
| 579 | 579 | const addr2 = @ptrCast(*const u8, &emptyFn); |
| 580 | comptime try expect(addr1 == addr2); | |
| 580 | try comptime expect(addr1 == addr2); | |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | test "equality compare fn ptrs" { |
| ... | ... | @@ -688,8 +688,8 @@ test "string concatenation" { |
| 688 | 688 | const a = "OK" ++ " IT " ++ "WORKED"; |
| 689 | 689 | const b = "OK IT WORKED"; |
| 690 | 690 | |
| 691 | comptime try expect(@TypeOf(a) == *const [12:0]u8); | |
| 692 | comptime try expect(@TypeOf(b) == *const [12:0]u8); | |
| 691 | try comptime expect(@TypeOf(a) == *const [12:0]u8); | |
| 692 | try comptime expect(@TypeOf(b) == *const [12:0]u8); | |
| 693 | 693 | |
| 694 | 694 | const len = b.len; |
| 695 | 695 | const len_with_null = len + 1; |
| ... | ... | @@ -759,7 +759,7 @@ test "auto created variables have correct alignment" { |
| 759 | 759 | } |
| 760 | 760 | }; |
| 761 | 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 | } |
| 764 | 764 | |
| 765 | 765 | test "extern variable with non-pointer opaque type" { |
test/behavior/bitcast.zig+12-12| ... | ... | @@ -14,7 +14,7 @@ test "@bitCast iX -> uX (32, 64)" { |
| 14 | 14 | |
| 15 | 15 | inline for (bit_values) |bits| { |
| 16 | 16 | try testBitCast(bits); |
| 17 | comptime try testBitCast(bits); | |
| 17 | try comptime testBitCast(bits); | |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| ... | ... | @@ -28,7 +28,7 @@ test "@bitCast iX -> uX (8, 16, 128)" { |
| 28 | 28 | |
| 29 | 29 | inline for (bit_values) |bits| { |
| 30 | 30 | try testBitCast(bits); |
| 31 | comptime try testBitCast(bits); | |
| 31 | try comptime testBitCast(bits); | |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| ... | ... | @@ -43,7 +43,7 @@ test "@bitCast iX -> uX exotic integers" { |
| 43 | 43 | |
| 44 | 44 | inline for (bit_values) |bits| { |
| 45 | 45 | try testBitCast(bits); |
| 46 | comptime try testBitCast(bits); | |
| 46 | try comptime testBitCast(bits); | |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| ... | ... | @@ -88,7 +88,7 @@ test "bitcast uX to bytes" { |
| 88 | 88 | const bit_values = [_]usize{ 1, 48, 27, 512, 493, 293, 125, 204, 112 }; |
| 89 | 89 | inline for (bit_values) |bits| { |
| 90 | 90 | try testBitCast(bits); |
| 91 | comptime try testBitCast(bits); | |
| 91 | try comptime testBitCast(bits); | |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| ... | ... | @@ -141,7 +141,7 @@ test "nested bitcast" { |
| 141 | 141 | }; |
| 142 | 142 | |
| 143 | 143 | try S.foo(42); |
| 144 | comptime try S.foo(42); | |
| 144 | try comptime S.foo(42); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // issue #3010: compiler segfault |
| ... | ... | @@ -182,7 +182,7 @@ test "@bitCast packed structs at runtime and comptime" { |
| 182 | 182 | } |
| 183 | 183 | }; |
| 184 | 184 | try S.doTheTest(); |
| 185 | comptime try S.doTheTest(); | |
| 185 | try comptime S.doTheTest(); | |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | 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 | 216 | try S.doTheTest(); |
| 217 | comptime try S.doTheTest(); | |
| 217 | try comptime S.doTheTest(); | |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | 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 | 239 | try S.doTheTest(); |
| 240 | comptime try S.doTheTest(); | |
| 240 | try comptime S.doTheTest(); | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | 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 | 256 | try S.entry(); |
| 257 | comptime try S.entry(); | |
| 257 | try comptime S.entry(); | |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | test "bitcast packed struct literal to byte" { |
| ... | ... | @@ -275,7 +275,7 @@ test "comptime bitcast used in expression has the correct type" { |
| 275 | 275 | test "bitcast passed as tuple element" { |
| 276 | 276 | const S = struct { |
| 277 | 277 | fn foo(args: anytype) !void { |
| 278 | comptime try expect(@TypeOf(args[0]) == f32); | |
| 278 | try comptime expect(@TypeOf(args[0]) == f32); | |
| 279 | 279 | try expect(args[0] == 12.34); |
| 280 | 280 | } |
| 281 | 281 | }; |
| ... | ... | @@ -285,7 +285,7 @@ test "bitcast passed as tuple element" { |
| 285 | 285 | test "triple level result location with bitcast sandwich passed as tuple element" { |
| 286 | 286 | const S = struct { |
| 287 | 287 | fn foo(args: anytype) !void { |
| 288 | comptime try expect(@TypeOf(args[0]) == f64); | |
| 288 | try comptime expect(@TypeOf(args[0]) == f64); | |
| 289 | 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 | 326 | } |
| 327 | 327 | }; |
| 328 | 328 | try S.doTheTest(); |
| 329 | comptime try S.doTheTest(); | |
| 329 | try comptime S.doTheTest(); | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | test "comptime @bitCast packed struct to int and back" { |
test/behavior/bitreverse.zig+5-5| ... | ... | @@ -17,7 +17,7 @@ test "@bitReverse" { |
| 17 | 17 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 18 | 18 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 19 | 19 | |
| 20 | comptime try testBitReverse(); | |
| 20 | try comptime testBitReverse(); | |
| 21 | 21 | try testBitReverse(); |
| 22 | 22 | } |
| 23 | 23 | |
| ... | ... | @@ -103,7 +103,7 @@ test "bitReverse vectors u8" { |
| 103 | 103 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 104 | 104 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 105 | 105 | |
| 106 | comptime try vector8(); | |
| 106 | try comptime vector8(); | |
| 107 | 107 | try vector8(); |
| 108 | 108 | } |
| 109 | 109 | |
| ... | ... | @@ -122,7 +122,7 @@ test "bitReverse vectors u16" { |
| 122 | 122 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 123 | 123 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 124 | 124 | |
| 125 | comptime try vector16(); | |
| 125 | try comptime vector16(); | |
| 126 | 126 | try vector16(); |
| 127 | 127 | } |
| 128 | 128 | |
| ... | ... | @@ -141,7 +141,7 @@ test "bitReverse vectors u24" { |
| 141 | 141 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 142 | 142 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 143 | 143 | |
| 144 | comptime try vector24(); | |
| 144 | try comptime vector24(); | |
| 145 | 145 | try vector24(); |
| 146 | 146 | } |
| 147 | 147 | |
| ... | ... | @@ -155,6 +155,6 @@ fn vector0() !void { |
| 155 | 155 | test "bitReverse vectors u0" { |
| 156 | 156 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 157 | 157 | |
| 158 | comptime try vector0(); | |
| 158 | try comptime vector0(); | |
| 159 | 159 | try vector0(); |
| 160 | 160 | } |
test/behavior/bool.zig+1-1| ... | ... | @@ -49,7 +49,7 @@ test "compile time bool not" { |
| 49 | 49 | |
| 50 | 50 | test "short circuit" { |
| 51 | 51 | try testShortCircuit(false, true); |
| 52 | comptime try testShortCircuit(false, true); | |
| 52 | try comptime testShortCircuit(false, true); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | fn 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 | 9 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 10 | 10 | |
| 11 | 11 | try testCastPtrOfArrayToSliceAndPtr(); |
| 12 | comptime try testCastPtrOfArrayToSliceAndPtr(); | |
| 12 | try comptime testCastPtrOfArrayToSliceAndPtr(); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | fn testCastPtrOfArrayToSliceAndPtr() !void { |
test/behavior/bugs/11139.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ test "store array of array of structs at comptime" { |
| 9 | 9 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 10 | 10 | |
| 11 | 11 | try expect(storeArrayOfArrayOfStructs() == 15); |
| 12 | comptime try expect(storeArrayOfArrayOfStructs() == 15); | |
| 12 | try comptime expect(storeArrayOfArrayOfStructs() == 15); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | fn storeArrayOfArrayOfStructs() u8 { |
test/behavior/bugs/1607.zig+1-1| ... | ... | @@ -17,5 +17,5 @@ test "slices pointing at the same address as global array." { |
| 17 | 17 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 18 | 18 | |
| 19 | 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 | 17 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 18 | 18 | |
| 19 | 19 | try testCtz(); |
| 20 | comptime try testCtz(); | |
| 20 | try comptime testCtz(); | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | fn testCtz() !void { |
test/behavior/bugs/421.zig+1-1| ... | ... | @@ -7,7 +7,7 @@ test "bitCast to array" { |
| 7 | 7 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 8 | 8 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 9 | 9 | |
| 10 | comptime try testBitCastArray(); | |
| 10 | try comptime testBitCastArray(); | |
| 11 | 11 | try testBitCastArray(); |
| 12 | 12 | } |
| 13 | 13 |
test/behavior/bugs/4328.zig+3-3| ... | ... | @@ -35,7 +35,7 @@ test "Extern function calls in @TypeOf" { |
| 35 | 35 | }; |
| 36 | 36 | |
| 37 | 37 | try Test.doTheTest(); |
| 38 | comptime try Test.doTheTest(); | |
| 38 | try comptime Test.doTheTest(); | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | test "Peer resolution of extern function calls in @TypeOf" { |
| ... | ... | @@ -52,7 +52,7 @@ test "Peer resolution of extern function calls in @TypeOf" { |
| 52 | 52 | }; |
| 53 | 53 | |
| 54 | 54 | try Test.doTheTest(); |
| 55 | comptime try Test.doTheTest(); | |
| 55 | try comptime Test.doTheTest(); | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | 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 | }; |
| 79 | 79 | |
| 80 | 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 | 52 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 53 | 53 | |
| 54 | 54 | try mutable(); |
| 55 | comptime try mutable(); | |
| 55 | try comptime mutable(); | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | test "pointer-to-array constness for zero-size elements, const" { |
| 59 | 59 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 60 | 60 | |
| 61 | 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 | 3 | |
| 4 | 4 | test "function with *const parameter with type dereferenced by namespace" { |
| 5 | 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 | 7 | try foo(&x); |
| 8 | 8 | } |
| 9 | 9 |
test/behavior/byteswap.zig+5-5| ... | ... | @@ -50,7 +50,7 @@ test "@byteSwap integers" { |
| 50 | 50 | try std.testing.expect(expected_output == @byteSwap(input)); |
| 51 | 51 | } |
| 52 | 52 | }; |
| 53 | comptime try ByteSwapIntTest.run(); | |
| 53 | try comptime ByteSwapIntTest.run(); | |
| 54 | 54 | try ByteSwapIntTest.run(); |
| 55 | 55 | } |
| 56 | 56 | |
| ... | ... | @@ -69,7 +69,7 @@ test "@byteSwap vectors u8" { |
| 69 | 69 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 70 | 70 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 71 | 71 | |
| 72 | comptime try vector8(); | |
| 72 | try comptime vector8(); | |
| 73 | 73 | try vector8(); |
| 74 | 74 | } |
| 75 | 75 | |
| ... | ... | @@ -88,7 +88,7 @@ test "@byteSwap vectors u16" { |
| 88 | 88 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 89 | 89 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 90 | 90 | |
| 91 | comptime try vector16(); | |
| 91 | try comptime vector16(); | |
| 92 | 92 | try vector16(); |
| 93 | 93 | } |
| 94 | 94 | |
| ... | ... | @@ -107,7 +107,7 @@ test "@byteSwap vectors u24" { |
| 107 | 107 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 108 | 108 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 109 | 109 | |
| 110 | comptime try vector24(); | |
| 110 | try comptime vector24(); | |
| 111 | 111 | try vector24(); |
| 112 | 112 | } |
| 113 | 113 | |
| ... | ... | @@ -121,6 +121,6 @@ fn vector0() !void { |
| 121 | 121 | test "@byteSwap vectors u0" { |
| 122 | 122 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 123 | 123 | |
| 124 | comptime try vector0(); | |
| 124 | try comptime vector0(); | |
| 125 | 125 | try vector0(); |
| 126 | 126 | } |
test/behavior/call.zig+5-5| ... | ... | @@ -10,11 +10,11 @@ test "super basic invocations" { |
| 10 | 10 | } |
| 11 | 11 | }.foo; |
| 12 | 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 | 15 | // comptime call without comptime keyword |
| 16 | 16 | const result = @call(.compile_time, foo, .{}) == 1234; |
| 17 | comptime try expect(result); | |
| 17 | try comptime expect(result); | |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| ... | ... | @@ -42,7 +42,7 @@ test "basic invocations" { |
| 42 | 42 | { |
| 43 | 43 | // comptime call without comptime keyword |
| 44 | 44 | const result = @call(.compile_time, foo, .{}) == 1234; |
| 45 | comptime try expect(result); | |
| 45 | try comptime expect(result); | |
| 46 | 46 | } |
| 47 | 47 | { |
| 48 | 48 | // call of non comptime-known function |
| ... | ... | @@ -71,7 +71,7 @@ test "tuple parameters" { |
| 71 | 71 | try expect(@call(.auto, add, .{ a, b }) == 46); |
| 72 | 72 | try expect(@call(.auto, add, .{ 12, 34 }) == 46); |
| 73 | 73 | if (false) { |
| 74 | comptime try expect(@call(.auto, add, .{ 12, 34 }) == 46); // TODO | |
| 74 | try comptime expect(@call(.auto, add, .{ 12, 34 }) == 46); // TODO | |
| 75 | 75 | } |
| 76 | 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 | 344 | }; |
| 345 | 345 | const ArgTuple = std.meta.ArgsTuple(@TypeOf(S.foo)); |
| 346 | 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 | } |
| 349 | 349 | |
| 350 | 350 | test "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 | 39 | |
| 40 | 40 | test "resolve undefined with integer" { |
| 41 | 41 | try testResolveUndefWithInt(true, 1234); |
| 42 | comptime try testResolveUndefWithInt(true, 1234); | |
| 42 | try comptime testResolveUndefWithInt(true, 1234); | |
| 43 | 43 | } |
| 44 | 44 | fn testResolveUndefWithInt(b: bool, x: i32) !void { |
| 45 | 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 | 59 | } |
| 60 | 60 | |
| 61 | 61 | test "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 | 63 | try expect(2 == 2.0); |
| 64 | 64 | } |
| 65 | 65 | |
| ... | ... | @@ -110,7 +110,7 @@ test "@intToFloat" { |
| 110 | 110 | } |
| 111 | 111 | }; |
| 112 | 112 | try S.doTheTest(); |
| 113 | comptime try S.doTheTest(); | |
| 113 | try comptime S.doTheTest(); | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | test "@intToFloat(f80)" { |
| ... | ... | @@ -140,13 +140,13 @@ test "@intToFloat(f80)" { |
| 140 | 140 | try S.doTheTest(i80); |
| 141 | 141 | try S.doTheTest(i128); |
| 142 | 142 | // try S.doTheTest(i256); // TODO missing compiler_rt symbols |
| 143 | comptime try S.doTheTest(i31); | |
| 144 | comptime try S.doTheTest(i32); | |
| 145 | comptime try S.doTheTest(i45); | |
| 146 | comptime try S.doTheTest(i64); | |
| 147 | comptime try S.doTheTest(i80); | |
| 148 | comptime try S.doTheTest(i128); | |
| 149 | comptime try S.doTheTest(i256); | |
| 143 | try comptime S.doTheTest(i31); | |
| 144 | try comptime S.doTheTest(i32); | |
| 145 | try comptime S.doTheTest(i45); | |
| 146 | try comptime S.doTheTest(i64); | |
| 147 | try comptime S.doTheTest(i80); | |
| 148 | try comptime S.doTheTest(i128); | |
| 149 | try comptime S.doTheTest(i256); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | test "@floatToInt" { |
| ... | ... | @@ -156,7 +156,7 @@ test "@floatToInt" { |
| 156 | 156 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 157 | 157 | |
| 158 | 158 | try testFloatToInts(); |
| 159 | comptime try testFloatToInts(); | |
| 159 | try comptime testFloatToInts(); | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | fn testFloatToInts() !void { |
| ... | ... | @@ -291,7 +291,7 @@ test "@intCast to u0 and use the result" { |
| 291 | 291 | } |
| 292 | 292 | }; |
| 293 | 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 | } |
| 296 | 296 | |
| 297 | 297 | test "peer result null and comptime_int" { |
| ... | ... | @@ -312,11 +312,11 @@ test "peer result null and comptime_int" { |
| 312 | 312 | }; |
| 313 | 313 | |
| 314 | 314 | try expect(S.blah(0) == null); |
| 315 | comptime try expect(S.blah(0) == null); | |
| 315 | try comptime expect(S.blah(0) == null); | |
| 316 | 316 | try expect(S.blah(10).? == 1); |
| 317 | comptime try expect(S.blah(10).? == 1); | |
| 317 | try comptime expect(S.blah(10).? == 1); | |
| 318 | 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 | } |
| 321 | 321 | |
| 322 | 322 | test "*const ?[*]const T to [*c]const [*c]const T" { |
| ... | ... | @@ -375,7 +375,7 @@ test "return u8 coercing into ?u32 return type" { |
| 375 | 375 | } |
| 376 | 376 | }; |
| 377 | 377 | try S.doTheTest(); |
| 378 | comptime try S.doTheTest(); | |
| 378 | try comptime S.doTheTest(); | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | test "cast from ?[*]T to ??[*]T" { |
| ... | ... | @@ -392,7 +392,7 @@ test "peer type unsigned int to signed" { |
| 392 | 392 | var x: u8 = 7; |
| 393 | 393 | var y: i32 = -5; |
| 394 | 394 | var a = w + y + x; |
| 395 | comptime try expect(@TypeOf(a) == i32); | |
| 395 | try comptime expect(@TypeOf(a) == i32); | |
| 396 | 396 | try expect(a == 7); |
| 397 | 397 | } |
| 398 | 398 | |
| ... | ... | @@ -414,7 +414,7 @@ test "explicit cast from integer to error type" { |
| 414 | 414 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 415 | 415 | |
| 416 | 416 | try testCastIntToErr(error.ItBroke); |
| 417 | comptime try testCastIntToErr(error.ItBroke); | |
| 417 | try comptime testCastIntToErr(error.ItBroke); | |
| 418 | 418 | } |
| 419 | 419 | fn testCastIntToErr(err: anyerror) !void { |
| 420 | 420 | const x = @errorToInt(err); |
| ... | ... | @@ -428,7 +428,7 @@ test "peer resolve array and const slice" { |
| 428 | 428 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 429 | 429 | |
| 430 | 430 | try testPeerResolveArrayConstSlice(true); |
| 431 | comptime try testPeerResolveArrayConstSlice(true); | |
| 431 | try comptime testPeerResolveArrayConstSlice(true); | |
| 432 | 432 | } |
| 433 | 433 | fn testPeerResolveArrayConstSlice(b: bool) !void { |
| 434 | 434 | const value1 = if (b) "aoeu" else @as([]const u8, "zz"); |
| ... | ... | @@ -444,7 +444,7 @@ test "implicitly cast from T to anyerror!?T" { |
| 444 | 444 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 445 | 445 | |
| 446 | 446 | try castToOptionalTypeError(1); |
| 447 | comptime try castToOptionalTypeError(1); | |
| 447 | try comptime castToOptionalTypeError(1); | |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | const A = struct { |
| ... | ... | @@ -470,7 +470,7 @@ test "implicitly cast from [0]T to anyerror![]T" { |
| 470 | 470 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 471 | 471 | |
| 472 | 472 | try testCastZeroArrayToErrSliceMut(); |
| 473 | comptime try testCastZeroArrayToErrSliceMut(); | |
| 473 | try comptime testCastZeroArrayToErrSliceMut(); | |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | fn testCastZeroArrayToErrSliceMut() !void { |
| ... | ... | @@ -504,7 +504,7 @@ test "peer type resolution: [0]u8, []const u8, and anyerror![]u8" { |
| 504 | 504 | } |
| 505 | 505 | }; |
| 506 | 506 | try S.doTheTest(); |
| 507 | comptime try S.doTheTest(); | |
| 507 | try comptime S.doTheTest(); | |
| 508 | 508 | } |
| 509 | 509 | fn peerTypeEmptyArrayAndSliceAndError(a: bool, slice: []u8) anyerror![]u8 { |
| 510 | 510 | if (a) { |
| ... | ... | @@ -520,7 +520,7 @@ test "implicit cast from *const [N]T to []const T" { |
| 520 | 520 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 521 | 521 | |
| 522 | 522 | try testCastConstArrayRefToConstSlice(); |
| 523 | comptime try testCastConstArrayRefToConstSlice(); | |
| 523 | try comptime testCastConstArrayRefToConstSlice(); | |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | fn testCastConstArrayRefToConstSlice() !void { |
| ... | ... | @@ -546,9 +546,9 @@ test "peer type resolution: error and [N]T" { |
| 546 | 546 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 547 | 547 | |
| 548 | 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 | 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 | } |
| 553 | 553 | |
| 554 | 554 | fn testPeerErrorAndArray(x: u8) anyerror![]const u8 { |
| ... | ... | @@ -571,7 +571,7 @@ test "single-item pointer of array to slice to unknown length pointer" { |
| 571 | 571 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 572 | 572 | |
| 573 | 573 | try testCastPtrOfArrayToSliceAndPtr(); |
| 574 | comptime try testCastPtrOfArrayToSliceAndPtr(); | |
| 574 | try comptime testCastPtrOfArrayToSliceAndPtr(); | |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | fn testCastPtrOfArrayToSliceAndPtr() !void { |
| ... | ... | @@ -644,9 +644,9 @@ test "vector casts" { |
| 644 | 644 | }; |
| 645 | 645 | |
| 646 | 646 | try S.doTheTest(); |
| 647 | comptime try S.doTheTest(); | |
| 647 | try comptime S.doTheTest(); | |
| 648 | 648 | try S.doTheTestFloat(); |
| 649 | comptime try S.doTheTestFloat(); | |
| 649 | try comptime S.doTheTestFloat(); | |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | test "@floatCast cast down" { |
| ... | ... | @@ -887,7 +887,7 @@ test "peer resolution of string literals" { |
| 887 | 887 | } |
| 888 | 888 | }; |
| 889 | 889 | try S.doTheTest(.b); |
| 890 | comptime try S.doTheTest(.b); | |
| 890 | try comptime S.doTheTest(.b); | |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | test "peer cast [:x]T to []T" { |
| ... | ... | @@ -904,7 +904,7 @@ test "peer cast [:x]T to []T" { |
| 904 | 904 | } |
| 905 | 905 | }; |
| 906 | 906 | try S.doTheTest(); |
| 907 | comptime try S.doTheTest(); | |
| 907 | try comptime S.doTheTest(); | |
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | 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 | 922 | try S.doTheTest(); |
| 923 | comptime try S.doTheTest(); | |
| 923 | try comptime S.doTheTest(); | |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | 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 | 938 | try S.doTheTest(); |
| 939 | comptime try S.doTheTest(); | |
| 939 | try comptime S.doTheTest(); | |
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | test "peer cast [*:x]T to [*]T" { |
| ... | ... | @@ -956,7 +956,7 @@ test "peer cast [*:x]T to [*]T" { |
| 956 | 956 | } |
| 957 | 957 | }; |
| 958 | 958 | try S.doTheTest(); |
| 959 | comptime try S.doTheTest(); | |
| 959 | try comptime S.doTheTest(); | |
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | 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 | 980 | try S.doTheTest(); |
| 981 | comptime try S.doTheTest(); | |
| 981 | try comptime S.doTheTest(); | |
| 982 | 982 | } |
| 983 | 983 | |
| 984 | 984 | 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 | 1001 | try S.doTheTest(); |
| 1002 | comptime try S.doTheTest(); | |
| 1002 | try comptime S.doTheTest(); | |
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | 1005 | 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 | 1020 | try S.doTheTest(); |
| 1021 | comptime try S.doTheTest(); | |
| 1021 | try comptime S.doTheTest(); | |
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | test "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 | 1042 | } |
| 1043 | 1043 | }; |
| 1044 | 1044 | try S.doTheTest(); |
| 1045 | comptime try S.doTheTest(); | |
| 1045 | try comptime S.doTheTest(); | |
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | 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 | 1053 | var array: [4:0]u8 = undefined; |
| 1054 | 1054 | array[4] = 0; // TODO remove this when #4372 is solved |
| 1055 | 1055 | var slice: [:0]u8 = array[0..4 :0]; |
| 1056 | comptime try expect(@TypeOf(slice, "hi") == [:0]const u8); | |
| 1057 | comptime try expect(@TypeOf("hi", slice) == [:0]const u8); | |
| 1056 | try comptime expect(@TypeOf(slice, "hi") == [:0]const u8); | |
| 1057 | try comptime expect(@TypeOf("hi", slice) == [:0]const u8); | |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | 1060 | test "peer type resolve array pointers, one of them const" { |
| ... | ... | @@ -1062,8 +1062,8 @@ test "peer type resolve array pointers, one of them const" { |
| 1062 | 1062 | |
| 1063 | 1063 | var array1: [4]u8 = undefined; |
| 1064 | 1064 | const array2: [5]u8 = undefined; |
| 1065 | comptime try expect(@TypeOf(&array1, &array2) == []const u8); | |
| 1066 | comptime try expect(@TypeOf(&array2, &array1) == []const u8); | |
| 1065 | try comptime expect(@TypeOf(&array1, &array2) == []const u8); | |
| 1066 | try comptime expect(@TypeOf(&array2, &array1) == []const u8); | |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | test "peer type resolve array pointer and unknown pointer" { |
| ... | ... | @@ -1074,17 +1074,17 @@ test "peer type resolve array pointer and unknown pointer" { |
| 1074 | 1074 | var const_ptr: [*]const u8 = undefined; |
| 1075 | 1075 | var ptr: [*]u8 = undefined; |
| 1076 | 1076 | |
| 1077 | comptime try expect(@TypeOf(&array, ptr) == [*]u8); | |
| 1078 | comptime try expect(@TypeOf(ptr, &array) == [*]u8); | |
| 1077 | try comptime expect(@TypeOf(&array, ptr) == [*]u8); | |
| 1078 | try comptime expect(@TypeOf(ptr, &array) == [*]u8); | |
| 1079 | 1079 | |
| 1080 | comptime try expect(@TypeOf(&const_array, ptr) == [*]const u8); | |
| 1081 | comptime try expect(@TypeOf(ptr, &const_array) == [*]const u8); | |
| 1080 | try comptime expect(@TypeOf(&const_array, ptr) == [*]const u8); | |
| 1081 | try comptime expect(@TypeOf(ptr, &const_array) == [*]const u8); | |
| 1082 | 1082 | |
| 1083 | comptime try expect(@TypeOf(&array, const_ptr) == [*]const u8); | |
| 1084 | comptime try expect(@TypeOf(const_ptr, &array) == [*]const u8); | |
| 1083 | try comptime expect(@TypeOf(&array, const_ptr) == [*]const u8); | |
| 1084 | try comptime expect(@TypeOf(const_ptr, &array) == [*]const u8); | |
| 1085 | 1085 | |
| 1086 | comptime try expect(@TypeOf(&const_array, const_ptr) == [*]const u8); | |
| 1087 | comptime try expect(@TypeOf(const_ptr, &const_array) == [*]const u8); | |
| 1086 | try comptime expect(@TypeOf(&const_array, const_ptr) == [*]const u8); | |
| 1087 | try comptime expect(@TypeOf(const_ptr, &const_array) == [*]const u8); | |
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | test "comptime float casts" { |
| ... | ... | @@ -1209,7 +1209,7 @@ test "implicitly cast from [N]T to ?[]const T" { |
| 1209 | 1209 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1210 | 1210 | |
| 1211 | 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 | } |
| 1214 | 1214 | |
| 1215 | 1215 | fn castToOptionalSlice() ?[]const u8 { |
| ... | ... | @@ -1223,7 +1223,7 @@ test "cast u128 to f128 and back" { |
| 1223 | 1223 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1224 | 1224 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1225 | 1225 | |
| 1226 | comptime try testCast128(); | |
| 1226 | try comptime testCast128(); | |
| 1227 | 1227 | try testCast128(); |
| 1228 | 1228 | } |
| 1229 | 1229 | |
| ... | ... | @@ -1303,7 +1303,7 @@ test "*const [N]null u8 to ?[]const u8" { |
| 1303 | 1303 | } |
| 1304 | 1304 | }; |
| 1305 | 1305 | try S.doTheTest(); |
| 1306 | comptime try S.doTheTest(); | |
| 1306 | try comptime S.doTheTest(); | |
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | test "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 | 1352 | |
| 1353 | 1353 | try expect(mem.eql(u8, boolToStr(true), "true")); |
| 1354 | 1354 | try expect(mem.eql(u8, boolToStr(false), "false")); |
| 1355 | comptime try expect(mem.eql(u8, boolToStr(true), "true")); | |
| 1356 | comptime try expect(mem.eql(u8, boolToStr(false), "false")); | |
| 1355 | try comptime expect(mem.eql(u8, boolToStr(true), "true")); | |
| 1356 | try comptime expect(mem.eql(u8, boolToStr(false), "false")); | |
| 1357 | 1357 | } |
| 1358 | 1358 | fn boolToStr(b: bool) []const u8 { |
| 1359 | 1359 | return if (b) "true" else "false"; |
| ... | ... | @@ -1376,7 +1376,7 @@ test "cast f16 to wider types" { |
| 1376 | 1376 | } |
| 1377 | 1377 | }; |
| 1378 | 1378 | try S.doTheTest(); |
| 1379 | comptime try S.doTheTest(); | |
| 1379 | try comptime S.doTheTest(); | |
| 1380 | 1380 | } |
| 1381 | 1381 | |
| 1382 | 1382 | test "cast f128 to narrower types" { |
| ... | ... | @@ -1396,7 +1396,7 @@ test "cast f128 to narrower types" { |
| 1396 | 1396 | } |
| 1397 | 1397 | }; |
| 1398 | 1398 | try S.doTheTest(); |
| 1399 | comptime try S.doTheTest(); | |
| 1399 | try comptime S.doTheTest(); | |
| 1400 | 1400 | } |
| 1401 | 1401 | |
| 1402 | 1402 | test "peer type resolution: unreachable, null, slice" { |
| ... | ... | @@ -1436,7 +1436,7 @@ test "cast i8 fn call peers to i32 result" { |
| 1436 | 1436 | } |
| 1437 | 1437 | }; |
| 1438 | 1438 | try S.doTheTest(); |
| 1439 | comptime try S.doTheTest(); | |
| 1439 | try comptime S.doTheTest(); | |
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | 1442 | test "cast compatible optional types" { |
| ... | ... | @@ -1509,7 +1509,7 @@ test "floatToInt to zero-bit int" { |
| 1509 | 1509 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1510 | 1510 | |
| 1511 | 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 | } |
| 1514 | 1514 | |
| 1515 | 1515 | test "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 | 257 | try testing.expectEqual(lazy_address, unshuffled1_rt); |
| 258 | 258 | const shuffled1_ct = comptime shuffle(lazy_address, Bits, ShuffledBits); |
| 259 | 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 | 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 | 263 | try testing.expectEqual(shuffled1_ct, shuffled1_rt); |
| 264 | 264 | } |
| 265 | 265 |
test/behavior/defer.zig+3-3| ... | ... | @@ -70,7 +70,7 @@ test "return variable while defer expression in scope to modify it" { |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | 72 | try S.doTheTest(); |
| 73 | comptime try S.doTheTest(); | |
| 73 | try comptime S.doTheTest(); | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | var result: [3]u8 = undefined; |
| ... | ... | @@ -131,7 +131,7 @@ test "errdefer with payload" { |
| 131 | 131 | } |
| 132 | 132 | }; |
| 133 | 133 | try S.doTheTest(); |
| 134 | comptime try S.doTheTest(); | |
| 134 | try comptime S.doTheTest(); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | test "reference to errdefer payload" { |
| ... | ... | @@ -157,7 +157,7 @@ test "reference to errdefer payload" { |
| 157 | 157 | } |
| 158 | 158 | }; |
| 159 | 159 | try S.doTheTest(); |
| 160 | comptime try S.doTheTest(); | |
| 160 | try comptime S.doTheTest(); | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | test "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 | 611 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 612 | 612 | |
| 613 | 613 | try testEnumWithSpecifiedTagValues(MultipleChoice.C); |
| 614 | comptime try testEnumWithSpecifiedTagValues(MultipleChoice.C); | |
| 614 | try comptime testEnumWithSpecifiedTagValues(MultipleChoice.C); | |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | test "non-exhaustive enum" { |
| ... | ... | @@ -656,7 +656,7 @@ test "non-exhaustive enum" { |
| 656 | 656 | } |
| 657 | 657 | }; |
| 658 | 658 | try S.doTheTest(52); |
| 659 | comptime try S.doTheTest(52); | |
| 659 | try comptime S.doTheTest(52); | |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | test "empty non-exhaustive enum" { |
| ... | ... | @@ -677,7 +677,7 @@ test "empty non-exhaustive enum" { |
| 677 | 677 | } |
| 678 | 678 | }; |
| 679 | 679 | try S.doTheTest(42); |
| 680 | comptime try S.doTheTest(42); | |
| 680 | try comptime S.doTheTest(42); | |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | test "single field non-exhaustive enum" { |
| ... | ... | @@ -715,7 +715,7 @@ test "single field non-exhaustive enum" { |
| 715 | 715 | } |
| 716 | 716 | }; |
| 717 | 717 | try S.doTheTest(23); |
| 718 | comptime try S.doTheTest(23); | |
| 718 | try comptime S.doTheTest(23); | |
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | const EnumWithTagValues = enum(u4) { |
| ... | ... | @@ -750,7 +750,7 @@ test "enum with specified and unspecified tag values" { |
| 750 | 750 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 751 | 751 | |
| 752 | 752 | try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D); |
| 753 | comptime try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D); | |
| 753 | try comptime testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D); | |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { |
| ... | ... | @@ -775,18 +775,18 @@ test "set enum tag type" { |
| 775 | 775 | { |
| 776 | 776 | var x = Small.One; |
| 777 | 777 | x = Small.Two; |
| 778 | comptime try expect(Tag(Small) == u2); | |
| 778 | try comptime expect(Tag(Small) == u2); | |
| 779 | 779 | } |
| 780 | 780 | { |
| 781 | 781 | var x = Small2.One; |
| 782 | 782 | x = Small2.Two; |
| 783 | comptime try expect(Tag(Small2) == u2); | |
| 783 | try comptime expect(Tag(Small2) == u2); | |
| 784 | 784 | } |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | test "casting enum to its tag type" { |
| 788 | 788 | try testCastEnumTag(Small2.Two); |
| 789 | comptime try testCastEnumTag(Small2.Two); | |
| 789 | try comptime testCastEnumTag(Small2.Two); | |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | fn testCastEnumTag(value: Small2) !void { |
| ... | ... | @@ -797,7 +797,7 @@ test "enum with 1 field but explicit tag type should still have the tag type" { |
| 797 | 797 | const Enum = enum(u8) { |
| 798 | 798 | B = 2, |
| 799 | 799 | }; |
| 800 | comptime try expect(@sizeOf(Enum) == @sizeOf(u8)); | |
| 800 | try comptime expect(@sizeOf(Enum) == @sizeOf(u8)); | |
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | test "signed integer as enum tag" { |
| ... | ... | @@ -836,12 +836,12 @@ test "enum with comptime_int tag type" { |
| 836 | 836 | Two = 2, |
| 837 | 837 | Three = 1, |
| 838 | 838 | }; |
| 839 | comptime try expect(Tag(Enum) == comptime_int); | |
| 839 | try comptime expect(Tag(Enum) == comptime_int); | |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | test "enum with one member default to u0 tag type" { |
| 843 | 843 | const E0 = enum { X }; |
| 844 | comptime try expect(Tag(E0) == u0); | |
| 844 | try comptime expect(Tag(E0) == u0); | |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | const EnumWithOneMember = enum { Eof }; |
| ... | ... | @@ -891,7 +891,7 @@ test "method call on an enum" { |
| 891 | 891 | } |
| 892 | 892 | }; |
| 893 | 893 | try S.doTheTest(); |
| 894 | comptime try S.doTheTest(); | |
| 894 | try comptime S.doTheTest(); | |
| 895 | 895 | } |
| 896 | 896 | |
| 897 | 897 | test "enum value allocation" { |
| ... | ... | @@ -993,7 +993,7 @@ test "@tagName" { |
| 993 | 993 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 994 | 994 | |
| 995 | 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 | } |
| 998 | 998 | |
| 999 | 999 | fn testEnumTagNameBare(n: anytype) []const u8 { |
| ... | ... | @@ -1009,7 +1009,7 @@ test "@tagName non-exhaustive enum" { |
| 1009 | 1009 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1010 | 1010 | |
| 1011 | 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 | } |
| 1014 | 1014 | const NonExhaustive = enum(u8) { A, B, _ }; |
| 1015 | 1015 | |
| ... | ... | @@ -1047,7 +1047,7 @@ test "@tagName on enum literals" { |
| 1047 | 1047 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1048 | 1048 | |
| 1049 | 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 | } |
| 1052 | 1052 | |
| 1053 | 1053 | test "enum literal casting to optional" { |
| ... | ... | @@ -1088,7 +1088,7 @@ test "bit field access with enum fields" { |
| 1088 | 1088 | try expect(getA(&data) == A.Two); |
| 1089 | 1089 | try expect(getB(&data) == B.Three3); |
| 1090 | 1090 | try expect(getC(&data) == C.Four4); |
| 1091 | comptime try expect(@sizeOf(BitFieldOfEnums) == 1); | |
| 1091 | try comptime expect(@sizeOf(BitFieldOfEnums) == 1); | |
| 1092 | 1092 | |
| 1093 | 1093 | data.b = B.Four3; |
| 1094 | 1094 | try expect(data.b == B.Four3); |
test/behavior/error.zig+11-11| ... | ... | @@ -188,7 +188,7 @@ fn bar2() (error{}!void) {} |
| 188 | 188 | |
| 189 | 189 | test "error union type " { |
| 190 | 190 | try testErrorUnionType(); |
| 191 | comptime try testErrorUnionType(); | |
| 191 | try comptime testErrorUnionType(); | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | fn testErrorUnionType() !void { |
| ... | ... | @@ -201,7 +201,7 @@ fn testErrorUnionType() !void { |
| 201 | 201 | |
| 202 | 202 | test "error set type" { |
| 203 | 203 | try testErrorSetType(); |
| 204 | comptime try testErrorSetType(); | |
| 204 | try comptime testErrorSetType(); | |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | const MyErrSet = error{ |
| ... | ... | @@ -227,7 +227,7 @@ test "explicit error set cast" { |
| 227 | 227 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 228 | 228 | |
| 229 | 229 | try testExplicitErrorSetCast(Set1.A); |
| 230 | comptime try testExplicitErrorSetCast(Set1.A); | |
| 230 | try comptime testExplicitErrorSetCast(Set1.A); | |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | const Set1 = error{ A, B }; |
| ... | ... | @@ -246,7 +246,7 @@ test "comptime test error for empty error set" { |
| 246 | 246 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 247 | 247 | |
| 248 | 248 | try testComptimeTestErrorEmptySet(1234); |
| 249 | comptime try testComptimeTestErrorEmptySet(1234); | |
| 249 | try comptime testComptimeTestErrorEmptySet(1234); | |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | const EmptyErrorSet = error{}; |
| ... | ... | @@ -337,7 +337,7 @@ test "error: Zero sized error set returned with value payload crash" { |
| 337 | 337 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 338 | 338 | |
| 339 | 339 | _ = try foo3(0); |
| 340 | _ = comptime try foo3(0); | |
| 340 | _ = try comptime foo3(0); | |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | const Error = error{}; |
| ... | ... | @@ -446,7 +446,7 @@ test "return function call to error set from error union function" { |
| 446 | 446 | } |
| 447 | 447 | }; |
| 448 | 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 | } |
| 451 | 451 | |
| 452 | 452 | 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 | 455 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 456 | 456 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 457 | 457 | |
| 458 | comptime try expect(@sizeOf(?anyerror) == @sizeOf(anyerror)); | |
| 459 | comptime try expect(@alignOf(?anyerror) == @alignOf(anyerror)); | |
| 458 | try comptime expect(@sizeOf(?anyerror) == @sizeOf(anyerror)); | |
| 459 | try comptime expect(@alignOf(?anyerror) == @alignOf(anyerror)); | |
| 460 | 460 | const S = struct { |
| 461 | 461 | fn returnsOptErrSet() ?anyerror { |
| 462 | 462 | return null; |
| 463 | 463 | } |
| 464 | 464 | }; |
| 465 | 465 | try expect(S.returnsOptErrSet() == null); |
| 466 | comptime try expect(S.returnsOptErrSet() == null); | |
| 466 | try comptime expect(S.returnsOptErrSet() == null); | |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | test "nested catch" { |
| ... | ... | @@ -489,7 +489,7 @@ test "nested catch" { |
| 489 | 489 | }; |
| 490 | 490 | }; |
| 491 | 491 | try S.entry(); |
| 492 | comptime try S.entry(); | |
| 492 | try comptime S.entry(); | |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | test "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 | 545 | } |
| 546 | 546 | }; |
| 547 | 547 | try S.doTheTest(); |
| 548 | comptime try S.doTheTest(); | |
| 548 | try comptime S.doTheTest(); | |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | test "error payload type is correctly resolved" { |
test/behavior/eval.zig+10-10| ... | ... | @@ -56,7 +56,7 @@ fn staticAdd(a: i32, b: i32) i32 { |
| 56 | 56 | |
| 57 | 57 | test "const expr eval on single expr blocks" { |
| 58 | 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 | } |
| 61 | 61 | |
| 62 | 62 | fn constExprEvalOnSingleExprBlocksFn(x: i32, b: bool) i32 { |
| ... | ... | @@ -436,7 +436,7 @@ test "f64 at compile time is lossy" { |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | test { |
| 439 | comptime try expect(@as(f128, 1 << 113) == 10384593717069655257060992658440192); | |
| 439 | try comptime expect(@as(f128, 1 << 113) == 10384593717069655257060992658440192); | |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | fn copyWithPartialInline(s: []u32, b: []u8) void { |
| ... | ... | @@ -625,7 +625,7 @@ test "const global shares pointer with other same one" { |
| 625 | 625 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 626 | 626 | |
| 627 | 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 | } |
| 630 | 630 | fn assertEqualPtrs(ptr1: *const u8, ptr2: *const u8) !void { |
| 631 | 631 | try expect(ptr1 == ptr2); |
| ... | ... | @@ -646,8 +646,8 @@ fn assertEqualPtrs(ptr1: *const u8, ptr2: *const u8) !void { |
| 646 | 646 | test "string literal used as comptime slice is memoized" { |
| 647 | 647 | const a = "link"; |
| 648 | 648 | const b = "link"; |
| 649 | comptime try expect(TypeWithCompTimeSlice(a).Node == TypeWithCompTimeSlice(b).Node); | |
| 650 | comptime try expect(TypeWithCompTimeSlice("link").Node == TypeWithCompTimeSlice("link").Node); | |
| 649 | try comptime expect(TypeWithCompTimeSlice(a).Node == TypeWithCompTimeSlice(b).Node); | |
| 650 | try comptime expect(TypeWithCompTimeSlice("link").Node == TypeWithCompTimeSlice("link").Node); | |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | pub fn TypeWithCompTimeSlice(comptime field_name: []const u8) type { |
| ... | ... | @@ -1072,7 +1072,7 @@ test "comptime break operand passing through runtime condition converted to runt |
| 1072 | 1072 | }; |
| 1073 | 1073 | |
| 1074 | 1074 | try S.doTheTest('b'); |
| 1075 | comptime try S.doTheTest('b'); | |
| 1075 | try comptime S.doTheTest('b'); | |
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | test "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 | 1092 | }; |
| 1093 | 1093 | |
| 1094 | 1094 | try S.doTheTest('b'); |
| 1095 | comptime try S.doTheTest('b'); | |
| 1095 | try comptime S.doTheTest('b'); | |
| 1096 | 1096 | } |
| 1097 | 1097 | |
| 1098 | 1098 | test "no dependency loop for alignment of self struct" { |
| ... | ... | @@ -1349,7 +1349,7 @@ test "value in if block is comptime-known" { |
| 1349 | 1349 | const s = if (false) S{ .str = "a" } else S{ .str = "b" }; |
| 1350 | 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 | } |
| 1354 | 1354 | |
| 1355 | 1355 | test "lazy sizeof is resolved in division" { |
| ... | ... | @@ -1448,7 +1448,7 @@ test "length of global array is determinable at comptime" { |
| 1448 | 1448 | try std.testing.expect(bytes.len == 1024); |
| 1449 | 1449 | } |
| 1450 | 1450 | }; |
| 1451 | comptime try S.foo(); | |
| 1451 | try comptime S.foo(); | |
| 1452 | 1452 | } |
| 1453 | 1453 | |
| 1454 | 1454 | test "continue nested inline for loop" { |
| ... | ... | @@ -1574,7 +1574,7 @@ test "comptime function turns function value to function pointer" { |
| 1574 | 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 | } |
| 1579 | 1579 | |
| 1580 | 1580 | test "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 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 8 | 8 | |
| 9 | 9 | try testParentFieldPtr(&foo.c); |
| 10 | comptime try testParentFieldPtr(&foo.c); | |
| 10 | try comptime testParentFieldPtr(&foo.c); | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | test "@fieldParentPtr first field" { |
| ... | ... | @@ -16,7 +16,7 @@ test "@fieldParentPtr first field" { |
| 16 | 16 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 17 | 17 | |
| 18 | 18 | try testParentFieldPtrFirst(&foo.a); |
| 19 | comptime try testParentFieldPtrFirst(&foo.a); | |
| 19 | try comptime testParentFieldPtrFirst(&foo.a); | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | const Foo = struct { |
| ... | ... | @@ -56,7 +56,7 @@ test "@fieldParentPtr untagged union" { |
| 56 | 56 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 57 | 57 | |
| 58 | 58 | try testFieldParentPtrUnion(&bar.c); |
| 59 | comptime try testFieldParentPtrUnion(&bar.c); | |
| 59 | try comptime testFieldParentPtrUnion(&bar.c); | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | const Bar = union(enum) { |
| ... | ... | @@ -83,7 +83,7 @@ test "@fieldParentPtr tagged union" { |
| 83 | 83 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 84 | 84 | |
| 85 | 85 | try testFieldParentPtrTaggedUnion(&bar_tagged.c); |
| 86 | comptime try testFieldParentPtrTaggedUnion(&bar_tagged.c); | |
| 86 | try comptime testFieldParentPtrTaggedUnion(&bar_tagged.c); | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | const BarTagged = union(enum) { |
| ... | ... | @@ -110,7 +110,7 @@ test "@fieldParentPtr extern union" { |
| 110 | 110 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 111 | 111 | |
| 112 | 112 | try testFieldParentPtrExternUnion(&bar_extern.c); |
| 113 | comptime try testFieldParentPtrExternUnion(&bar_extern.c); | |
| 113 | try comptime testFieldParentPtrExternUnion(&bar_extern.c); | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | const BarExtern = extern union { |
test/behavior/floatop.zig+58-58| ... | ... | @@ -25,7 +25,7 @@ test "floating point comparisons" { |
| 25 | 25 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 26 | 26 | |
| 27 | 27 | try testFloatComparisons(); |
| 28 | comptime try testFloatComparisons(); | |
| 28 | try comptime testFloatComparisons(); | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | fn testFloatComparisons() !void { |
| ... | ... | @@ -61,7 +61,7 @@ test "different sized float comparisons" { |
| 61 | 61 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 62 | 62 | |
| 63 | 63 | try testDifferentSizedFloatComparisons(); |
| 64 | comptime try testDifferentSizedFloatComparisons(); | |
| 64 | try comptime testDifferentSizedFloatComparisons(); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | fn testDifferentSizedFloatComparisons() !void { |
| ... | ... | @@ -104,7 +104,7 @@ test "@sqrt" { |
| 104 | 104 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 105 | 105 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 106 | 106 | |
| 107 | comptime try testSqrt(); | |
| 107 | try comptime testSqrt(); | |
| 108 | 108 | try testSqrt(); |
| 109 | 109 | } |
| 110 | 110 | |
| ... | ... | @@ -142,7 +142,7 @@ test "@sqrt with vectors" { |
| 142 | 142 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 143 | 143 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 144 | 144 | |
| 145 | comptime try testSqrtWithVectors(); | |
| 145 | try comptime testSqrtWithVectors(); | |
| 146 | 146 | try testSqrtWithVectors(); |
| 147 | 147 | } |
| 148 | 148 | |
| ... | ... | @@ -188,18 +188,18 @@ test "another, possibly redundant @sqrt test" { |
| 188 | 188 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 189 | 189 | |
| 190 | 190 | try testSqrtLegacy(f64, 12.0); |
| 191 | comptime try testSqrtLegacy(f64, 12.0); | |
| 191 | try comptime testSqrtLegacy(f64, 12.0); | |
| 192 | 192 | try testSqrtLegacy(f32, 13.0); |
| 193 | comptime try testSqrtLegacy(f32, 13.0); | |
| 193 | try comptime testSqrtLegacy(f32, 13.0); | |
| 194 | 194 | try testSqrtLegacy(f16, 13.0); |
| 195 | comptime try testSqrtLegacy(f16, 13.0); | |
| 195 | try comptime testSqrtLegacy(f16, 13.0); | |
| 196 | 196 | |
| 197 | 197 | // TODO: make this pass |
| 198 | 198 | if (false) { |
| 199 | 199 | const x = 14.0; |
| 200 | 200 | const y = x * x; |
| 201 | 201 | const z = @sqrt(y); |
| 202 | comptime try expect(z == x); | |
| 202 | try comptime expect(z == x); | |
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
| ... | ... | @@ -214,7 +214,7 @@ test "@sin" { |
| 214 | 214 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 215 | 215 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 216 | 216 | |
| 217 | comptime try testSin(); | |
| 217 | try comptime testSin(); | |
| 218 | 218 | try testSin(); |
| 219 | 219 | } |
| 220 | 220 | |
| ... | ... | @@ -235,7 +235,7 @@ test "@sin with vectors" { |
| 235 | 235 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 236 | 236 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 237 | 237 | |
| 238 | comptime try testSinWithVectors(); | |
| 238 | try comptime testSinWithVectors(); | |
| 239 | 239 | try testSinWithVectors(); |
| 240 | 240 | } |
| 241 | 241 | |
| ... | ... | @@ -255,7 +255,7 @@ test "@cos" { |
| 255 | 255 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 256 | 256 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 257 | 257 | |
| 258 | comptime try testCos(); | |
| 258 | try comptime testCos(); | |
| 259 | 259 | try testCos(); |
| 260 | 260 | } |
| 261 | 261 | |
| ... | ... | @@ -276,7 +276,7 @@ test "@cos with vectors" { |
| 276 | 276 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 277 | 277 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 278 | 278 | |
| 279 | comptime try testCosWithVectors(); | |
| 279 | try comptime testCosWithVectors(); | |
| 280 | 280 | try testCosWithVectors(); |
| 281 | 281 | } |
| 282 | 282 | |
| ... | ... | @@ -296,7 +296,7 @@ test "@exp" { |
| 296 | 296 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 297 | 297 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 298 | 298 | |
| 299 | comptime try testExp(); | |
| 299 | try comptime testExp(); | |
| 300 | 300 | try testExp(); |
| 301 | 301 | } |
| 302 | 302 | |
| ... | ... | @@ -316,7 +316,7 @@ test "@exp with vectors" { |
| 316 | 316 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 317 | 317 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 318 | 318 | |
| 319 | comptime try testExpWithVectors(); | |
| 319 | try comptime testExpWithVectors(); | |
| 320 | 320 | try testExpWithVectors(); |
| 321 | 321 | } |
| 322 | 322 | |
| ... | ... | @@ -336,7 +336,7 @@ test "@exp2" { |
| 336 | 336 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 337 | 337 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 338 | 338 | |
| 339 | comptime try testExp2(); | |
| 339 | try comptime testExp2(); | |
| 340 | 340 | try testExp2(); |
| 341 | 341 | } |
| 342 | 342 | |
| ... | ... | @@ -356,7 +356,7 @@ test "@exp2 with @vectors" { |
| 356 | 356 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 357 | 357 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 358 | 358 | |
| 359 | comptime try testExp2WithVectors(); | |
| 359 | try comptime testExp2WithVectors(); | |
| 360 | 360 | try testExp2WithVectors(); |
| 361 | 361 | } |
| 362 | 362 | |
| ... | ... | @@ -376,7 +376,7 @@ test "@log" { |
| 376 | 376 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 377 | 377 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 378 | 378 | |
| 379 | comptime try testLog(); | |
| 379 | try comptime testLog(); | |
| 380 | 380 | try testLog(); |
| 381 | 381 | } |
| 382 | 382 | |
| ... | ... | @@ -425,7 +425,7 @@ test "@log2" { |
| 425 | 425 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 426 | 426 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 427 | 427 | |
| 428 | comptime try testLog2(); | |
| 428 | try comptime testLog2(); | |
| 429 | 429 | try testLog2(); |
| 430 | 430 | } |
| 431 | 431 | |
| ... | ... | @@ -449,7 +449,7 @@ test "@log2 with vectors" { |
| 449 | 449 | builtin.cpu.arch == .aarch64 and |
| 450 | 450 | builtin.os.tag == .windows) return error.SkipZigTest; |
| 451 | 451 | |
| 452 | comptime try testLog2WithVectors(); | |
| 452 | try comptime testLog2WithVectors(); | |
| 453 | 453 | try testLog2WithVectors(); |
| 454 | 454 | } |
| 455 | 455 | |
| ... | ... | @@ -469,7 +469,7 @@ test "@log10" { |
| 469 | 469 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 470 | 470 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 471 | 471 | |
| 472 | comptime try testLog10(); | |
| 472 | try comptime testLog10(); | |
| 473 | 473 | try testLog10(); |
| 474 | 474 | } |
| 475 | 475 | |
| ... | ... | @@ -489,7 +489,7 @@ test "@log10 with vectors" { |
| 489 | 489 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 490 | 490 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 491 | 491 | |
| 492 | comptime try testLog10WithVectors(); | |
| 492 | try comptime testLog10WithVectors(); | |
| 493 | 493 | try testLog10WithVectors(); |
| 494 | 494 | } |
| 495 | 495 | |
| ... | ... | @@ -507,7 +507,7 @@ test "@fabs" { |
| 507 | 507 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 508 | 508 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 509 | 509 | |
| 510 | comptime try testFabs(); | |
| 510 | try comptime testFabs(); | |
| 511 | 511 | try testFabs(); |
| 512 | 512 | } |
| 513 | 513 | |
| ... | ... | @@ -535,7 +535,7 @@ test "@fabs with vectors" { |
| 535 | 535 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 536 | 536 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 537 | 537 | |
| 538 | comptime try testFabsWithVectors(); | |
| 538 | try comptime testFabsWithVectors(); | |
| 539 | 539 | try testFabsWithVectors(); |
| 540 | 540 | } |
| 541 | 541 | |
| ... | ... | @@ -556,18 +556,18 @@ test "another, possibly redundant, @fabs test" { |
| 556 | 556 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 557 | 557 | |
| 558 | 558 | try testFabsLegacy(f128, 12.0); |
| 559 | comptime try testFabsLegacy(f128, 12.0); | |
| 559 | try comptime testFabsLegacy(f128, 12.0); | |
| 560 | 560 | try testFabsLegacy(f64, 12.0); |
| 561 | comptime try testFabsLegacy(f64, 12.0); | |
| 561 | try comptime testFabsLegacy(f64, 12.0); | |
| 562 | 562 | try testFabsLegacy(f32, 12.0); |
| 563 | comptime try testFabsLegacy(f32, 12.0); | |
| 563 | try comptime testFabsLegacy(f32, 12.0); | |
| 564 | 564 | try testFabsLegacy(f16, 12.0); |
| 565 | comptime try testFabsLegacy(f16, 12.0); | |
| 565 | try comptime testFabsLegacy(f16, 12.0); | |
| 566 | 566 | |
| 567 | 567 | const x = 14.0; |
| 568 | 568 | const y = -x; |
| 569 | 569 | const z = @fabs(y); |
| 570 | comptime try std.testing.expectEqual(x, z); | |
| 570 | try comptime std.testing.expectEqual(x, z); | |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | test "@fabs f80" { |
| ... | ... | @@ -578,7 +578,7 @@ test "@fabs f80" { |
| 578 | 578 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 579 | 579 | |
| 580 | 580 | try testFabsLegacy(f80, 12.0); |
| 581 | comptime try testFabsLegacy(f80, 12.0); | |
| 581 | try comptime testFabsLegacy(f80, 12.0); | |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | fn testFabsLegacy(comptime T: type, x: T) !void { |
| ... | ... | @@ -621,7 +621,7 @@ test "@floor" { |
| 621 | 621 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 622 | 622 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 623 | 623 | |
| 624 | comptime try testFloor(); | |
| 624 | try comptime testFloor(); | |
| 625 | 625 | try testFloor(); |
| 626 | 626 | } |
| 627 | 627 | |
| ... | ... | @@ -646,7 +646,7 @@ test "@floor with vectors" { |
| 646 | 646 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 647 | 647 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 648 | 648 | |
| 649 | comptime try testFloorWithVectors(); | |
| 649 | try comptime testFloorWithVectors(); | |
| 650 | 650 | try testFloorWithVectors(); |
| 651 | 651 | } |
| 652 | 652 | |
| ... | ... | @@ -666,16 +666,16 @@ test "another, possibly redundant, @floor test" { |
| 666 | 666 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 667 | 667 | |
| 668 | 668 | try testFloorLegacy(f64, 12.0); |
| 669 | comptime try testFloorLegacy(f64, 12.0); | |
| 669 | try comptime testFloorLegacy(f64, 12.0); | |
| 670 | 670 | try testFloorLegacy(f32, 12.0); |
| 671 | comptime try testFloorLegacy(f32, 12.0); | |
| 671 | try comptime testFloorLegacy(f32, 12.0); | |
| 672 | 672 | try testFloorLegacy(f16, 12.0); |
| 673 | comptime try testFloorLegacy(f16, 12.0); | |
| 673 | try comptime testFloorLegacy(f16, 12.0); | |
| 674 | 674 | |
| 675 | 675 | const x = 14.0; |
| 676 | 676 | const y = x + 0.7; |
| 677 | 677 | const z = @floor(y); |
| 678 | comptime try expect(x == z); | |
| 678 | try comptime expect(x == z); | |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | test "@floor f80" { |
| ... | ... | @@ -691,7 +691,7 @@ test "@floor f80" { |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | try testFloorLegacy(f80, 12.0); |
| 694 | comptime try testFloorLegacy(f80, 12.0); | |
| 694 | try comptime testFloorLegacy(f80, 12.0); | |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | test "@floor f128" { |
| ... | ... | @@ -702,7 +702,7 @@ test "@floor f128" { |
| 702 | 702 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 703 | 703 | |
| 704 | 704 | try testFloorLegacy(f128, 12.0); |
| 705 | comptime try testFloorLegacy(f128, 12.0); | |
| 705 | try comptime testFloorLegacy(f128, 12.0); | |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | fn testFloorLegacy(comptime T: type, x: T) !void { |
| ... | ... | @@ -717,7 +717,7 @@ test "@ceil" { |
| 717 | 717 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 718 | 718 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 719 | 719 | |
| 720 | comptime try testCeil(); | |
| 720 | try comptime testCeil(); | |
| 721 | 721 | try testCeil(); |
| 722 | 722 | } |
| 723 | 723 | |
| ... | ... | @@ -742,7 +742,7 @@ test "@ceil with vectors" { |
| 742 | 742 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 743 | 743 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 744 | 744 | |
| 745 | comptime try testCeilWithVectors(); | |
| 745 | try comptime testCeilWithVectors(); | |
| 746 | 746 | try testCeilWithVectors(); |
| 747 | 747 | } |
| 748 | 748 | |
| ... | ... | @@ -762,16 +762,16 @@ test "another, possibly redundant, @ceil test" { |
| 762 | 762 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 763 | 763 | |
| 764 | 764 | try testCeilLegacy(f64, 12.0); |
| 765 | comptime try testCeilLegacy(f64, 12.0); | |
| 765 | try comptime testCeilLegacy(f64, 12.0); | |
| 766 | 766 | try testCeilLegacy(f32, 12.0); |
| 767 | comptime try testCeilLegacy(f32, 12.0); | |
| 767 | try comptime testCeilLegacy(f32, 12.0); | |
| 768 | 768 | try testCeilLegacy(f16, 12.0); |
| 769 | comptime try testCeilLegacy(f16, 12.0); | |
| 769 | try comptime testCeilLegacy(f16, 12.0); | |
| 770 | 770 | |
| 771 | 771 | const x = 14.0; |
| 772 | 772 | const y = x - 0.7; |
| 773 | 773 | const z = @ceil(y); |
| 774 | comptime try expect(x == z); | |
| 774 | try comptime expect(x == z); | |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | test "@ceil f80" { |
| ... | ... | @@ -787,7 +787,7 @@ test "@ceil f80" { |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | try testCeilLegacy(f80, 12.0); |
| 790 | comptime try testCeilLegacy(f80, 12.0); | |
| 790 | try comptime testCeilLegacy(f80, 12.0); | |
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | test "@ceil f128" { |
| ... | ... | @@ -798,7 +798,7 @@ test "@ceil f128" { |
| 798 | 798 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 799 | 799 | |
| 800 | 800 | try testCeilLegacy(f128, 12.0); |
| 801 | comptime try testCeilLegacy(f128, 12.0); | |
| 801 | try comptime testCeilLegacy(f128, 12.0); | |
| 802 | 802 | } |
| 803 | 803 | |
| 804 | 804 | fn testCeilLegacy(comptime T: type, x: T) !void { |
| ... | ... | @@ -812,7 +812,7 @@ test "@trunc" { |
| 812 | 812 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 813 | 813 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 814 | 814 | |
| 815 | comptime try testTrunc(); | |
| 815 | try comptime testTrunc(); | |
| 816 | 816 | try testTrunc(); |
| 817 | 817 | } |
| 818 | 818 | |
| ... | ... | @@ -837,7 +837,7 @@ test "@trunc with vectors" { |
| 837 | 837 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 838 | 838 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 839 | 839 | |
| 840 | comptime try testTruncWithVectors(); | |
| 840 | try comptime testTruncWithVectors(); | |
| 841 | 841 | try testTruncWithVectors(); |
| 842 | 842 | } |
| 843 | 843 | |
| ... | ... | @@ -857,16 +857,16 @@ test "another, possibly redundant, @trunc test" { |
| 857 | 857 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 858 | 858 | |
| 859 | 859 | try testTruncLegacy(f64, 12.0); |
| 860 | comptime try testTruncLegacy(f64, 12.0); | |
| 860 | try comptime testTruncLegacy(f64, 12.0); | |
| 861 | 861 | try testTruncLegacy(f32, 12.0); |
| 862 | comptime try testTruncLegacy(f32, 12.0); | |
| 862 | try comptime testTruncLegacy(f32, 12.0); | |
| 863 | 863 | try testTruncLegacy(f16, 12.0); |
| 864 | comptime try testTruncLegacy(f16, 12.0); | |
| 864 | try comptime testTruncLegacy(f16, 12.0); | |
| 865 | 865 | |
| 866 | 866 | const x = 14.0; |
| 867 | 867 | const y = x + 0.7; |
| 868 | 868 | const z = @trunc(y); |
| 869 | comptime try expect(x == z); | |
| 869 | try comptime expect(x == z); | |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | test "@trunc f80" { |
| ... | ... | @@ -882,7 +882,7 @@ test "@trunc f80" { |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | 884 | try testTruncLegacy(f80, 12.0); |
| 885 | comptime try testTruncLegacy(f80, 12.0); | |
| 885 | try comptime testTruncLegacy(f80, 12.0); | |
| 886 | 886 | comptime { |
| 887 | 887 | const x: f80 = 12.0; |
| 888 | 888 | const y = x + 0.8; |
| ... | ... | @@ -899,7 +899,7 @@ test "@trunc f128" { |
| 899 | 899 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 900 | 900 | |
| 901 | 901 | try testTruncLegacy(f128, 12.0); |
| 902 | comptime try testTruncLegacy(f128, 12.0); | |
| 902 | try comptime testTruncLegacy(f128, 12.0); | |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | fn testTruncLegacy(comptime T: type, x: T) !void { |
| ... | ... | @@ -939,7 +939,7 @@ test "negation f16" { |
| 939 | 939 | }; |
| 940 | 940 | |
| 941 | 941 | try S.doTheTest(); |
| 942 | comptime try S.doTheTest(); | |
| 942 | try comptime S.doTheTest(); | |
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | test "negation f32" { |
| ... | ... | @@ -959,7 +959,7 @@ test "negation f32" { |
| 959 | 959 | }; |
| 960 | 960 | |
| 961 | 961 | try S.doTheTest(); |
| 962 | comptime try S.doTheTest(); | |
| 962 | try comptime S.doTheTest(); | |
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | test "negation f64" { |
| ... | ... | @@ -979,7 +979,7 @@ test "negation f64" { |
| 979 | 979 | }; |
| 980 | 980 | |
| 981 | 981 | try S.doTheTest(); |
| 982 | comptime try S.doTheTest(); | |
| 982 | try comptime S.doTheTest(); | |
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | test "negation f80" { |
| ... | ... | @@ -1001,7 +1001,7 @@ test "negation f80" { |
| 1001 | 1001 | }; |
| 1002 | 1002 | |
| 1003 | 1003 | try S.doTheTest(); |
| 1004 | comptime try S.doTheTest(); | |
| 1004 | try comptime S.doTheTest(); | |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | test "negation f128" { |
| ... | ... | @@ -1023,7 +1023,7 @@ test "negation f128" { |
| 1023 | 1023 | }; |
| 1024 | 1024 | |
| 1025 | 1025 | try S.doTheTest(); |
| 1026 | comptime try S.doTheTest(); | |
| 1026 | try comptime S.doTheTest(); | |
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | test "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 | 211 | } |
| 212 | 212 | |
| 213 | 213 | fn addPointCoordsVar(pt: anytype) !i32 { |
| 214 | comptime try expect(@TypeOf(pt) == Point); | |
| 214 | try comptime expect(@TypeOf(pt) == Point); | |
| 215 | 215 | return pt.x + pt.y; |
| 216 | 216 | } |
| 217 | 217 | |
| ... | ... | @@ -285,7 +285,7 @@ test "implicit cast fn call result to optional in field result" { |
| 285 | 285 | }; |
| 286 | 286 | }; |
| 287 | 287 | try S.entry(); |
| 288 | comptime try S.entry(); | |
| 288 | try comptime S.entry(); | |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | test "void parameters" { |
| ... | ... | @@ -344,7 +344,7 @@ fn fn4() u32 { |
| 344 | 344 | |
| 345 | 345 | test "number literal as an argument" { |
| 346 | 346 | try numberLiteralArg(3); |
| 347 | comptime try numberLiteralArg(3); | |
| 347 | try comptime numberLiteralArg(3); | |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | fn numberLiteralArg(a: anytype) !void { |
| ... | ... | @@ -369,7 +369,7 @@ test "function call with anon list literal" { |
| 369 | 369 | } |
| 370 | 370 | }; |
| 371 | 371 | try S.doTheTest(); |
| 372 | comptime try S.doTheTest(); | |
| 372 | try comptime S.doTheTest(); | |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | 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 | 393 | try S.doTheTest(); |
| 394 | comptime try S.doTheTest(); | |
| 394 | try comptime S.doTheTest(); | |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | 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 | 412 | try S.doTheTest(); |
| 413 | comptime try S.doTheTest(); | |
| 413 | try comptime S.doTheTest(); | |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | test "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 | 23 | |
| 24 | 24 | test "break from outer for loop" { |
| 25 | 25 | try testBreakOuter(); |
| 26 | comptime try testBreakOuter(); | |
| 26 | try comptime testBreakOuter(); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | fn testBreakOuter() !void { |
| ... | ... | @@ -40,7 +40,7 @@ fn testBreakOuter() !void { |
| 40 | 40 | |
| 41 | 41 | test "continue outer for loop" { |
| 42 | 42 | try testContinueOuter(); |
| 43 | comptime try testContinueOuter(); | |
| 43 | try comptime testContinueOuter(); | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | fn testContinueOuter() !void { |
| ... | ... | @@ -129,7 +129,7 @@ test "for with null and T peer types and inferred result location type" { |
| 129 | 129 | } |
| 130 | 130 | }; |
| 131 | 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 | } |
| 134 | 134 | |
| 135 | 135 | test "2 break statements and an else" { |
| ... | ... | @@ -150,7 +150,7 @@ test "2 break statements and an else" { |
| 150 | 150 | } |
| 151 | 151 | }; |
| 152 | 152 | try S.entry(true, false); |
| 153 | comptime try S.entry(true, false); | |
| 153 | try comptime S.entry(true, false); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | test "for loop with pointer elem var" { |
| ... | ... | @@ -197,7 +197,7 @@ test "for copies its payload" { |
| 197 | 197 | } |
| 198 | 198 | }; |
| 199 | 199 | try S.doTheTest(); |
| 200 | comptime try S.doTheTest(); | |
| 200 | try comptime S.doTheTest(); | |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | test "for on slice with allowzero ptr" { |
| ... | ... | @@ -214,7 +214,7 @@ test "for on slice with allowzero ptr" { |
| 214 | 214 | } |
| 215 | 215 | }; |
| 216 | 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 | } |
| 219 | 219 | |
| 220 | 220 | test "else continue outer for" { |
test/behavior/if.zig+2-2| ... | ... | @@ -93,7 +93,7 @@ test "if copies its payload" { |
| 93 | 93 | } |
| 94 | 94 | }; |
| 95 | 95 | try S.doTheTest(); |
| 96 | comptime try S.doTheTest(); | |
| 96 | try comptime S.doTheTest(); | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | 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 | 111 | try S.doTheTest(false); |
| 112 | comptime try S.doTheTest(false); | |
| 112 | try comptime S.doTheTest(false); | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | test "if peer expressions inferred optional type" { |
test/behavior/int128.zig+4-4| ... | ... | @@ -95,16 +95,16 @@ test "shift int128" { |
| 95 | 95 | const types = .{ u128, i128 }; |
| 96 | 96 | inline for (types) |t| { |
| 97 | 97 | try testShlTrunc(t, 0x8, 123); |
| 98 | comptime try testShlTrunc(t, 0x8, 123); | |
| 98 | try comptime testShlTrunc(t, 0x8, 123); | |
| 99 | 99 | |
| 100 | 100 | try testShlTrunc(t, 0x40000000_00000000, 64); |
| 101 | comptime try testShlTrunc(t, 0x40000000_00000000, 64); | |
| 101 | try comptime testShlTrunc(t, 0x40000000_00000000, 64); | |
| 102 | 102 | |
| 103 | 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); | |
| 105 | 105 | |
| 106 | 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 | } |
| 110 | 110 |
test/behavior/int_div.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ test "integer division" { |
| 9 | 9 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 10 | 10 | |
| 11 | 11 | try testDivision(); |
| 12 | comptime try testDivision(); | |
| 12 | try comptime testDivision(); | |
| 13 | 13 | } |
| 14 | 14 | fn testDivision() !void { |
| 15 | 15 | try expect(div(u32, 13, 3) == 4); |
test/behavior/math.zig+53-53| ... | ... | @@ -40,7 +40,7 @@ test "assignment operators" { |
| 40 | 40 | |
| 41 | 41 | test "three expr in a row" { |
| 42 | 42 | try testThreeExprInARow(false, true); |
| 43 | comptime try testThreeExprInARow(false, true); | |
| 43 | try comptime testThreeExprInARow(false, true); | |
| 44 | 44 | } |
| 45 | 45 | fn testThreeExprInARow(f: bool, t: bool) !void { |
| 46 | 46 | try assertFalse(f or f or f); |
| ... | ... | @@ -67,7 +67,7 @@ test "@clz" { |
| 67 | 67 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 68 | 68 | |
| 69 | 69 | try testClz(); |
| 70 | comptime try testClz(); | |
| 70 | try comptime testClz(); | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | fn testClz() !void { |
| ... | ... | @@ -86,7 +86,7 @@ test "@clz big ints" { |
| 86 | 86 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 87 | 87 | |
| 88 | 88 | try testClzBigInts(); |
| 89 | comptime try testClzBigInts(); | |
| 89 | try comptime testClzBigInts(); | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | fn testClzBigInts() !void { |
| ... | ... | @@ -107,7 +107,7 @@ test "@clz vectors" { |
| 107 | 107 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 108 | 108 | |
| 109 | 109 | try testClzVectors(); |
| 110 | comptime try testClzVectors(); | |
| 110 | try comptime testClzVectors(); | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | fn testClzVectors() !void { |
| ... | ... | @@ -147,7 +147,7 @@ test "@ctz" { |
| 147 | 147 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 148 | 148 | |
| 149 | 149 | try testCtz(); |
| 150 | comptime try testCtz(); | |
| 150 | try comptime testCtz(); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | fn testCtz() !void { |
| ... | ... | @@ -176,7 +176,7 @@ test "@ctz vectors" { |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | try testCtzVectors(); |
| 179 | comptime try testCtzVectors(); | |
| 179 | try comptime testCtzVectors(); | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | fn testCtzVectors() !void { |
| ... | ... | @@ -213,7 +213,7 @@ test "float equality" { |
| 213 | 213 | const y: f64 = x + 1.0; |
| 214 | 214 | |
| 215 | 215 | try testFloatEqualityImpl(x, y); |
| 216 | comptime try testFloatEqualityImpl(x, y); | |
| 216 | try comptime testFloatEqualityImpl(x, y); | |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | fn testFloatEqualityImpl(x: f64, y: f64) !void { |
| ... | ... | @@ -222,7 +222,7 @@ fn testFloatEqualityImpl(x: f64, y: f64) !void { |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | test "hex float literal parsing" { |
| 225 | comptime try expect(0x1.0 == 1.0); | |
| 225 | try comptime expect(0x1.0 == 1.0); | |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | test "hex float literal within range" { |
| ... | ... | @@ -323,7 +323,7 @@ test "comptime_int multi-limb partial shift right" { |
| 323 | 323 | |
| 324 | 324 | test "xor" { |
| 325 | 325 | try test_xor(); |
| 326 | comptime try test_xor(); | |
| 326 | try comptime test_xor(); | |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | fn test_xor() !void { |
| ... | ... | @@ -412,7 +412,7 @@ test "division" { |
| 412 | 412 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 413 | 413 | |
| 414 | 414 | try testDivision(); |
| 415 | comptime try testDivision(); | |
| 415 | try comptime testDivision(); | |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | fn testDivision() !void { |
| ... | ... | @@ -492,7 +492,7 @@ test "division half-precision floats" { |
| 492 | 492 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 493 | 493 | |
| 494 | 494 | try testDivisionFP16(); |
| 495 | comptime try testDivisionFP16(); | |
| 495 | try comptime testDivisionFP16(); | |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | fn testDivisionFP16() !void { |
| ... | ... | @@ -527,7 +527,7 @@ fn mod(comptime T: type, a: T, b: T) T { |
| 527 | 527 | |
| 528 | 528 | test "unsigned wrapping" { |
| 529 | 529 | try testUnsignedWrappingEval(maxInt(u32)); |
| 530 | comptime try testUnsignedWrappingEval(maxInt(u32)); | |
| 530 | try comptime testUnsignedWrappingEval(maxInt(u32)); | |
| 531 | 531 | } |
| 532 | 532 | fn testUnsignedWrappingEval(x: u32) !void { |
| 533 | 533 | const zero = x +% 1; |
| ... | ... | @@ -538,7 +538,7 @@ fn testUnsignedWrappingEval(x: u32) !void { |
| 538 | 538 | |
| 539 | 539 | test "signed wrapping" { |
| 540 | 540 | try testSignedWrappingEval(maxInt(i32)); |
| 541 | comptime try testSignedWrappingEval(maxInt(i32)); | |
| 541 | try comptime testSignedWrappingEval(maxInt(i32)); | |
| 542 | 542 | } |
| 543 | 543 | fn testSignedWrappingEval(x: i32) !void { |
| 544 | 544 | const min_val = x +% 1; |
| ... | ... | @@ -549,7 +549,7 @@ fn testSignedWrappingEval(x: i32) !void { |
| 549 | 549 | |
| 550 | 550 | test "signed negation wrapping" { |
| 551 | 551 | try testSignedNegationWrappingEval(minInt(i16)); |
| 552 | comptime try testSignedNegationWrappingEval(minInt(i16)); | |
| 552 | try comptime testSignedNegationWrappingEval(minInt(i16)); | |
| 553 | 553 | } |
| 554 | 554 | fn testSignedNegationWrappingEval(x: i16) !void { |
| 555 | 555 | try expect(x == -32768); |
| ... | ... | @@ -559,7 +559,7 @@ fn testSignedNegationWrappingEval(x: i16) !void { |
| 559 | 559 | |
| 560 | 560 | test "unsigned negation wrapping" { |
| 561 | 561 | try testUnsignedNegationWrappingEval(1); |
| 562 | comptime try testUnsignedNegationWrappingEval(1); | |
| 562 | try comptime testUnsignedNegationWrappingEval(1); | |
| 563 | 563 | } |
| 564 | 564 | fn testUnsignedNegationWrappingEval(x: u16) !void { |
| 565 | 565 | try expect(x == 1); |
| ... | ... | @@ -586,7 +586,7 @@ test "unsigned 64-bit division" { |
| 586 | 586 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 587 | 587 | |
| 588 | 588 | try test_u64_div(); |
| 589 | comptime try test_u64_div(); | |
| 589 | try comptime test_u64_div(); | |
| 590 | 590 | } |
| 591 | 591 | fn test_u64_div() !void { |
| 592 | 592 | const result = divWithResult(1152921504606846976, 34359738365); |
| ... | ... | @@ -614,7 +614,7 @@ test "truncating shift right" { |
| 614 | 614 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 615 | 615 | |
| 616 | 616 | try testShrTrunc(maxInt(u16)); |
| 617 | comptime try testShrTrunc(maxInt(u16)); | |
| 617 | try comptime testShrTrunc(maxInt(u16)); | |
| 618 | 618 | } |
| 619 | 619 | fn testShrTrunc(x: u16) !void { |
| 620 | 620 | const shifted = x >> 1; |
| ... | ... | @@ -630,7 +630,7 @@ test "f128" { |
| 630 | 630 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 631 | 631 | |
| 632 | 632 | try test_f128(); |
| 633 | comptime try test_f128(); | |
| 633 | try comptime test_f128(); | |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | fn make_f128(x: f128) f128 { |
| ... | ... | @@ -1238,12 +1238,12 @@ test "quad hex float literal parsing accurate" { |
| 1238 | 1238 | } |
| 1239 | 1239 | }; |
| 1240 | 1240 | try S.doTheTest(); |
| 1241 | comptime try S.doTheTest(); | |
| 1241 | try comptime S.doTheTest(); | |
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | 1244 | test "truncating shift left" { |
| 1245 | 1245 | try testShlTrunc(maxInt(u16)); |
| 1246 | comptime try testShlTrunc(maxInt(u16)); | |
| 1246 | try comptime testShlTrunc(maxInt(u16)); | |
| 1247 | 1247 | } |
| 1248 | 1248 | fn testShlTrunc(x: u16) !void { |
| 1249 | 1249 | const shifted = x << 1; |
| ... | ... | @@ -1254,7 +1254,7 @@ test "exact shift left" { |
| 1254 | 1254 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1255 | 1255 | |
| 1256 | 1256 | try testShlExact(0b00110101); |
| 1257 | comptime try testShlExact(0b00110101); | |
| 1257 | try comptime testShlExact(0b00110101); | |
| 1258 | 1258 | } |
| 1259 | 1259 | fn testShlExact(x: u8) !void { |
| 1260 | 1260 | const shifted = @shlExact(x, 2); |
| ... | ... | @@ -1265,7 +1265,7 @@ test "exact shift right" { |
| 1265 | 1265 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1266 | 1266 | |
| 1267 | 1267 | try testShrExact(0b10110100); |
| 1268 | comptime try testShrExact(0b10110100); | |
| 1268 | try comptime testShrExact(0b10110100); | |
| 1269 | 1269 | } |
| 1270 | 1270 | fn testShrExact(x: u8) !void { |
| 1271 | 1271 | const shifted = @shrExact(x, 2); |
| ... | ... | @@ -1288,7 +1288,7 @@ test "shift left/right on u0 operand" { |
| 1288 | 1288 | } |
| 1289 | 1289 | }; |
| 1290 | 1290 | try S.doTheTest(); |
| 1291 | comptime try S.doTheTest(); | |
| 1291 | try comptime S.doTheTest(); | |
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | 1294 | test "comptime float rem int" { |
| ... | ... | @@ -1311,11 +1311,11 @@ test "remainder division" { |
| 1311 | 1311 | return error.SkipZigTest; |
| 1312 | 1312 | } |
| 1313 | 1313 | |
| 1314 | comptime try remdiv(f16); | |
| 1315 | comptime try remdiv(f32); | |
| 1316 | comptime try remdiv(f64); | |
| 1317 | comptime try remdiv(f80); | |
| 1318 | comptime try remdiv(f128); | |
| 1314 | try comptime remdiv(f16); | |
| 1315 | try comptime remdiv(f32); | |
| 1316 | try comptime remdiv(f64); | |
| 1317 | try comptime remdiv(f80); | |
| 1318 | try comptime remdiv(f128); | |
| 1319 | 1319 | try remdiv(f16); |
| 1320 | 1320 | try remdiv(f64); |
| 1321 | 1321 | try remdiv(f80); |
| ... | ... | @@ -1343,11 +1343,11 @@ test "float remainder division using @rem" { |
| 1343 | 1343 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1344 | 1344 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 1345 | 1345 | |
| 1346 | comptime try frem(f16); | |
| 1347 | comptime try frem(f32); | |
| 1348 | comptime try frem(f64); | |
| 1349 | comptime try frem(f80); | |
| 1350 | comptime try frem(f128); | |
| 1346 | try comptime frem(f16); | |
| 1347 | try comptime frem(f32); | |
| 1348 | try comptime frem(f64); | |
| 1349 | try comptime frem(f80); | |
| 1350 | try comptime frem(f128); | |
| 1351 | 1351 | try frem(f16); |
| 1352 | 1352 | try frem(f32); |
| 1353 | 1353 | try frem(f64); |
| ... | ... | @@ -1386,11 +1386,11 @@ test "float modulo division using @mod" { |
| 1386 | 1386 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1387 | 1387 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1388 | 1388 | |
| 1389 | comptime try fmod(f16); | |
| 1390 | comptime try fmod(f32); | |
| 1391 | comptime try fmod(f64); | |
| 1392 | comptime try fmod(f80); | |
| 1393 | comptime try fmod(f128); | |
| 1389 | try comptime fmod(f16); | |
| 1390 | try comptime fmod(f32); | |
| 1391 | try comptime fmod(f64); | |
| 1392 | try comptime fmod(f80); | |
| 1393 | try comptime fmod(f128); | |
| 1394 | 1394 | try fmod(f16); |
| 1395 | 1395 | try fmod(f32); |
| 1396 | 1396 | try fmod(f64); |
| ... | ... | @@ -1430,16 +1430,16 @@ test "@round" { |
| 1430 | 1430 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1431 | 1431 | |
| 1432 | 1432 | try testRound(f64, 12.0); |
| 1433 | comptime try testRound(f64, 12.0); | |
| 1433 | try comptime testRound(f64, 12.0); | |
| 1434 | 1434 | try testRound(f32, 12.0); |
| 1435 | comptime try testRound(f32, 12.0); | |
| 1435 | try comptime testRound(f32, 12.0); | |
| 1436 | 1436 | try testRound(f16, 12.0); |
| 1437 | comptime try testRound(f16, 12.0); | |
| 1437 | try comptime testRound(f16, 12.0); | |
| 1438 | 1438 | |
| 1439 | 1439 | const x = 14.0; |
| 1440 | 1440 | const y = x + 0.4; |
| 1441 | 1441 | const z = @round(y); |
| 1442 | comptime try expect(x == z); | |
| 1442 | try comptime expect(x == z); | |
| 1443 | 1443 | } |
| 1444 | 1444 | |
| 1445 | 1445 | test "@round f80" { |
| ... | ... | @@ -1451,7 +1451,7 @@ test "@round f80" { |
| 1451 | 1451 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1452 | 1452 | |
| 1453 | 1453 | try testRound(f80, 12.0); |
| 1454 | comptime try testRound(f80, 12.0); | |
| 1454 | try comptime testRound(f80, 12.0); | |
| 1455 | 1455 | } |
| 1456 | 1456 | |
| 1457 | 1457 | test "@round f128" { |
| ... | ... | @@ -1463,7 +1463,7 @@ test "@round f128" { |
| 1463 | 1463 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1464 | 1464 | |
| 1465 | 1465 | try testRound(f128, 12.0); |
| 1466 | comptime try testRound(f128, 12.0); | |
| 1466 | try comptime testRound(f128, 12.0); | |
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | 1469 | fn testRound(comptime T: type, x: T) !void { |
| ... | ... | @@ -1491,7 +1491,7 @@ test "vector integer addition" { |
| 1491 | 1491 | } |
| 1492 | 1492 | }; |
| 1493 | 1493 | try S.doTheTest(); |
| 1494 | comptime try S.doTheTest(); | |
| 1494 | try comptime S.doTheTest(); | |
| 1495 | 1495 | } |
| 1496 | 1496 | |
| 1497 | 1497 | test "NaN comparison" { |
| ... | ... | @@ -1506,10 +1506,10 @@ test "NaN comparison" { |
| 1506 | 1506 | try testNanEqNan(f32); |
| 1507 | 1507 | try testNanEqNan(f64); |
| 1508 | 1508 | try testNanEqNan(f128); |
| 1509 | comptime try testNanEqNan(f16); | |
| 1510 | comptime try testNanEqNan(f32); | |
| 1511 | comptime try testNanEqNan(f64); | |
| 1512 | comptime try testNanEqNan(f128); | |
| 1509 | try comptime testNanEqNan(f16); | |
| 1510 | try comptime testNanEqNan(f32); | |
| 1511 | try comptime testNanEqNan(f64); | |
| 1512 | try comptime testNanEqNan(f128); | |
| 1513 | 1513 | } |
| 1514 | 1514 | |
| 1515 | 1515 | test "NaN comparison f80" { |
| ... | ... | @@ -1521,7 +1521,7 @@ test "NaN comparison f80" { |
| 1521 | 1521 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1522 | 1522 | |
| 1523 | 1523 | try testNanEqNan(f80); |
| 1524 | comptime try testNanEqNan(f80); | |
| 1524 | try comptime testNanEqNan(f80); | |
| 1525 | 1525 | } |
| 1526 | 1526 | |
| 1527 | 1527 | fn testNanEqNan(comptime F: type) !void { |
| ... | ... | @@ -1556,7 +1556,7 @@ test "vector comparison" { |
| 1556 | 1556 | } |
| 1557 | 1557 | }; |
| 1558 | 1558 | try S.doTheTest(); |
| 1559 | comptime try S.doTheTest(); | |
| 1559 | try comptime S.doTheTest(); | |
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | 1562 | test "compare undefined literal with comptime_int" { |
| ... | ... | @@ -1593,7 +1593,7 @@ test "signed zeros are represented properly" { |
| 1593 | 1593 | }; |
| 1594 | 1594 | |
| 1595 | 1595 | try S.doTheTest(); |
| 1596 | comptime try S.doTheTest(); | |
| 1596 | try comptime S.doTheTest(); | |
| 1597 | 1597 | } |
| 1598 | 1598 | |
| 1599 | 1599 | test "comptime sin and ln" { |
| ... | ... | @@ -1609,7 +1609,7 @@ test "absFloat" { |
| 1609 | 1609 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1610 | 1610 | |
| 1611 | 1611 | try testAbsFloat(); |
| 1612 | comptime try testAbsFloat(); | |
| 1612 | try comptime testAbsFloat(); | |
| 1613 | 1613 | } |
| 1614 | 1614 | fn testAbsFloat() !void { |
| 1615 | 1615 | try testAbsFloatOne(-10.05, 10.05); |
test/behavior/maximum_minimum.zig+6-6| ... | ... | @@ -19,7 +19,7 @@ test "@max" { |
| 19 | 19 | } |
| 20 | 20 | }; |
| 21 | 21 | try S.doTheTest(); |
| 22 | comptime try S.doTheTest(); | |
| 22 | try comptime S.doTheTest(); | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | test "@max on vectors" { |
| ... | ... | @@ -50,7 +50,7 @@ test "@max on vectors" { |
| 50 | 50 | } |
| 51 | 51 | }; |
| 52 | 52 | try S.doTheTest(); |
| 53 | comptime try S.doTheTest(); | |
| 53 | try comptime S.doTheTest(); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | test "@min" { |
| ... | ... | @@ -68,7 +68,7 @@ test "@min" { |
| 68 | 68 | } |
| 69 | 69 | }; |
| 70 | 70 | try S.doTheTest(); |
| 71 | comptime try S.doTheTest(); | |
| 71 | try comptime S.doTheTest(); | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | test "@min for vectors" { |
| ... | ... | @@ -99,7 +99,7 @@ test "@min for vectors" { |
| 99 | 99 | } |
| 100 | 100 | }; |
| 101 | 101 | try S.doTheTest(); |
| 102 | comptime try S.doTheTest(); | |
| 102 | try comptime S.doTheTest(); | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | test "@min/max for floats" { |
| ... | ... | @@ -123,9 +123,9 @@ test "@min/max for floats" { |
| 123 | 123 | |
| 124 | 124 | inline for (.{ f16, f32, f64, f80, f128, c_longdouble }) |T| { |
| 125 | 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 | } |
| 130 | 130 | |
| 131 | 131 | test "@min/@max on lazy values" { |
test/behavior/muladd.zig+9-9| ... | ... | @@ -12,7 +12,7 @@ test "@mulAdd" { |
| 12 | 12 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 13 | 13 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 14 | 14 | |
| 15 | comptime try testMulAdd(); | |
| 15 | try comptime testMulAdd(); | |
| 16 | 16 | try testMulAdd(); |
| 17 | 17 | } |
| 18 | 18 | |
| ... | ... | @@ -38,7 +38,7 @@ test "@mulAdd f16" { |
| 38 | 38 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 39 | 39 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 40 | 40 | |
| 41 | comptime try testMulAdd16(); | |
| 41 | try comptime testMulAdd16(); | |
| 42 | 42 | try testMulAdd16(); |
| 43 | 43 | } |
| 44 | 44 | |
| ... | ... | @@ -57,7 +57,7 @@ test "@mulAdd f80" { |
| 57 | 57 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 58 | 58 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 59 | 59 | |
| 60 | comptime try testMulAdd80(); | |
| 60 | try comptime testMulAdd80(); | |
| 61 | 61 | try testMulAdd80(); |
| 62 | 62 | } |
| 63 | 63 | |
| ... | ... | @@ -76,7 +76,7 @@ test "@mulAdd f128" { |
| 76 | 76 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 77 | 77 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 78 | 78 | |
| 79 | comptime try testMulAdd128(); | |
| 79 | try comptime testMulAdd128(); | |
| 80 | 80 | try testMulAdd128(); |
| 81 | 81 | } |
| 82 | 82 | |
| ... | ... | @@ -107,7 +107,7 @@ test "vector f16" { |
| 107 | 107 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 108 | 108 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 109 | 109 | |
| 110 | comptime try vector16(); | |
| 110 | try comptime vector16(); | |
| 111 | 111 | try vector16(); |
| 112 | 112 | } |
| 113 | 113 | |
| ... | ... | @@ -131,7 +131,7 @@ test "vector f32" { |
| 131 | 131 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 132 | 132 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 133 | 133 | |
| 134 | comptime try vector32(); | |
| 134 | try comptime vector32(); | |
| 135 | 135 | try vector32(); |
| 136 | 136 | } |
| 137 | 137 | |
| ... | ... | @@ -155,7 +155,7 @@ test "vector f64" { |
| 155 | 155 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 156 | 156 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 157 | 157 | |
| 158 | comptime try vector64(); | |
| 158 | try comptime vector64(); | |
| 159 | 159 | try vector64(); |
| 160 | 160 | } |
| 161 | 161 | |
| ... | ... | @@ -178,7 +178,7 @@ test "vector f80" { |
| 178 | 178 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 179 | 179 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 180 | 180 | |
| 181 | comptime try vector80(); | |
| 181 | try comptime vector80(); | |
| 182 | 182 | try vector80(); |
| 183 | 183 | } |
| 184 | 184 | |
| ... | ... | @@ -202,6 +202,6 @@ test "vector f128" { |
| 202 | 202 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 203 | 203 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 204 | 204 | |
| 205 | comptime try vector128(); | |
| 205 | try comptime vector128(); | |
| 206 | 206 | try vector128(); |
| 207 | 207 | } |
test/behavior/null.zig+3-3| ... | ... | @@ -56,7 +56,7 @@ test "maybe return" { |
| 56 | 56 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 57 | 57 | |
| 58 | 58 | try maybeReturnImpl(); |
| 59 | comptime try maybeReturnImpl(); | |
| 59 | try comptime maybeReturnImpl(); | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | fn maybeReturnImpl() !void { |
| ... | ... | @@ -87,7 +87,7 @@ test "optional void" { |
| 87 | 87 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 88 | 88 | |
| 89 | 89 | try optionalVoidImpl(); |
| 90 | comptime try optionalVoidImpl(); | |
| 90 | try comptime optionalVoidImpl(); | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | fn optionalVoidImpl() !void { |
| ... | ... | @@ -111,7 +111,7 @@ test "optional struct{}" { |
| 111 | 111 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 112 | 112 | |
| 113 | 113 | _ = try optionalEmptyStructImpl(); |
| 114 | _ = comptime try optionalEmptyStructImpl(); | |
| 114 | _ = try comptime optionalEmptyStructImpl(); | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | fn optionalEmptyStructImpl() !void { |
test/behavior/optional.zig+8-8| ... | ... | @@ -20,7 +20,7 @@ test "passing an optional integer as a parameter" { |
| 20 | 20 | } |
| 21 | 21 | }; |
| 22 | 22 | try expect(S.entry()); |
| 23 | comptime try expect(S.entry()); | |
| 23 | try comptime expect(S.entry()); | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | pub const EmptyStruct = struct {}; |
| ... | ... | @@ -38,7 +38,7 @@ test "equality compare optional pointers" { |
| 38 | 38 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 39 | 39 | |
| 40 | 40 | try testNullPtrsEql(); |
| 41 | comptime try testNullPtrsEql(); | |
| 41 | try comptime testNullPtrsEql(); | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | fn testNullPtrsEql() !void { |
| ... | ... | @@ -117,7 +117,7 @@ test "equality compare optional with non-optional" { |
| 117 | 117 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 118 | 118 | |
| 119 | 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 | } |
| 122 | 122 | |
| 123 | 123 | fn test_cmp_optional_non_optional() !void { |
| ... | ... | @@ -168,7 +168,7 @@ test "unwrap function call with optional pointer return value" { |
| 168 | 168 | } |
| 169 | 169 | }; |
| 170 | 170 | try S.entry(); |
| 171 | comptime try S.entry(); | |
| 171 | try comptime S.entry(); | |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | test "nested orelse" { |
| ... | ... | @@ -195,7 +195,7 @@ test "nested orelse" { |
| 195 | 195 | }; |
| 196 | 196 | }; |
| 197 | 197 | try S.entry(); |
| 198 | comptime try S.entry(); | |
| 198 | try comptime S.entry(); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | test "self-referential struct through a slice of optional" { |
| ... | ... | @@ -250,7 +250,7 @@ test "coerce an anon struct literal to optional struct" { |
| 250 | 250 | } |
| 251 | 251 | }; |
| 252 | 252 | try S.doTheTest(); |
| 253 | comptime try S.doTheTest(); | |
| 253 | try comptime S.doTheTest(); | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | 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 | 279 | try S.doTheTest(); |
| 280 | comptime try S.doTheTest(); | |
| 280 | try comptime S.doTheTest(); | |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | 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 | 305 | try S.doTheTest(); |
| 306 | comptime try S.doTheTest(); | |
| 306 | try comptime S.doTheTest(); | |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | test "array of optional unaligned types" { |
test/behavior/packed-struct.zig+1-1| ... | ... | @@ -351,7 +351,7 @@ test "byte-aligned field pointer offsets" { |
| 351 | 351 | }; |
| 352 | 352 | |
| 353 | 353 | try S.doTheTest(); |
| 354 | comptime try S.doTheTest(); | |
| 354 | try comptime S.doTheTest(); | |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | test "load pointer from packed struct" { |
test/behavior/pointers.zig+35-35| ... | ... | @@ -5,7 +5,7 @@ const expect = testing.expect; |
| 5 | 5 | const expectError = testing.expectError; |
| 6 | 6 | |
| 7 | 7 | test "dereference pointer" { |
| 8 | comptime try testDerefPtr(); | |
| 8 | try comptime testDerefPtr(); | |
| 9 | 9 | try testDerefPtr(); |
| 10 | 10 | } |
| 11 | 11 | |
| ... | ... | @@ -42,7 +42,7 @@ test "pointer arithmetic" { |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | test "double pointer parsing" { |
| 45 | comptime try expect(PtrOf(PtrOf(i32)) == **i32); | |
| 45 | try comptime expect(PtrOf(PtrOf(i32)) == **i32); | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | fn PtrOf(comptime T: type) type { |
| ... | ... | @@ -62,7 +62,7 @@ test "implicit cast single item pointer to C pointer and back" { |
| 62 | 62 | test "initialize const optional C pointer to null" { |
| 63 | 63 | const a: ?[*c]i32 = null; |
| 64 | 64 | try expect(a == null); |
| 65 | comptime try expect(a == null); | |
| 65 | try comptime expect(a == null); | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | test "assigning integer to C pointer" { |
| ... | ... | @@ -105,12 +105,12 @@ test "C pointer comparison and arithmetic" { |
| 105 | 105 | } |
| 106 | 106 | }; |
| 107 | 107 | try S.doTheTest(); |
| 108 | comptime try S.doTheTest(); | |
| 108 | try comptime S.doTheTest(); | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | test "dereference pointer again" { |
| 112 | 112 | try testDerefPtrOneVal(); |
| 113 | comptime try testDerefPtrOneVal(); | |
| 113 | try comptime testDerefPtrOneVal(); | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | const Foo1 = struct { |
| ... | ... | @@ -180,7 +180,7 @@ test "implicit cast error unions with non-optional to optional pointer" { |
| 180 | 180 | } |
| 181 | 181 | }; |
| 182 | 182 | try S.doTheTest(); |
| 183 | comptime try S.doTheTest(); | |
| 183 | try comptime S.doTheTest(); | |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | test "compare equality of optional and non-optional pointer" { |
| ... | ... | @@ -203,11 +203,11 @@ test "allowzero pointer and slice" { |
| 203 | 203 | try expect(@ptrToInt(ptr) == 0); |
| 204 | 204 | var runtime_zero: usize = 0; |
| 205 | 205 | var slice = ptr[runtime_zero..10]; |
| 206 | comptime try expect(@TypeOf(slice) == []allowzero i32); | |
| 206 | try comptime expect(@TypeOf(slice) == []allowzero i32); | |
| 207 | 207 | try expect(@ptrToInt(&slice[5]) == 20); |
| 208 | 208 | |
| 209 | comptime try expect(@typeInfo(@TypeOf(ptr)).Pointer.is_allowzero); | |
| 210 | comptime try expect(@typeInfo(@TypeOf(slice)).Pointer.is_allowzero); | |
| 209 | try comptime expect(@typeInfo(@TypeOf(ptr)).Pointer.is_allowzero); | |
| 210 | try comptime expect(@typeInfo(@TypeOf(slice)).Pointer.is_allowzero); | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | 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 | 229 | try expect((x orelse &otherx) == &otherx); |
| 230 | 230 | |
| 231 | 231 | const y: [*c]i32 = null; |
| 232 | comptime try expect(y == null); | |
| 233 | comptime try expect(null == y); | |
| 234 | comptime try expect(!(y != null)); | |
| 235 | comptime try expect(!(null != y)); | |
| 232 | try comptime expect(y == null); | |
| 233 | try comptime expect(null == y); | |
| 234 | try comptime expect(!(y != null)); | |
| 235 | try comptime expect(!(null != y)); | |
| 236 | 236 | if (y) |same_y| { |
| 237 | 237 | _ = same_y; |
| 238 | 238 | @panic("fail"); |
| 239 | 239 | } |
| 240 | 240 | const othery: i32 = undefined; |
| 241 | 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); | |
| 243 | 243 | |
| 244 | 244 | var n: i32 = 1234; |
| 245 | 245 | var x1: [*c]i32 = &n; |
| ... | ... | @@ -257,17 +257,17 @@ test "assign null directly to C pointer and test null equality" { |
| 257 | 257 | |
| 258 | 258 | const nc: i32 = 1234; |
| 259 | 259 | const y1: [*c]const i32 = &nc; |
| 260 | comptime try expect(!(y1 == null)); | |
| 261 | comptime try expect(!(null == y1)); | |
| 262 | comptime try expect(y1 != null); | |
| 263 | comptime try expect(null != y1); | |
| 264 | comptime try expect(y1.?.* == 1234); | |
| 260 | try comptime expect(!(y1 == null)); | |
| 261 | try comptime expect(!(null == y1)); | |
| 262 | try comptime expect(y1 != null); | |
| 263 | try comptime expect(null != y1); | |
| 264 | try comptime expect(y1.?.* == 1234); | |
| 265 | 265 | if (y1) |same_y1| { |
| 266 | 266 | try expect(same_y1.* == 1234); |
| 267 | 267 | } else { |
| 268 | 268 | @compileError("fail"); |
| 269 | 269 | } |
| 270 | comptime try expect((y1 orelse &othery) == y1); | |
| 270 | try comptime expect((y1 orelse &othery) == y1); | |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | test "array initialization types" { |
| ... | ... | @@ -293,7 +293,7 @@ test "null terminated pointer" { |
| 293 | 293 | } |
| 294 | 294 | }; |
| 295 | 295 | try S.doTheTest(); |
| 296 | comptime try S.doTheTest(); | |
| 296 | try comptime S.doTheTest(); | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | test "allow any sentinel" { |
| ... | ... | @@ -308,7 +308,7 @@ test "allow any sentinel" { |
| 308 | 308 | } |
| 309 | 309 | }; |
| 310 | 310 | try S.doTheTest(); |
| 311 | comptime try S.doTheTest(); | |
| 311 | try comptime S.doTheTest(); | |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | test "pointer sentinel with enums" { |
| ... | ... | @@ -325,11 +325,11 @@ test "pointer sentinel with enums" { |
| 325 | 325 | |
| 326 | 326 | fn doTheTest() !void { |
| 327 | 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 #3731 | |
| 328 | try expect(ptr[4] == .sentinel); // TODO this should be try comptime expect, see #3731 | |
| 329 | 329 | } |
| 330 | 330 | }; |
| 331 | 331 | try S.doTheTest(); |
| 332 | comptime try S.doTheTest(); | |
| 332 | try comptime S.doTheTest(); | |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | test "pointer sentinel with optional element" { |
| ... | ... | @@ -341,11 +341,11 @@ test "pointer sentinel with optional element" { |
| 341 | 341 | const S = struct { |
| 342 | 342 | fn doTheTest() !void { |
| 343 | 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 #3731 | |
| 344 | try expect(ptr[4] == null); // TODO this should be try comptime expect, see #3731 | |
| 345 | 345 | } |
| 346 | 346 | }; |
| 347 | 347 | try S.doTheTest(); |
| 348 | comptime try S.doTheTest(); | |
| 348 | try comptime S.doTheTest(); | |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | test "pointer sentinel with +inf" { |
| ... | ... | @@ -357,13 +357,13 @@ test "pointer sentinel with +inf" { |
| 357 | 357 | |
| 358 | 358 | const S = struct { |
| 359 | 359 | fn doTheTest() !void { |
| 360 | const inf = std.math.inf_f32; | |
| 361 | var ptr: [*:inf]const f32 = &[_:inf]f32{ 1.1, 2.2, 3.3, 4.4 }; | |
| 362 | try expect(ptr[4] == inf); // TODO this should be comptime try expect, see #3731 | |
| 360 | const inf_f32 = comptime std.math.inf(f32); | |
| 361 | var ptr: [*:inf_f32]const f32 = &[_:inf_f32]f32{ 1.1, 2.2, 3.3, 4.4 }; | |
| 362 | try expect(ptr[4] == inf_f32); // TODO this should be try comptime expect, see #3731 | |
| 363 | 363 | } |
| 364 | 364 | }; |
| 365 | 365 | try S.doTheTest(); |
| 366 | comptime try S.doTheTest(); | |
| 366 | try comptime S.doTheTest(); | |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | test "pointer to array at fixed address" { |
| ... | ... | @@ -409,11 +409,11 @@ test "@ptrToInt on null optional at comptime" { |
| 409 | 409 | const pointer = @intToPtr(?*u8, 0x000); |
| 410 | 410 | const x = @ptrToInt(pointer); |
| 411 | 411 | _ = x; |
| 412 | comptime try expect(0 == @ptrToInt(pointer)); | |
| 412 | try comptime expect(0 == @ptrToInt(pointer)); | |
| 413 | 413 | } |
| 414 | 414 | { |
| 415 | 415 | const pointer = @intToPtr(?*u8, 0xf00); |
| 416 | comptime try expect(0xf00 == @ptrToInt(pointer)); | |
| 416 | try comptime expect(0xf00 == @ptrToInt(pointer)); | |
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | |
| ... | ... | @@ -447,7 +447,7 @@ test "element pointer to slice" { |
| 447 | 447 | }; |
| 448 | 448 | |
| 449 | 449 | try S.doTheTest(); |
| 450 | comptime try S.doTheTest(); | |
| 450 | try comptime S.doTheTest(); | |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | test "element pointer arithmetic to slice" { |
| ... | ... | @@ -473,7 +473,7 @@ test "element pointer arithmetic to slice" { |
| 473 | 473 | }; |
| 474 | 474 | |
| 475 | 475 | try S.doTheTest(); |
| 476 | comptime try S.doTheTest(); | |
| 476 | try comptime S.doTheTest(); | |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | test "array slicing to slice" { |
| ... | ... | @@ -491,7 +491,7 @@ test "array slicing to slice" { |
| 491 | 491 | }; |
| 492 | 492 | |
| 493 | 493 | try S.doTheTest(); |
| 494 | comptime try S.doTheTest(); | |
| 494 | try comptime S.doTheTest(); | |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | test "pointer to constant decl preserves alignment" { |
test/behavior/popcount.zig+2-2| ... | ... | @@ -9,7 +9,7 @@ test "@popCount integers" { |
| 9 | 9 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 10 | 10 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 11 | 11 | |
| 12 | comptime try testPopCountIntegers(); | |
| 12 | try comptime testPopCountIntegers(); | |
| 13 | 13 | try testPopCountIntegers(); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -75,7 +75,7 @@ test "@popCount vectors" { |
| 75 | 75 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 76 | 76 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 77 | 77 | |
| 78 | comptime try testPopCountVectors(); | |
| 78 | try comptime testPopCountVectors(); | |
| 79 | 79 | try testPopCountVectors(); |
| 80 | 80 | } |
| 81 | 81 |
test/behavior/ptrcast.zig+6-6| ... | ... | @@ -7,7 +7,7 @@ test "reinterpret bytes as integer with nonzero offset" { |
| 7 | 7 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 8 | 8 | |
| 9 | 9 | try testReinterpretBytesAsInteger(); |
| 10 | comptime try testReinterpretBytesAsInteger(); | |
| 10 | try comptime testReinterpretBytesAsInteger(); | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | fn testReinterpretBytesAsInteger() !void { |
| ... | ... | @@ -26,7 +26,7 @@ test "reinterpret an array over multiple elements, with no well-defined layout" |
| 26 | 26 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 27 | 27 | |
| 28 | 28 | try testReinterpretWithOffsetAndNoWellDefinedLayout(); |
| 29 | comptime try testReinterpretWithOffsetAndNoWellDefinedLayout(); | |
| 29 | try comptime testReinterpretWithOffsetAndNoWellDefinedLayout(); | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | fn testReinterpretWithOffsetAndNoWellDefinedLayout() !void { |
| ... | ... | @@ -41,7 +41,7 @@ test "reinterpret bytes inside auto-layout struct as integer with nonzero offset |
| 41 | 41 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 42 | 42 | |
| 43 | 43 | try testReinterpretStructWrappedBytesAsInteger(); |
| 44 | comptime try testReinterpretStructWrappedBytesAsInteger(); | |
| 44 | try comptime testReinterpretStructWrappedBytesAsInteger(); | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | fn testReinterpretStructWrappedBytesAsInteger() !void { |
| ... | ... | @@ -59,7 +59,7 @@ test "reinterpret bytes of an array into an extern struct" { |
| 59 | 59 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 60 | 60 | |
| 61 | 61 | try testReinterpretBytesAsExternStruct(); |
| 62 | comptime try testReinterpretBytesAsExternStruct(); | |
| 62 | try comptime testReinterpretBytesAsExternStruct(); | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | fn testReinterpretBytesAsExternStruct() !void { |
| ... | ... | @@ -80,7 +80,7 @@ test "reinterpret bytes of an extern struct (with under-aligned fields) into ano |
| 80 | 80 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 81 | 81 | |
| 82 | 82 | try testReinterpretExternStructAsExternStruct(); |
| 83 | comptime try testReinterpretExternStructAsExternStruct(); | |
| 83 | try comptime testReinterpretExternStructAsExternStruct(); | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | fn testReinterpretExternStructAsExternStruct() !void { |
| ... | ... | @@ -104,7 +104,7 @@ test "reinterpret bytes of an extern struct into another" { |
| 104 | 104 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 105 | 105 | |
| 106 | 106 | try testReinterpretOverAlignedExternStructAsExternStruct(); |
| 107 | comptime try testReinterpretOverAlignedExternStructAsExternStruct(); | |
| 107 | try comptime testReinterpretOverAlignedExternStructAsExternStruct(); | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | fn testReinterpretOverAlignedExternStructAsExternStruct() !void { |
test/behavior/saturating_arithmetic.zig+32-32| ... | ... | @@ -38,16 +38,16 @@ test "saturating add" { |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | 40 | try S.doTheTest(); |
| 41 | comptime try S.doTheTest(); | |
| 42 | ||
| 43 | comptime try S.testSatAdd(comptime_int, 0, 0, 0); | |
| 44 | comptime try S.testSatAdd(comptime_int, -1, 1, 0); | |
| 45 | comptime try S.testSatAdd(comptime_int, 3, 2, 5); | |
| 46 | comptime try S.testSatAdd(comptime_int, -3, -2, -5); | |
| 47 | comptime try S.testSatAdd(comptime_int, 3, -2, 1); | |
| 48 | comptime try S.testSatAdd(comptime_int, -3, 2, -1); | |
| 49 | comptime try S.testSatAdd(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 1119305249183743626545271163355074748512); | |
| 50 | comptime try S.testSatAdd(comptime_int, 7, -593423721213448152027139550640105366508, -593423721213448152027139550640105366501); | |
| 41 | try comptime S.doTheTest(); | |
| 42 | ||
| 43 | try comptime S.testSatAdd(comptime_int, 0, 0, 0); | |
| 44 | try comptime S.testSatAdd(comptime_int, -1, 1, 0); | |
| 45 | try comptime S.testSatAdd(comptime_int, 3, 2, 5); | |
| 46 | try comptime S.testSatAdd(comptime_int, -3, -2, -5); | |
| 47 | try comptime S.testSatAdd(comptime_int, 3, -2, 1); | |
| 48 | try comptime S.testSatAdd(comptime_int, -3, 2, -1); | |
| 49 | try comptime S.testSatAdd(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 1119305249183743626545271163355074748512); | |
| 50 | try comptime S.testSatAdd(comptime_int, 7, -593423721213448152027139550640105366508, -593423721213448152027139550640105366501); | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | test "saturating add 128bit" { |
| ... | ... | @@ -74,7 +74,7 @@ test "saturating add 128bit" { |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | 76 | try S.doTheTest(); |
| 77 | comptime try S.doTheTest(); | |
| 77 | try comptime S.doTheTest(); | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | test "saturating subtraction" { |
| ... | ... | @@ -110,16 +110,16 @@ test "saturating subtraction" { |
| 110 | 110 | }; |
| 111 | 111 | |
| 112 | 112 | try S.doTheTest(); |
| 113 | comptime try S.doTheTest(); | |
| 114 | ||
| 115 | comptime try S.testSatSub(comptime_int, 0, 0, 0); | |
| 116 | comptime try S.testSatSub(comptime_int, 1, 1, 0); | |
| 117 | comptime try S.testSatSub(comptime_int, 3, 2, 1); | |
| 118 | comptime try S.testSatSub(comptime_int, -3, -2, -1); | |
| 119 | comptime try S.testSatSub(comptime_int, 3, -2, 5); | |
| 120 | comptime try S.testSatSub(comptime_int, -3, 2, -5); | |
| 121 | comptime try S.testSatSub(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 182846383813587550256162760261375991602); | |
| 122 | comptime try S.testSatSub(comptime_int, 7, -593423721213448152027139550640105366508, 593423721213448152027139550640105366515); | |
| 113 | try comptime S.doTheTest(); | |
| 114 | ||
| 115 | try comptime S.testSatSub(comptime_int, 0, 0, 0); | |
| 116 | try comptime S.testSatSub(comptime_int, 1, 1, 0); | |
| 117 | try comptime S.testSatSub(comptime_int, 3, 2, 1); | |
| 118 | try comptime S.testSatSub(comptime_int, -3, -2, -1); | |
| 119 | try comptime S.testSatSub(comptime_int, 3, -2, 5); | |
| 120 | try comptime S.testSatSub(comptime_int, -3, 2, -5); | |
| 121 | try comptime S.testSatSub(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 182846383813587550256162760261375991602); | |
| 122 | try comptime S.testSatSub(comptime_int, 7, -593423721213448152027139550640105366508, 593423721213448152027139550640105366515); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | test "saturating subtraction 128bit" { |
| ... | ... | @@ -147,7 +147,7 @@ test "saturating subtraction 128bit" { |
| 147 | 147 | }; |
| 148 | 148 | |
| 149 | 149 | try S.doTheTest(); |
| 150 | comptime try S.doTheTest(); | |
| 150 | try comptime S.doTheTest(); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | test "saturating multiplication" { |
| ... | ... | @@ -188,12 +188,12 @@ test "saturating multiplication" { |
| 188 | 188 | }; |
| 189 | 189 | |
| 190 | 190 | try S.doTheTest(); |
| 191 | comptime try S.doTheTest(); | |
| 191 | try comptime S.doTheTest(); | |
| 192 | 192 | |
| 193 | comptime try S.testSatMul(comptime_int, 0, 0, 0); | |
| 194 | comptime try S.testSatMul(comptime_int, 3, 2, 6); | |
| 195 | comptime try S.testSatMul(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 304852860194144160265083087140337419215516305999637969803722975979232817921935); | |
| 196 | comptime try S.testSatMul(comptime_int, 7, -593423721213448152027139550640105366508, -4153966048494137064189976854480737565556); | |
| 193 | try comptime S.testSatMul(comptime_int, 0, 0, 0); | |
| 194 | try comptime S.testSatMul(comptime_int, 3, 2, 6); | |
| 195 | try comptime S.testSatMul(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 304852860194144160265083087140337419215516305999637969803722975979232817921935); | |
| 196 | try comptime S.testSatMul(comptime_int, 7, -593423721213448152027139550640105366508, -4153966048494137064189976854480737565556); | |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | test "saturating shift-left" { |
| ... | ... | @@ -228,12 +228,12 @@ test "saturating shift-left" { |
| 228 | 228 | }; |
| 229 | 229 | |
| 230 | 230 | try S.doTheTest(); |
| 231 | comptime try S.doTheTest(); | |
| 231 | try comptime S.doTheTest(); | |
| 232 | 232 | |
| 233 | comptime try S.testSatShl(comptime_int, 0, 0, 0); | |
| 234 | comptime try S.testSatShl(comptime_int, 1, 2, 4); | |
| 235 | comptime try S.testSatShl(comptime_int, 13, 150, 18554220005177478453757717602843436772975706112); | |
| 236 | comptime try S.testSatShl(comptime_int, -582769, 180, -893090893854873184096635538665358532628308979495815656505344); | |
| 233 | try comptime S.testSatShl(comptime_int, 0, 0, 0); | |
| 234 | try comptime S.testSatShl(comptime_int, 1, 2, 4); | |
| 235 | try comptime S.testSatShl(comptime_int, 13, 150, 18554220005177478453757717602843436772975706112); | |
| 236 | try comptime S.testSatShl(comptime_int, -582769, 180, -893090893854873184096635538665358532628308979495815656505344); | |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | test "saturating shl uses the LHS type" { |
test/behavior/select.zig+2-2| ... | ... | @@ -11,7 +11,7 @@ test "@select vectors" { |
| 11 | 11 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 12 | 12 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 13 | 13 | |
| 14 | comptime try selectVectors(); | |
| 14 | try comptime selectVectors(); | |
| 15 | 15 | try selectVectors(); |
| 16 | 16 | } |
| 17 | 17 | |
| ... | ... | @@ -40,7 +40,7 @@ test "@select arrays" { |
| 40 | 40 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 41 | 41 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 42 | 42 | |
| 43 | comptime try selectArrays(); | |
| 43 | try comptime selectArrays(); | |
| 44 | 44 | try selectArrays(); |
| 45 | 45 | } |
| 46 | 46 |
test/behavior/shuffle.zig+3-3| ... | ... | @@ -41,7 +41,7 @@ test "@shuffle int" { |
| 41 | 41 | } |
| 42 | 42 | }; |
| 43 | 43 | try S.doTheTest(); |
| 44 | comptime try S.doTheTest(); | |
| 44 | try comptime S.doTheTest(); | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | test "@shuffle bool 1" { |
| ... | ... | @@ -62,7 +62,7 @@ test "@shuffle bool 1" { |
| 62 | 62 | } |
| 63 | 63 | }; |
| 64 | 64 | try S.doTheTest(); |
| 65 | comptime try S.doTheTest(); | |
| 65 | try comptime S.doTheTest(); | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | test "@shuffle bool 2" { |
| ... | ... | @@ -88,5 +88,5 @@ test "@shuffle bool 2" { |
| 88 | 88 | } |
| 89 | 89 | }; |
| 90 | 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 | 24 | var var_1: u32 = undefined; |
| 25 | 25 | var var_2: u8 = undefined; |
| 26 | 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 | 30 | var var_1: f16 = undefined; |
| 31 | 31 | var var_2: f32 = undefined; |
| 32 | 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 | 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 | 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 | } |
| 44 | 44 | |
| ... | ... | @@ -148,7 +148,7 @@ test "@TypeOf() has no runtime side effects" { |
| 148 | 148 | }; |
| 149 | 149 | var data: i32 = 0; |
| 150 | 150 | const T = @TypeOf(S.foo(i32, &data)); |
| 151 | comptime try expect(T == i32); | |
| 151 | try comptime expect(T == i32); | |
| 152 | 152 | try expect(data == 0); |
| 153 | 153 | } |
| 154 | 154 | |
| ... | ... | @@ -163,7 +163,7 @@ test "branching logic inside @TypeOf" { |
| 163 | 163 | } |
| 164 | 164 | }; |
| 165 | 165 | const T = @TypeOf(S.foo() catch undefined); |
| 166 | comptime try expect(T == i32); | |
| 166 | try comptime expect(T == i32); | |
| 167 | 167 | try expect(S.data == 0); |
| 168 | 168 | } |
| 169 | 169 | |
| ... | ... | @@ -236,7 +236,7 @@ test "hardcoded address in typeof expression" { |
| 236 | 236 | } |
| 237 | 237 | }; |
| 238 | 238 | try expect(S.func() == 0); |
| 239 | comptime try expect(S.func() == 0); | |
| 239 | try comptime expect(S.func() == 0); | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | 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 | 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 | } |
| 251 | 251 | |
| 252 | 252 | test "lazy size cast to float" { |
test/behavior/slice.zig+75-75| ... | ... | @@ -87,7 +87,7 @@ test "access len index of sentinel-terminated slice" { |
| 87 | 87 | } |
| 88 | 88 | }; |
| 89 | 89 | try S.doTheTest(); |
| 90 | comptime try S.doTheTest(); | |
| 90 | try comptime S.doTheTest(); | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | test "comptime slice of slice preserves comptime var" { |
| ... | ... | @@ -139,7 +139,7 @@ test "slice of hardcoded address to pointer" { |
| 139 | 139 | const S = struct { |
| 140 | 140 | fn doTheTest() !void { |
| 141 | 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 | 143 | const slice: []const u8 = pointer; |
| 144 | 144 | try expect(@ptrToInt(slice.ptr) == 4); |
| 145 | 145 | try expect(slice.len == 2); |
| ... | ... | @@ -214,9 +214,9 @@ test "slice string literal has correct type" { |
| 214 | 214 | try expect(@TypeOf(array[0..]) == *const [4]i32); |
| 215 | 215 | } |
| 216 | 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 | 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 | } |
| 221 | 221 | |
| 222 | 222 | test "result location zero sized array inside struct field implicit cast to slice" { |
| ... | ... | @@ -265,8 +265,8 @@ test "C pointer slice access" { |
| 265 | 265 | const c_ptr = @ptrCast([*c]const u32, &buf); |
| 266 | 266 | |
| 267 | 267 | var runtime_zero: usize = 0; |
| 268 | comptime try expectEqual([]const u32, @TypeOf(c_ptr[runtime_zero..1])); | |
| 269 | comptime try expectEqual(*const [1]u32, @TypeOf(c_ptr[0..1])); | |
| 268 | try comptime expectEqual([]const u32, @TypeOf(c_ptr[runtime_zero..1])); | |
| 269 | try comptime expectEqual(*const [1]u32, @TypeOf(c_ptr[0..1])); | |
| 270 | 270 | |
| 271 | 271 | for (c_ptr[0..5]) |*cl| { |
| 272 | 272 | try expect(@as(u32, 42) == cl.*); |
| ... | ... | @@ -320,10 +320,10 @@ test "obtaining a null terminated slice" { |
| 320 | 320 | var runtime_len: usize = 3; |
| 321 | 321 | const ptr2 = buf[0..runtime_len :0]; |
| 322 | 322 | // ptr2 is a null-terminated slice |
| 323 | comptime try expect(@TypeOf(ptr2) == [:0]u8); | |
| 324 | comptime try expect(@TypeOf(ptr2[0..2]) == *[2]u8); | |
| 323 | try comptime expect(@TypeOf(ptr2) == [:0]u8); | |
| 324 | try comptime expect(@TypeOf(ptr2[0..2]) == *[2]u8); | |
| 325 | 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 | } |
| 328 | 328 | |
| 329 | 329 | test "empty array to slice" { |
| ... | ... | @@ -340,7 +340,7 @@ test "empty array to slice" { |
| 340 | 340 | }; |
| 341 | 341 | |
| 342 | 342 | try S.doTheTest(); |
| 343 | comptime try S.doTheTest(); | |
| 343 | try comptime S.doTheTest(); | |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | test "@ptrCast slice to pointer" { |
| ... | ... | @@ -358,7 +358,7 @@ test "@ptrCast slice to pointer" { |
| 358 | 358 | }; |
| 359 | 359 | |
| 360 | 360 | try S.doTheTest(); |
| 361 | comptime try S.doTheTest(); | |
| 361 | try comptime S.doTheTest(); | |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | test "slice syntax resulting in pointer-to-array" { |
| ... | ... | @@ -389,29 +389,29 @@ test "slice syntax resulting in pointer-to-array" { |
| 389 | 389 | fn testArray() !void { |
| 390 | 390 | var array = [5]u8{ 1, 2, 3, 4, 5 }; |
| 391 | 391 | var slice = array[1..3]; |
| 392 | comptime try expect(@TypeOf(slice) == *[2]u8); | |
| 392 | try comptime expect(@TypeOf(slice) == *[2]u8); | |
| 393 | 393 | try expect(slice[0] == 2); |
| 394 | 394 | try expect(slice[1] == 3); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | fn testArrayZ() !void { |
| 398 | 398 | var array = [5:0]u8{ 1, 2, 3, 4, 5 }; |
| 399 | comptime try expect(@TypeOf(array[1..3]) == *[2]u8); | |
| 400 | comptime try expect(@TypeOf(array[1..5]) == *[4:0]u8); | |
| 401 | comptime try expect(@TypeOf(array[1..]) == *[4:0]u8); | |
| 402 | comptime try expect(@TypeOf(array[1..3 :4]) == *[2:4]u8); | |
| 399 | try comptime expect(@TypeOf(array[1..3]) == *[2]u8); | |
| 400 | try comptime expect(@TypeOf(array[1..5]) == *[4:0]u8); | |
| 401 | try comptime expect(@TypeOf(array[1..]) == *[4:0]u8); | |
| 402 | try comptime expect(@TypeOf(array[1..3 :4]) == *[2:4]u8); | |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | fn testArray0() !void { |
| 406 | 406 | { |
| 407 | 407 | var array = [0]u8{}; |
| 408 | 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 | 412 | var array = [0:0]u8{}; |
| 413 | 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 | 415 | try expect(slice[0] == 0); |
| 416 | 416 | } |
| 417 | 417 | } |
| ... | ... | @@ -419,16 +419,16 @@ test "slice syntax resulting in pointer-to-array" { |
| 419 | 419 | fn testArrayAlign() !void { |
| 420 | 420 | var array align(4) = [5]u8{ 1, 2, 3, 4, 5 }; |
| 421 | 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 | 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 | } |
| 426 | 426 | |
| 427 | 427 | fn testPointer() !void { |
| 428 | 428 | var array = [5]u8{ 1, 2, 3, 4, 5 }; |
| 429 | 429 | var pointer: [*]u8 = &array; |
| 430 | 430 | var slice = pointer[1..3]; |
| 431 | comptime try expect(@TypeOf(slice) == *[2]u8); | |
| 431 | try comptime expect(@TypeOf(slice) == *[2]u8); | |
| 432 | 432 | try expect(slice[0] == 2); |
| 433 | 433 | try expect(slice[1] == 3); |
| 434 | 434 | } |
| ... | ... | @@ -436,14 +436,14 @@ test "slice syntax resulting in pointer-to-array" { |
| 436 | 436 | fn testPointerZ() !void { |
| 437 | 437 | var array = [5:0]u8{ 1, 2, 3, 4, 5 }; |
| 438 | 438 | var pointer: [*:0]u8 = &array; |
| 439 | comptime try expect(@TypeOf(pointer[1..3]) == *[2]u8); | |
| 440 | comptime try expect(@TypeOf(pointer[1..3 :4]) == *[2:4]u8); | |
| 439 | try comptime expect(@TypeOf(pointer[1..3]) == *[2]u8); | |
| 440 | try comptime expect(@TypeOf(pointer[1..3 :4]) == *[2:4]u8); | |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | fn testPointer0() !void { |
| 444 | 444 | var pointer: [*]const u0 = &[1]u0{0}; |
| 445 | 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 | 447 | try expect(slice[0] == 0); |
| 448 | 448 | } |
| 449 | 449 | |
| ... | ... | @@ -451,16 +451,16 @@ test "slice syntax resulting in pointer-to-array" { |
| 451 | 451 | var array align(4) = [5]u8{ 1, 2, 3, 4, 5 }; |
| 452 | 452 | var pointer: [*]align(4) u8 = &array; |
| 453 | 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 | 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 | } |
| 458 | 458 | |
| 459 | 459 | fn testSlice() !void { |
| 460 | 460 | var array = [5]u8{ 1, 2, 3, 4, 5 }; |
| 461 | 461 | var src_slice: []u8 = &array; |
| 462 | 462 | var slice = src_slice[1..3]; |
| 463 | comptime try expect(@TypeOf(slice) == *[2]u8); | |
| 463 | try comptime expect(@TypeOf(slice) == *[2]u8); | |
| 464 | 464 | try expect(slice[0] == 2); |
| 465 | 465 | try expect(slice[1] == 3); |
| 466 | 466 | } |
| ... | ... | @@ -468,26 +468,26 @@ test "slice syntax resulting in pointer-to-array" { |
| 468 | 468 | fn testSliceZ() !void { |
| 469 | 469 | var array = [5:0]u8{ 1, 2, 3, 4, 5 }; |
| 470 | 470 | var slice: [:0]u8 = &array; |
| 471 | comptime try expect(@TypeOf(slice[1..3]) == *[2]u8); | |
| 472 | comptime try expect(@TypeOf(slice[1..]) == [:0]u8); | |
| 473 | comptime try expect(@TypeOf(slice[1..3 :4]) == *[2:4]u8); | |
| 471 | try comptime expect(@TypeOf(slice[1..3]) == *[2]u8); | |
| 472 | try comptime expect(@TypeOf(slice[1..]) == [:0]u8); | |
| 473 | try comptime expect(@TypeOf(slice[1..3 :4]) == *[2:4]u8); | |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | fn testSliceOpt() !void { |
| 477 | 477 | var array: [2]u8 = [2]u8{ 1, 2 }; |
| 478 | 478 | var slice: ?[]u8 = &array; |
| 479 | comptime try expect(@TypeOf(&array, slice) == ?[]u8); | |
| 480 | comptime try expect(@TypeOf(slice, &array) == ?[]u8); | |
| 481 | comptime try expect(@TypeOf(slice.?[0..2]) == *[2]u8); | |
| 479 | try comptime expect(@TypeOf(&array, slice) == ?[]u8); | |
| 480 | try comptime expect(@TypeOf(slice, &array) == ?[]u8); | |
| 481 | try comptime expect(@TypeOf(slice.?[0..2]) == *[2]u8); | |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | fn testSliceAlign() !void { |
| 485 | 485 | var array align(4) = [5]u8{ 1, 2, 3, 4, 5 }; |
| 486 | 486 | var src_slice: []align(4) u8 = &array; |
| 487 | 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 | 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 | } |
| 492 | 492 | |
| 493 | 493 | fn testConcatStrLiterals() !void { |
| ... | ... | @@ -498,67 +498,67 @@ test "slice syntax resulting in pointer-to-array" { |
| 498 | 498 | fn testSliceLength() !void { |
| 499 | 499 | var array = [5]u8{ 1, 2, 3, 4, 5 }; |
| 500 | 500 | var slice: []u8 = &array; |
| 501 | comptime try expect(@TypeOf(slice[1..][0..2]) == *[2]u8); | |
| 502 | comptime try expect(@TypeOf(slice[1..][0..4]) == *[4]u8); | |
| 503 | comptime try expect(@TypeOf(slice[1..][0..2 :4]) == *[2:4]u8); | |
| 501 | try comptime expect(@TypeOf(slice[1..][0..2]) == *[2]u8); | |
| 502 | try comptime expect(@TypeOf(slice[1..][0..4]) == *[4]u8); | |
| 503 | try comptime expect(@TypeOf(slice[1..][0..2 :4]) == *[2:4]u8); | |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | fn testSliceLengthZ() !void { |
| 507 | 507 | var array = [5:0]u8{ 1, 2, 3, 4, 5 }; |
| 508 | 508 | var slice: [:0]u8 = &array; |
| 509 | comptime try expect(@TypeOf(slice[1..][0..2]) == *[2]u8); | |
| 510 | comptime try expect(@TypeOf(slice[1..][0..2 :4]) == *[2:4]u8); | |
| 511 | comptime try expect(@TypeOf(slice[1.. :0][0..2]) == *[2]u8); | |
| 512 | comptime try expect(@TypeOf(slice[1.. :0][0..2 :4]) == *[2:4]u8); | |
| 509 | try comptime expect(@TypeOf(slice[1..][0..2]) == *[2]u8); | |
| 510 | try comptime expect(@TypeOf(slice[1..][0..2 :4]) == *[2:4]u8); | |
| 511 | try comptime expect(@TypeOf(slice[1.. :0][0..2]) == *[2]u8); | |
| 512 | try comptime expect(@TypeOf(slice[1.. :0][0..2 :4]) == *[2:4]u8); | |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | fn testArrayLength() !void { |
| 516 | 516 | var array = [5]u8{ 1, 2, 3, 4, 5 }; |
| 517 | comptime try expect(@TypeOf(array[1..][0..2]) == *[2]u8); | |
| 518 | comptime try expect(@TypeOf(array[1..][0..4]) == *[4]u8); | |
| 519 | comptime try expect(@TypeOf(array[1..][0..2 :4]) == *[2:4]u8); | |
| 517 | try comptime expect(@TypeOf(array[1..][0..2]) == *[2]u8); | |
| 518 | try comptime expect(@TypeOf(array[1..][0..4]) == *[4]u8); | |
| 519 | try comptime expect(@TypeOf(array[1..][0..2 :4]) == *[2:4]u8); | |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | fn testArrayLengthZ() !void { |
| 523 | 523 | var array = [5:0]u8{ 1, 2, 3, 4, 5 }; |
| 524 | comptime try expect(@TypeOf(array[1..][0..2]) == *[2]u8); | |
| 525 | comptime try expect(@TypeOf(array[1..][0..4]) == *[4:0]u8); | |
| 526 | comptime try expect(@TypeOf(array[1..][0..2 :4]) == *[2:4]u8); | |
| 527 | comptime try expect(@TypeOf(array[1.. :0][0..2]) == *[2]u8); | |
| 528 | comptime try expect(@TypeOf(array[1.. :0][0..4]) == *[4:0]u8); | |
| 529 | comptime try expect(@TypeOf(array[1.. :0][0..2 :4]) == *[2:4]u8); | |
| 524 | try comptime expect(@TypeOf(array[1..][0..2]) == *[2]u8); | |
| 525 | try comptime expect(@TypeOf(array[1..][0..4]) == *[4:0]u8); | |
| 526 | try comptime expect(@TypeOf(array[1..][0..2 :4]) == *[2:4]u8); | |
| 527 | try comptime expect(@TypeOf(array[1.. :0][0..2]) == *[2]u8); | |
| 528 | try comptime expect(@TypeOf(array[1.. :0][0..4]) == *[4:0]u8); | |
| 529 | try comptime expect(@TypeOf(array[1.. :0][0..2 :4]) == *[2:4]u8); | |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | fn testMultiPointer() !void { |
| 533 | 533 | var array = [5]u8{ 1, 2, 3, 4, 5 }; |
| 534 | 534 | var ptr: [*]u8 = &array; |
| 535 | comptime try expect(@TypeOf(ptr[1..][0..2]) == *[2]u8); | |
| 536 | comptime try expect(@TypeOf(ptr[1..][0..4]) == *[4]u8); | |
| 537 | comptime try expect(@TypeOf(ptr[1..][0..2 :4]) == *[2:4]u8); | |
| 535 | try comptime expect(@TypeOf(ptr[1..][0..2]) == *[2]u8); | |
| 536 | try comptime expect(@TypeOf(ptr[1..][0..4]) == *[4]u8); | |
| 537 | try comptime expect(@TypeOf(ptr[1..][0..2 :4]) == *[2:4]u8); | |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | fn testMultiPointerLengthZ() !void { |
| 541 | 541 | var array = [5:0]u8{ 1, 2, 3, 4, 5 }; |
| 542 | 542 | var ptr: [*]u8 = &array; |
| 543 | comptime try expect(@TypeOf(ptr[1..][0..2]) == *[2]u8); | |
| 544 | comptime try expect(@TypeOf(ptr[1..][0..4]) == *[4:0]u8); | |
| 545 | comptime try expect(@TypeOf(ptr[1..][0..2 :4]) == *[2:4]u8); | |
| 546 | comptime try expect(@TypeOf(ptr[1.. :0][0..2]) == *[2]u8); | |
| 547 | comptime try expect(@TypeOf(ptr[1.. :0][0..4]) == *[4:0]u8); | |
| 548 | comptime try expect(@TypeOf(ptr[1.. :0][0..2 :4]) == *[2:4]u8); | |
| 543 | try comptime expect(@TypeOf(ptr[1..][0..2]) == *[2]u8); | |
| 544 | try comptime expect(@TypeOf(ptr[1..][0..4]) == *[4:0]u8); | |
| 545 | try comptime expect(@TypeOf(ptr[1..][0..2 :4]) == *[2:4]u8); | |
| 546 | try comptime expect(@TypeOf(ptr[1.. :0][0..2]) == *[2]u8); | |
| 547 | try comptime expect(@TypeOf(ptr[1.. :0][0..4]) == *[4:0]u8); | |
| 548 | try comptime expect(@TypeOf(ptr[1.. :0][0..2 :4]) == *[2:4]u8); | |
| 549 | 549 | |
| 550 | 550 | var ptr_z: [*:0]u8 = &array; |
| 551 | comptime try expect(@TypeOf(ptr_z[1..][0..2]) == *[2]u8); | |
| 552 | comptime try expect(@TypeOf(ptr_z[1..][0..4]) == *[4:0]u8); | |
| 553 | comptime try expect(@TypeOf(ptr_z[1..][0..2 :4]) == *[2:4]u8); | |
| 554 | comptime try expect(@TypeOf(ptr_z[1.. :0][0..2]) == *[2]u8); | |
| 555 | comptime try 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); | |
| 551 | try comptime expect(@TypeOf(ptr_z[1..][0..2]) == *[2]u8); | |
| 552 | try comptime expect(@TypeOf(ptr_z[1..][0..4]) == *[4:0]u8); | |
| 553 | try comptime expect(@TypeOf(ptr_z[1..][0..2 :4]) == *[2:4]u8); | |
| 554 | try comptime expect(@TypeOf(ptr_z[1.. :0][0..2]) == *[2]u8); | |
| 555 | try comptime expect(@TypeOf(ptr_z[1.. :0][0..4]) == *[4:0]u8); | |
| 556 | try comptime expect(@TypeOf(ptr_z[1.. :0][0..2 :4]) == *[2:4]u8); | |
| 557 | 557 | } |
| 558 | 558 | }; |
| 559 | 559 | |
| 560 | 560 | try S.doTheTest(); |
| 561 | comptime try S.doTheTest(); | |
| 561 | try comptime S.doTheTest(); | |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | test "slice pointer-to-array null terminated" { |
| ... | ... | @@ -576,9 +576,9 @@ test "slice pointer-to-array null terminated" { |
| 576 | 576 | |
| 577 | 577 | var array = [5:0]u8{ 1, 2, 3, 4, 5 }; |
| 578 | 578 | var slice: [:0]u8 = &array; |
| 579 | comptime try expect(@TypeOf(slice[1..3]) == *[2]u8); | |
| 580 | comptime try expect(@TypeOf(slice[1..3 :4]) == *[2:4]u8); | |
| 581 | comptime try expect(@TypeOf(slice[1..]) == [:0]u8); | |
| 579 | try comptime expect(@TypeOf(slice[1..3]) == *[2]u8); | |
| 580 | try comptime expect(@TypeOf(slice[1..3 :4]) == *[2:4]u8); | |
| 581 | try comptime expect(@TypeOf(slice[1..]) == [:0]u8); | |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | test "slice pointer-to-array zero length" { |
| ... | ... | @@ -604,13 +604,13 @@ test "slice pointer-to-array zero length" { |
| 604 | 604 | var array = [0]u8{}; |
| 605 | 605 | var src_slice: []u8 = &array; |
| 606 | 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 | 610 | var array = [0:0]u8{}; |
| 611 | 611 | var src_slice: [:0]u8 = &array; |
| 612 | 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 | } |
| 616 | 616 | |
| ... | ... | @@ -647,7 +647,7 @@ test "type coercion of pointer to anon struct literal to pointer to slice" { |
| 647 | 647 | } |
| 648 | 648 | }; |
| 649 | 649 | try S.doTheTest(); |
| 650 | comptime try S.doTheTest(); | |
| 650 | try comptime S.doTheTest(); | |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | test "array concat of slices gives ptr to array" { |
| ... | ... | @@ -719,7 +719,7 @@ test "slicing array with sentinel as end index" { |
| 719 | 719 | }; |
| 720 | 720 | |
| 721 | 721 | try S.do(); |
| 722 | comptime try S.do(); | |
| 722 | try comptime S.do(); | |
| 723 | 723 | } |
| 724 | 724 | |
| 725 | 725 | test "slicing slice with sentinel as end index" { |
| ... | ... | @@ -739,7 +739,7 @@ test "slicing slice with sentinel as end index" { |
| 739 | 739 | }; |
| 740 | 740 | |
| 741 | 741 | try S.do(); |
| 742 | comptime try S.do(); | |
| 742 | try comptime S.do(); | |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | test "slice len modification at comptime" { |
test/behavior/struct.zig+18-18| ... | ... | @@ -268,7 +268,7 @@ test "struct field init with catch" { |
| 268 | 268 | }; |
| 269 | 269 | }; |
| 270 | 270 | try S.doTheTest(); |
| 271 | comptime try S.doTheTest(); | |
| 271 | try comptime S.doTheTest(); | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | const blah: packed struct { |
| ... | ... | @@ -603,7 +603,7 @@ test "bit field access" { |
| 603 | 603 | try expect(getA(&data) == 1); |
| 604 | 604 | try expect(getB(&data) == 2); |
| 605 | 605 | try expect(getC(&data) == 3); |
| 606 | comptime try expect(@sizeOf(BitField1) == 1); | |
| 606 | try comptime expect(@sizeOf(BitField1) == 1); | |
| 607 | 607 | |
| 608 | 608 | data.b += 1; |
| 609 | 609 | try expect(data.b == 3); |
| ... | ... | @@ -740,7 +740,7 @@ test "packed struct with u0 field access" { |
| 740 | 740 | f0: u0, |
| 741 | 741 | }; |
| 742 | 742 | var s = S{ .f0 = 0 }; |
| 743 | comptime try expect(s.f0 == 0); | |
| 743 | try comptime expect(s.f0 == 0); | |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | test "access to global struct fields" { |
| ... | ... | @@ -817,7 +817,7 @@ test "fn with C calling convention returns struct by value" { |
| 817 | 817 | } |
| 818 | 818 | }; |
| 819 | 819 | try S.entry(); |
| 820 | comptime try S.entry(); | |
| 820 | try comptime S.entry(); | |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | test "non-packed struct with u128 entry in union" { |
| ... | ... | @@ -889,7 +889,7 @@ test "anonymous struct literal syntax" { |
| 889 | 889 | } |
| 890 | 890 | }; |
| 891 | 891 | try S.doTheTest(); |
| 892 | comptime try S.doTheTest(); | |
| 892 | try comptime S.doTheTest(); | |
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | test "fully anonymous struct" { |
| ... | ... | @@ -911,7 +911,7 @@ test "fully anonymous struct" { |
| 911 | 911 | } |
| 912 | 912 | }; |
| 913 | 913 | try S.doTheTest(); |
| 914 | comptime try S.doTheTest(); | |
| 914 | try comptime S.doTheTest(); | |
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | test "fully anonymous list literal" { |
| ... | ... | @@ -928,7 +928,7 @@ test "fully anonymous list literal" { |
| 928 | 928 | } |
| 929 | 929 | }; |
| 930 | 930 | try S.doTheTest(); |
| 931 | comptime try S.doTheTest(); | |
| 931 | try comptime S.doTheTest(); | |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | 934 | test "tuple assigned to variable" { |
| ... | ... | @@ -955,7 +955,7 @@ test "comptime struct field" { |
| 955 | 955 | comptime std.debug.assert(@sizeOf(T) == 4); |
| 956 | 956 | |
| 957 | 957 | var foo: T = undefined; |
| 958 | comptime try expect(foo.b == 1234); | |
| 958 | try comptime expect(foo.b == 1234); | |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | test "tuple element initialized with fn call" { |
| ... | ... | @@ -974,7 +974,7 @@ test "tuple element initialized with fn call" { |
| 974 | 974 | } |
| 975 | 975 | }; |
| 976 | 976 | try S.doTheTest(); |
| 977 | comptime try S.doTheTest(); | |
| 977 | try comptime S.doTheTest(); | |
| 978 | 978 | } |
| 979 | 979 | |
| 980 | 980 | test "struct with union field" { |
| ... | ... | @@ -1033,7 +1033,7 @@ test "type coercion of anon struct literal to struct" { |
| 1033 | 1033 | } |
| 1034 | 1034 | }; |
| 1035 | 1035 | try S.doTheTest(); |
| 1036 | comptime try S.doTheTest(); | |
| 1036 | try comptime S.doTheTest(); | |
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | 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 | 1073 | try S.doTheTest(); |
| 1074 | comptime try S.doTheTest(); | |
| 1074 | try comptime S.doTheTest(); | |
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | 1077 | test "packed struct with undefined initializers" { |
| ... | ... | @@ -1104,7 +1104,7 @@ test "packed struct with undefined initializers" { |
| 1104 | 1104 | }; |
| 1105 | 1105 | |
| 1106 | 1106 | try S.doTheTest(); |
| 1107 | comptime try S.doTheTest(); | |
| 1107 | try comptime S.doTheTest(); | |
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | 1110 | test "for loop over pointers to struct, getting field from struct pointer" { |
| ... | ... | @@ -1169,7 +1169,7 @@ test "anon init through error unions and optionals" { |
| 1169 | 1169 | }; |
| 1170 | 1170 | |
| 1171 | 1171 | try S.doTheTest(); |
| 1172 | comptime try S.doTheTest(); | |
| 1172 | try comptime S.doTheTest(); | |
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | 1175 | test "anon init through optional" { |
| ... | ... | @@ -1189,7 +1189,7 @@ test "anon init through optional" { |
| 1189 | 1189 | }; |
| 1190 | 1190 | |
| 1191 | 1191 | try S.doTheTest(); |
| 1192 | comptime try S.doTheTest(); | |
| 1192 | try comptime S.doTheTest(); | |
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | test "anon init through error union" { |
| ... | ... | @@ -1209,7 +1209,7 @@ test "anon init through error union" { |
| 1209 | 1209 | }; |
| 1210 | 1210 | |
| 1211 | 1211 | try S.doTheTest(); |
| 1212 | comptime try S.doTheTest(); | |
| 1212 | try comptime S.doTheTest(); | |
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | test "typed init through error unions and optionals" { |
| ... | ... | @@ -1236,7 +1236,7 @@ test "typed init through error unions and optionals" { |
| 1236 | 1236 | }; |
| 1237 | 1237 | |
| 1238 | 1238 | try S.doTheTest(); |
| 1239 | comptime try S.doTheTest(); | |
| 1239 | try comptime S.doTheTest(); | |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | test "initialize struct with empty literal" { |
| ... | ... | @@ -1311,7 +1311,7 @@ test "packed struct field access via pointer" { |
| 1311 | 1311 | } |
| 1312 | 1312 | }; |
| 1313 | 1313 | try S.doTheTest(); |
| 1314 | comptime try S.doTheTest(); | |
| 1314 | try comptime S.doTheTest(); | |
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | test "store to comptime field" { |
| ... | ... | @@ -1416,7 +1416,7 @@ test "fieldParentPtr of a zero-bit field" { |
| 1416 | 1416 | } |
| 1417 | 1417 | }; |
| 1418 | 1418 | try S.doTheTest(); |
| 1419 | comptime try S.doTheTest(); | |
| 1419 | try comptime S.doTheTest(); | |
| 1420 | 1420 | } |
| 1421 | 1421 | |
| 1422 | 1422 | test "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 | 121 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 122 | 122 | |
| 123 | 123 | try testSwitchOnBools(); |
| 124 | comptime try testSwitchOnBools(); | |
| 124 | try comptime testSwitchOnBools(); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | fn testSwitchOnBools() !void { |
| ... | ... | @@ -186,10 +186,10 @@ test "switch variable for range and multiple prongs" { |
| 186 | 186 | fn doTheTest() !void { |
| 187 | 187 | var u: u8 = 16; |
| 188 | 188 | try doTheSwitch(u); |
| 189 | comptime try doTheSwitch(u); | |
| 189 | try comptime doTheSwitch(u); | |
| 190 | 190 | var v: u8 = 42; |
| 191 | 191 | try doTheSwitch(v); |
| 192 | comptime try doTheSwitch(v); | |
| 192 | try comptime doTheSwitch(v); | |
| 193 | 193 | } |
| 194 | 194 | fn doTheSwitch(q: u8) !void { |
| 195 | 195 | switch (q) { |
| ... | ... | @@ -260,7 +260,7 @@ test "switch on enum using pointer capture" { |
| 260 | 260 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 261 | 261 | |
| 262 | 262 | try testSwitchEnumPtrCapture(); |
| 263 | comptime try testSwitchEnumPtrCapture(); | |
| 263 | try comptime testSwitchEnumPtrCapture(); | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | fn testSwitchEnumPtrCapture() !void { |
| ... | ... | @@ -279,7 +279,7 @@ test "switch handles all cases of number" { |
| 279 | 279 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 280 | 280 | |
| 281 | 281 | try testSwitchHandleAllCases(); |
| 282 | comptime try testSwitchHandleAllCases(); | |
| 282 | try comptime testSwitchHandleAllCases(); | |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | fn testSwitchHandleAllCases() !void { |
| ... | ... | @@ -373,7 +373,7 @@ test "switch all prongs unreachable" { |
| 373 | 373 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 374 | 374 | |
| 375 | 375 | try testAllProngsUnreachable(); |
| 376 | comptime try testAllProngsUnreachable(); | |
| 376 | try comptime testAllProngsUnreachable(); | |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | fn testAllProngsUnreachable() !void { |
| ... | ... | @@ -421,7 +421,7 @@ test "switch on integer with else capturing expr" { |
| 421 | 421 | } |
| 422 | 422 | }; |
| 423 | 423 | try S.doTheTest(); |
| 424 | comptime try S.doTheTest(); | |
| 424 | try comptime S.doTheTest(); | |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | 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 | 458 | try S.doTheTest(); |
| 459 | comptime try S.doTheTest(); | |
| 459 | try comptime S.doTheTest(); | |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | test "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 | 493 | } |
| 494 | 494 | }; |
| 495 | 495 | try S.doTheTest(); |
| 496 | comptime try S.doTheTest(); | |
| 496 | try comptime S.doTheTest(); | |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | test "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 | 512 | } |
| 513 | 513 | }; |
| 514 | 514 | try S.doTheTest(); |
| 515 | comptime try S.doTheTest(); | |
| 515 | try comptime S.doTheTest(); | |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | 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 | 534 | try S.doTheTest(1); |
| 535 | comptime try S.doTheTest(1); | |
| 535 | try comptime S.doTheTest(1); | |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | 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 | 579 | try S.doTheTest(); |
| 580 | comptime try S.doTheTest(); | |
| 580 | try comptime S.doTheTest(); | |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | test "switch on pointer type" { |
| ... | ... | @@ -606,9 +606,9 @@ test "switch on pointer type" { |
| 606 | 606 | try expect(1 == S.doTheTest(S.P1)); |
| 607 | 607 | try expect(2 == S.doTheTest(S.P2)); |
| 608 | 608 | try expect(3 == S.doTheTest(S.P3)); |
| 609 | comptime try expect(1 == S.doTheTest(S.P1)); | |
| 610 | comptime try expect(2 == S.doTheTest(S.P2)); | |
| 611 | comptime try expect(3 == S.doTheTest(S.P3)); | |
| 609 | try comptime expect(1 == S.doTheTest(S.P1)); | |
| 610 | try comptime expect(2 == S.doTheTest(S.P2)); | |
| 611 | try comptime expect(3 == S.doTheTest(S.P3)); | |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | test "switch on error set with single else" { |
| ... | ... | @@ -624,7 +624,7 @@ test "switch on error set with single else" { |
| 624 | 624 | }; |
| 625 | 625 | |
| 626 | 626 | try S.doTheTest(); |
| 627 | comptime try S.doTheTest(); | |
| 627 | try comptime S.doTheTest(); | |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | test "switch capture copies its payload" { |
| ... | ... | @@ -650,7 +650,7 @@ test "switch capture copies its payload" { |
| 650 | 650 | } |
| 651 | 651 | }; |
| 652 | 652 | try S.doTheTest(); |
| 653 | comptime try S.doTheTest(); | |
| 653 | try comptime S.doTheTest(); | |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | 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 | 671 | try S.foo(42); |
| 672 | 672 | try S.foo(100); |
| 673 | comptime try S.foo(42); | |
| 674 | comptime try S.foo(100); | |
| 673 | try comptime S.foo(42); | |
| 674 | try comptime S.foo(100); | |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | test "enum value without tag name used as switch item" { |
| ... | ... | @@ -702,7 +702,7 @@ test "switch item sizeof" { |
| 702 | 702 | } |
| 703 | 703 | }; |
| 704 | 704 | try S.doTheTest(); |
| 705 | comptime try S.doTheTest(); | |
| 705 | try comptime S.doTheTest(); | |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | test "comptime inline switch" { |
test/behavior/truncate.zig+3-3| ... | ... | @@ -5,7 +5,7 @@ const expect = std.testing.expect; |
| 5 | 5 | test "truncate u0 to larger integer allowed and has comptime-known result" { |
| 6 | 6 | var x: u0 = 0; |
| 7 | 7 | const y = @truncate(u8, x); |
| 8 | comptime try expect(y == 0); | |
| 8 | try comptime expect(y == 0); | |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | test "truncate.u0.literal" { |
| ... | ... | @@ -28,7 +28,7 @@ test "truncate.u0.var" { |
| 28 | 28 | test "truncate i0 to larger integer allowed and has comptime-known result" { |
| 29 | 29 | var x: i0 = 0; |
| 30 | 30 | const y = @truncate(i8, x); |
| 31 | comptime try expect(y == 0); | |
| 31 | try comptime expect(y == 0); | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | test "truncate.i0.literal" { |
| ... | ... | @@ -73,6 +73,6 @@ test "truncate on vectors" { |
| 73 | 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 | 77 | try S.doTheTest(); |
| 78 | 78 | } |
test/behavior/try.zig+1-1| ... | ... | @@ -7,7 +7,7 @@ test "try on error union" { |
| 7 | 7 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 8 | 8 | |
| 9 | 9 | try tryOnErrorUnionImpl(); |
| 10 | comptime try tryOnErrorUnionImpl(); | |
| 10 | try comptime tryOnErrorUnionImpl(); | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | fn tryOnErrorUnionImpl() !void { |
test/behavior/tuple.zig+7-7| ... | ... | @@ -23,7 +23,7 @@ test "tuple concatenation" { |
| 23 | 23 | } |
| 24 | 24 | }; |
| 25 | 25 | try S.doTheTest(); |
| 26 | comptime try S.doTheTest(); | |
| 26 | try comptime S.doTheTest(); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | test "tuple multiplication" { |
| ... | ... | @@ -46,7 +46,7 @@ test "tuple multiplication" { |
| 46 | 46 | } |
| 47 | 47 | }; |
| 48 | 48 | try S.doTheTest(); |
| 49 | comptime try S.doTheTest(); | |
| 49 | try comptime S.doTheTest(); | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | test "more tuple concatenation" { |
| ... | ... | @@ -91,7 +91,7 @@ test "more tuple concatenation" { |
| 91 | 91 | }; |
| 92 | 92 | |
| 93 | 93 | try T.doTheTest(); |
| 94 | comptime try T.doTheTest(); | |
| 94 | try comptime T.doTheTest(); | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | test "pass tuple to comptime var parameter" { |
| ... | ... | @@ -105,7 +105,7 @@ test "pass tuple to comptime var parameter" { |
| 105 | 105 | } |
| 106 | 106 | }; |
| 107 | 107 | try S.doTheTest(); |
| 108 | comptime try S.doTheTest(); | |
| 108 | try comptime S.doTheTest(); | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | test "tuple initializer for var" { |
| ... | ... | @@ -163,7 +163,7 @@ test "array-like initializer for tuple types" { |
| 163 | 163 | }; |
| 164 | 164 | |
| 165 | 165 | try S.doTheTest(); |
| 166 | comptime try S.doTheTest(); | |
| 166 | try comptime S.doTheTest(); | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | 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 | }; |
| 181 | 181 | |
| 182 | 182 | try S.doTheTest(); |
| 183 | comptime try S.doTheTest(); | |
| 183 | try comptime S.doTheTest(); | |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | test "tuple as the result from a labeled block" { |
| ... | ... | @@ -195,7 +195,7 @@ test "tuple as the result from a labeled block" { |
| 195 | 195 | }; |
| 196 | 196 | |
| 197 | 197 | try S.doTheTest(); |
| 198 | comptime try S.doTheTest(); | |
| 198 | try comptime S.doTheTest(); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | test "initializing tuple with explicit type" { |
test/behavior/type_info.zig+20-20| ... | ... | @@ -10,7 +10,7 @@ const expectEqualStrings = std.testing.expectEqualStrings; |
| 10 | 10 | |
| 11 | 11 | test "type info: integer, floating point type info" { |
| 12 | 12 | try testIntFloat(); |
| 13 | comptime try testIntFloat(); | |
| 13 | try comptime testIntFloat(); | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | fn testIntFloat() !void { |
| ... | ... | @@ -26,7 +26,7 @@ fn testIntFloat() !void { |
| 26 | 26 | |
| 27 | 27 | test "type info: optional type info" { |
| 28 | 28 | try testOptional(); |
| 29 | comptime try testOptional(); | |
| 29 | try comptime testOptional(); | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | fn testOptional() !void { |
| ... | ... | @@ -37,7 +37,7 @@ fn testOptional() !void { |
| 37 | 37 | |
| 38 | 38 | test "type info: C pointer type info" { |
| 39 | 39 | try testCPtr(); |
| 40 | comptime try testCPtr(); | |
| 40 | try comptime testCPtr(); | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | fn testCPtr() !void { |
| ... | ... | @@ -60,7 +60,7 @@ test "type info: value is correctly copied" { |
| 60 | 60 | |
| 61 | 61 | test "type info: tag type, void info" { |
| 62 | 62 | try testBasic(); |
| 63 | comptime try testBasic(); | |
| 63 | try comptime testBasic(); | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | fn testBasic() !void { |
| ... | ... | @@ -72,7 +72,7 @@ fn testBasic() !void { |
| 72 | 72 | |
| 73 | 73 | test "type info: pointer type info" { |
| 74 | 74 | try testPointer(); |
| 75 | comptime try testPointer(); | |
| 75 | try comptime testPointer(); | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | fn testPointer() !void { |
| ... | ... | @@ -88,7 +88,7 @@ fn testPointer() !void { |
| 88 | 88 | |
| 89 | 89 | test "type info: unknown length pointer type info" { |
| 90 | 90 | try testUnknownLenPtr(); |
| 91 | comptime try testUnknownLenPtr(); | |
| 91 | try comptime testUnknownLenPtr(); | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | fn testUnknownLenPtr() !void { |
| ... | ... | @@ -104,7 +104,7 @@ fn testUnknownLenPtr() !void { |
| 104 | 104 | |
| 105 | 105 | test "type info: null terminated pointer type info" { |
| 106 | 106 | try testNullTerminatedPtr(); |
| 107 | comptime try testNullTerminatedPtr(); | |
| 107 | try comptime testNullTerminatedPtr(); | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | fn testNullTerminatedPtr() !void { |
| ... | ... | @@ -120,7 +120,7 @@ fn testNullTerminatedPtr() !void { |
| 120 | 120 | |
| 121 | 121 | test "type info: slice type info" { |
| 122 | 122 | try testSlice(); |
| 123 | comptime try testSlice(); | |
| 123 | try comptime testSlice(); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | fn testSlice() !void { |
| ... | ... | @@ -135,7 +135,7 @@ fn testSlice() !void { |
| 135 | 135 | |
| 136 | 136 | test "type info: array type info" { |
| 137 | 137 | try testArray(); |
| 138 | comptime try testArray(); | |
| 138 | try comptime testArray(); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | fn testArray() !void { |
| ... | ... | @@ -163,7 +163,7 @@ test "type info: error set, error union info, anyerror" { |
| 163 | 163 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 164 | 164 | |
| 165 | 165 | try testErrorSet(); |
| 166 | comptime try testErrorSet(); | |
| 166 | try comptime testErrorSet(); | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | fn testErrorSet() !void { |
| ... | ... | @@ -225,7 +225,7 @@ test "type info: enum info" { |
| 225 | 225 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 226 | 226 | |
| 227 | 227 | try testEnum(); |
| 228 | comptime try testEnum(); | |
| 228 | try comptime testEnum(); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | fn testEnum() !void { |
| ... | ... | @@ -247,7 +247,7 @@ fn testEnum() !void { |
| 247 | 247 | |
| 248 | 248 | test "type info: union info" { |
| 249 | 249 | try testUnion(); |
| 250 | comptime try testUnion(); | |
| 250 | try comptime testUnion(); | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | fn testUnion() !void { |
| ... | ... | @@ -257,7 +257,7 @@ fn testUnion() !void { |
| 257 | 257 | try expect(typeinfo_info.Union.tag_type.? == TypeId); |
| 258 | 258 | try expect(typeinfo_info.Union.fields.len == 24); |
| 259 | 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); | |
| 261 | 261 | |
| 262 | 262 | const TestNoTagUnion = union { |
| 263 | 263 | Foo: void, |
| ... | ... | @@ -287,7 +287,7 @@ test "type info: struct info" { |
| 287 | 287 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 288 | 288 | |
| 289 | 289 | try testStruct(); |
| 290 | comptime try testStruct(); | |
| 290 | try comptime testStruct(); | |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | fn testStruct() !void { |
| ... | ... | @@ -306,7 +306,7 @@ const TestStruct = struct { |
| 306 | 306 | |
| 307 | 307 | test "type info: packed struct info" { |
| 308 | 308 | try testPackedStruct(); |
| 309 | comptime try testPackedStruct(); | |
| 309 | try comptime testPackedStruct(); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | fn testPackedStruct() !void { |
| ... | ... | @@ -339,7 +339,7 @@ const TestPackedStruct = packed struct { |
| 339 | 339 | |
| 340 | 340 | test "type info: opaque info" { |
| 341 | 341 | try testOpaque(); |
| 342 | comptime try testOpaque(); | |
| 342 | try comptime testOpaque(); | |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | fn testOpaque() !void { |
| ... | ... | @@ -356,7 +356,7 @@ test "type info: function type info" { |
| 356 | 356 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 357 | 357 | |
| 358 | 358 | try testFunction(); |
| 359 | comptime try testFunction(); | |
| 359 | try comptime testFunction(); | |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | fn testFunction() !void { |
| ... | ... | @@ -427,7 +427,7 @@ test "typeInfo with comptime parameter in struct fn def" { |
| 427 | 427 | |
| 428 | 428 | test "type info: vectors" { |
| 429 | 429 | try testVector(); |
| 430 | comptime try testVector(); | |
| 430 | try comptime testVector(); | |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | fn testVector() !void { |
| ... | ... | @@ -444,7 +444,7 @@ test "type info: anyframe and anyframe->T" { |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | try testAnyFrame(); |
| 447 | comptime try testAnyFrame(); | |
| 447 | try comptime testAnyFrame(); | |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | fn testAnyFrame() !void { |
| ... | ... | @@ -489,7 +489,7 @@ test "@typeInfo does not force declarations into existence" { |
| 489 | 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 | } |
| 494 | 494 | |
| 495 | 495 | fn add(a: i32, b: i32) i32 { |
test/behavior/union.zig+28-28| ... | ... | @@ -113,7 +113,7 @@ const ExternPtrOrInt = extern union { |
| 113 | 113 | int: u64, |
| 114 | 114 | }; |
| 115 | 115 | test "extern union size" { |
| 116 | comptime try expect(@sizeOf(ExternPtrOrInt) == 8); | |
| 116 | try comptime expect(@sizeOf(ExternPtrOrInt) == 8); | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | test "0-sized extern union definition" { |
| ... | ... | @@ -165,7 +165,7 @@ test "access a member of tagged union with conflicting enum tag name" { |
| 165 | 165 | const B = void; |
| 166 | 166 | }; |
| 167 | 167 | |
| 168 | comptime try expect(Bar.A == u8); | |
| 168 | try comptime expect(Bar.A == u8); | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | test "constant tagged union with payload" { |
| ... | ... | @@ -225,7 +225,7 @@ test "union with specified enum tag" { |
| 225 | 225 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 226 | 226 | |
| 227 | 227 | try doTest(); |
| 228 | comptime try doTest(); | |
| 228 | try comptime doTest(); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | test "packed union generates correctly aligned type" { |
| ... | ... | @@ -274,7 +274,7 @@ test "comparison between union and enum literal" { |
| 274 | 274 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 275 | 275 | |
| 276 | 276 | try testComparison(); |
| 277 | comptime try testComparison(); | |
| 277 | try comptime testComparison(); | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | const TheTag = enum { A, B, C }; |
| ... | ... | @@ -289,7 +289,7 @@ test "cast union to tag type of union" { |
| 289 | 289 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 290 | 290 | |
| 291 | 291 | try testCastUnionToTag(); |
| 292 | comptime try testCastUnionToTag(); | |
| 292 | try comptime testCastUnionToTag(); | |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | fn testCastUnionToTag() !void { |
| ... | ... | @@ -372,14 +372,14 @@ const PackedPtrOrInt = packed union { |
| 372 | 372 | int: u64, |
| 373 | 373 | }; |
| 374 | 374 | test "packed union size" { |
| 375 | comptime try expect(@sizeOf(PackedPtrOrInt) == 8); | |
| 375 | try comptime expect(@sizeOf(PackedPtrOrInt) == 8); | |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | const ZeroBits = union { |
| 379 | 379 | OnlyField: void, |
| 380 | 380 | }; |
| 381 | 381 | test "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 | } |
| 384 | 384 | |
| 385 | 385 | test "tagged union initialization with runtime void" { |
| ... | ... | @@ -430,7 +430,7 @@ test "union with only 1 field casted to its enum type" { |
| 430 | 430 | |
| 431 | 431 | var e = Expr{ .Literal = Literal{ .Bool = true } }; |
| 432 | 432 | const ExprTag = Tag(Expr); |
| 433 | comptime try expect(Tag(ExprTag) == u0); | |
| 433 | try comptime expect(Tag(ExprTag) == u0); | |
| 434 | 434 | var t = @as(ExprTag, e); |
| 435 | 435 | try expect(t == Expr.Literal); |
| 436 | 436 | } |
| ... | ... | @@ -439,7 +439,7 @@ test "union with one member defaults to u0 tag type" { |
| 439 | 439 | const U0 = union(enum) { |
| 440 | 440 | X: u32, |
| 441 | 441 | }; |
| 442 | comptime try expect(Tag(Tag(U0)) == u0); | |
| 442 | try comptime expect(Tag(Tag(U0)) == u0); | |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | const Foo1 = union(enum) { |
| ... | ... | @@ -547,7 +547,7 @@ test "method call on an empty union" { |
| 547 | 547 | } |
| 548 | 548 | }; |
| 549 | 549 | try S.doTheTest(); |
| 550 | comptime try S.doTheTest(); | |
| 550 | try comptime S.doTheTest(); | |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | const Point = struct { |
| ... | ... | @@ -628,7 +628,7 @@ test "tagged union with all void fields but a meaningful tag" { |
| 628 | 628 | } |
| 629 | 629 | }; |
| 630 | 630 | try S.doTheTest(); |
| 631 | comptime try S.doTheTest(); | |
| 631 | try comptime S.doTheTest(); | |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | 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 | 637 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 638 | 638 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 639 | 639 | |
| 640 | comptime try expect(Tag(Tag(MultipleChoice2)) == u32); | |
| 640 | try comptime expect(Tag(Tag(MultipleChoice2)) == u32); | |
| 641 | 641 | try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2{ .C = 123 }); |
| 642 | comptime try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2{ .C = 123 }); | |
| 642 | try comptime testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2{ .C = 123 }); | |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | const 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 | 718 | }; |
| 719 | 719 | |
| 720 | 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 | 722 | comptime var t = @as(ExprTag, e); |
| 723 | 723 | try expect(t == Expr.Literal); |
| 724 | 724 | try expect(@enumToInt(t) == 33); |
| 725 | comptime try expect(@enumToInt(t) == 33); | |
| 725 | try comptime expect(@enumToInt(t) == 33); | |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | test "@enumToInt works on unions" { |
| ... | ... | @@ -805,7 +805,7 @@ test "return union init with void payload" { |
| 805 | 805 | } |
| 806 | 806 | }; |
| 807 | 807 | try S.entry(); |
| 808 | comptime try S.entry(); | |
| 808 | try comptime S.entry(); | |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | test "@unionInit stored to a const" { |
| ... | ... | @@ -833,7 +833,7 @@ test "@unionInit stored to a const" { |
| 833 | 833 | } |
| 834 | 834 | }; |
| 835 | 835 | |
| 836 | comptime try S.doTheTest(); | |
| 836 | try comptime S.doTheTest(); | |
| 837 | 837 | try S.doTheTest(); |
| 838 | 838 | } |
| 839 | 839 | |
| ... | ... | @@ -905,7 +905,7 @@ test "union with comptime_int tag" { |
| 905 | 905 | Y: u16, |
| 906 | 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 | } |
| 910 | 910 | |
| 911 | 911 | 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 | }; |
| 916 | 916 | |
| 917 | 917 | const x = U{ .x = 0x55AAAA55 }; |
| 918 | comptime try expect(x.y == 0x55); | |
| 918 | try comptime expect(x.y == 0x55); | |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | test "anonymous union literal syntax" { |
| ... | ... | @@ -942,7 +942,7 @@ test "anonymous union literal syntax" { |
| 942 | 942 | } |
| 943 | 943 | }; |
| 944 | 944 | try S.doTheTest(); |
| 945 | comptime try S.doTheTest(); | |
| 945 | try comptime S.doTheTest(); | |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | 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 | 977 | try S.doTheTest(); |
| 978 | comptime try S.doTheTest(); | |
| 978 | try comptime S.doTheTest(); | |
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | test "cast from anonymous struct to union" { |
| ... | ... | @@ -1007,7 +1007,7 @@ test "cast from anonymous struct to union" { |
| 1007 | 1007 | } |
| 1008 | 1008 | }; |
| 1009 | 1009 | try S.doTheTest(); |
| 1010 | comptime try S.doTheTest(); | |
| 1010 | try comptime S.doTheTest(); | |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | 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 | 1041 | try S.doTheTest(); |
| 1042 | comptime try S.doTheTest(); | |
| 1042 | try comptime S.doTheTest(); | |
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | test "switching on non exhaustive union" { |
| ... | ... | @@ -1067,7 +1067,7 @@ test "switching on non exhaustive union" { |
| 1067 | 1067 | } |
| 1068 | 1068 | }; |
| 1069 | 1069 | try S.doTheTest(); |
| 1070 | comptime try S.doTheTest(); | |
| 1070 | try comptime S.doTheTest(); | |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | test "containers with single-field enums" { |
| ... | ... | @@ -1096,7 +1096,7 @@ test "containers with single-field enums" { |
| 1096 | 1096 | }; |
| 1097 | 1097 | |
| 1098 | 1098 | try S.doTheTest(); |
| 1099 | comptime try S.doTheTest(); | |
| 1099 | try comptime S.doTheTest(); | |
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | test "@unionInit on union with tag but no fields" { |
| ... | ... | @@ -1130,7 +1130,7 @@ test "@unionInit on union with tag but no fields" { |
| 1130 | 1130 | }; |
| 1131 | 1131 | |
| 1132 | 1132 | try S.doTheTest(); |
| 1133 | comptime try S.doTheTest(); | |
| 1133 | try comptime S.doTheTest(); | |
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | 1136 | test "union enum type gets a separate scope" { |
| ... | ... | @@ -1552,7 +1552,7 @@ test "reinterpreting enum value inside packed union" { |
| 1552 | 1552 | } |
| 1553 | 1553 | }; |
| 1554 | 1554 | try U.doTest(); |
| 1555 | comptime try U.doTest(); | |
| 1555 | try comptime U.doTest(); | |
| 1556 | 1556 | } |
| 1557 | 1557 | |
| 1558 | 1558 | test "access the tag of a global tagged union" { |
| ... | ... | @@ -1581,5 +1581,5 @@ test "coerce enum literal to union in result loc" { |
| 1581 | 1581 | } |
| 1582 | 1582 | }; |
| 1583 | 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 | 32 | }; |
| 33 | 33 | |
| 34 | 34 | test "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 | } |
| 37 | 37 | |
| 38 | 38 | usingnamespace @import("usingnamespace/foo.zig"); |
test/behavior/vector.zig+34-34| ... | ... | @@ -21,7 +21,7 @@ test "implicit cast vector to array - bool" { |
| 21 | 21 | } |
| 22 | 22 | }; |
| 23 | 23 | try S.doTheTest(); |
| 24 | comptime try S.doTheTest(); | |
| 24 | try comptime S.doTheTest(); | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | test "vector wrap operators" { |
| ... | ... | @@ -45,7 +45,7 @@ test "vector wrap operators" { |
| 45 | 45 | } |
| 46 | 46 | }; |
| 47 | 47 | try S.doTheTest(); |
| 48 | comptime try S.doTheTest(); | |
| 48 | try comptime S.doTheTest(); | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | test "vector bin compares with mem.eql" { |
| ... | ... | @@ -69,7 +69,7 @@ test "vector bin compares with mem.eql" { |
| 69 | 69 | } |
| 70 | 70 | }; |
| 71 | 71 | try S.doTheTest(); |
| 72 | comptime try S.doTheTest(); | |
| 72 | try comptime S.doTheTest(); | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | test "vector int operators" { |
| ... | ... | @@ -91,7 +91,7 @@ test "vector int operators" { |
| 91 | 91 | } |
| 92 | 92 | }; |
| 93 | 93 | try S.doTheTest(); |
| 94 | comptime try S.doTheTest(); | |
| 94 | try comptime S.doTheTest(); | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | test "vector float operators" { |
| ... | ... | @@ -114,7 +114,7 @@ test "vector float operators" { |
| 114 | 114 | } |
| 115 | 115 | }; |
| 116 | 116 | try S.doTheTest(); |
| 117 | comptime try S.doTheTest(); | |
| 117 | try comptime S.doTheTest(); | |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| ... | ... | @@ -135,7 +135,7 @@ test "vector bit operators" { |
| 135 | 135 | } |
| 136 | 136 | }; |
| 137 | 137 | try S.doTheTest(); |
| 138 | comptime try S.doTheTest(); | |
| 138 | try comptime S.doTheTest(); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | test "implicit cast vector to array" { |
| ... | ... | @@ -153,7 +153,7 @@ test "implicit cast vector to array" { |
| 153 | 153 | } |
| 154 | 154 | }; |
| 155 | 155 | try S.doTheTest(); |
| 156 | comptime try S.doTheTest(); | |
| 156 | try comptime S.doTheTest(); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | test "array to vector" { |
| ... | ... | @@ -171,7 +171,7 @@ test "array to vector" { |
| 171 | 171 | } |
| 172 | 172 | }; |
| 173 | 173 | try S.doTheTest(); |
| 174 | comptime try S.doTheTest(); | |
| 174 | try comptime S.doTheTest(); | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | 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 | 194 | try S.doTheTest(); |
| 195 | comptime try S.doTheTest(); | |
| 195 | try comptime S.doTheTest(); | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | test "peer type resolution with coercible element types" { |
| ... | ... | @@ -212,7 +212,7 @@ test "peer type resolution with coercible element types" { |
| 212 | 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 | } |
| 217 | 217 | |
| 218 | 218 | test "tuple to vector" { |
| ... | ... | @@ -242,7 +242,7 @@ test "tuple to vector" { |
| 242 | 242 | } |
| 243 | 243 | }; |
| 244 | 244 | try S.doTheTest(); |
| 245 | comptime try S.doTheTest(); | |
| 245 | try comptime S.doTheTest(); | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | 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 | 280 | try S.doTheTest(); |
| 281 | comptime try S.doTheTest(); | |
| 281 | try comptime S.doTheTest(); | |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | test "vector @splat" { |
| ... | ... | @@ -326,7 +326,7 @@ test "vector @splat" { |
| 326 | 326 | } |
| 327 | 327 | }; |
| 328 | 328 | try S.doTheTest(); |
| 329 | comptime try S.doTheTest(); | |
| 329 | try comptime S.doTheTest(); | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | test "load vector elements via comptime index" { |
| ... | ... | @@ -348,7 +348,7 @@ test "load vector elements via comptime index" { |
| 348 | 348 | }; |
| 349 | 349 | |
| 350 | 350 | try S.doTheTest(); |
| 351 | comptime try S.doTheTest(); | |
| 351 | try comptime S.doTheTest(); | |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | test "store vector elements via comptime index" { |
| ... | ... | @@ -376,7 +376,7 @@ test "store vector elements via comptime index" { |
| 376 | 376 | }; |
| 377 | 377 | |
| 378 | 378 | try S.doTheTest(); |
| 379 | comptime try S.doTheTest(); | |
| 379 | try comptime S.doTheTest(); | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | test "load vector elements via runtime index" { |
| ... | ... | @@ -398,7 +398,7 @@ test "load vector elements via runtime index" { |
| 398 | 398 | }; |
| 399 | 399 | |
| 400 | 400 | try S.doTheTest(); |
| 401 | comptime try S.doTheTest(); | |
| 401 | try comptime S.doTheTest(); | |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | test "store vector elements via runtime index" { |
| ... | ... | @@ -421,7 +421,7 @@ test "store vector elements via runtime index" { |
| 421 | 421 | }; |
| 422 | 422 | |
| 423 | 423 | try S.doTheTest(); |
| 424 | comptime try S.doTheTest(); | |
| 424 | try comptime S.doTheTest(); | |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | 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 | 445 | try S.doTheTest(); |
| 446 | comptime try S.doTheTest(); | |
| 446 | try comptime S.doTheTest(); | |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | test "vector comparison operators" { |
| ... | ... | @@ -484,7 +484,7 @@ test "vector comparison operators" { |
| 484 | 484 | } |
| 485 | 485 | }; |
| 486 | 486 | try S.doTheTest(); |
| 487 | comptime try S.doTheTest(); | |
| 487 | try comptime S.doTheTest(); | |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | test "vector division operators" { |
| ... | ... | @@ -567,7 +567,7 @@ test "vector division operators" { |
| 567 | 567 | }; |
| 568 | 568 | |
| 569 | 569 | try S.doTheTest(); |
| 570 | comptime try S.doTheTest(); | |
| 570 | try comptime S.doTheTest(); | |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | test "vector bitwise not operator" { |
| ... | ... | @@ -599,7 +599,7 @@ test "vector bitwise not operator" { |
| 599 | 599 | }; |
| 600 | 600 | |
| 601 | 601 | try S.doTheTest(); |
| 602 | comptime try S.doTheTest(); | |
| 602 | try comptime S.doTheTest(); | |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | test "vector shift operators" { |
| ... | ... | @@ -693,7 +693,7 @@ test "vector shift operators" { |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | try S.doTheTest(); |
| 696 | comptime try S.doTheTest(); | |
| 696 | try comptime S.doTheTest(); | |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | test "vector reduce operation" { |
| ... | ... | @@ -837,7 +837,7 @@ test "vector reduce operation" { |
| 837 | 837 | }; |
| 838 | 838 | |
| 839 | 839 | try S.doTheTest(); |
| 840 | comptime try S.doTheTest(); | |
| 840 | try comptime S.doTheTest(); | |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | test "vector @reduce comptime" { |
| ... | ... | @@ -849,9 +849,9 @@ test "vector @reduce comptime" { |
| 849 | 849 | const value = @Vector(4, i32){ 1, -1, 1, -1 }; |
| 850 | 850 | const result = value > @splat(4, @as(i32, 0)); |
| 851 | 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 | 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 | 855 | try expect(is_all_true == false); |
| 856 | 856 | } |
| 857 | 857 | |
| ... | ... | @@ -903,7 +903,7 @@ test "saturating add" { |
| 903 | 903 | } |
| 904 | 904 | }; |
| 905 | 905 | try S.doTheTest(); |
| 906 | comptime try S.doTheTest(); | |
| 906 | try comptime S.doTheTest(); | |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | test "saturating subtraction" { |
| ... | ... | @@ -926,7 +926,7 @@ test "saturating subtraction" { |
| 926 | 926 | } |
| 927 | 927 | }; |
| 928 | 928 | try S.doTheTest(); |
| 929 | comptime try S.doTheTest(); | |
| 929 | try comptime S.doTheTest(); | |
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | test "saturating multiplication" { |
| ... | ... | @@ -953,7 +953,7 @@ test "saturating multiplication" { |
| 953 | 953 | }; |
| 954 | 954 | |
| 955 | 955 | try S.doTheTest(); |
| 956 | comptime try S.doTheTest(); | |
| 956 | try comptime S.doTheTest(); | |
| 957 | 957 | } |
| 958 | 958 | |
| 959 | 959 | test "saturating shift-left" { |
| ... | ... | @@ -976,7 +976,7 @@ test "saturating shift-left" { |
| 976 | 976 | } |
| 977 | 977 | }; |
| 978 | 978 | try S.doTheTest(); |
| 979 | comptime try S.doTheTest(); | |
| 979 | try comptime S.doTheTest(); | |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | 982 | 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 | 999 | try S.doTheTest(); |
| 1000 | comptime try S.doTheTest(); | |
| 1000 | try comptime S.doTheTest(); | |
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | test "@addWithOverflow" { |
| ... | ... | @@ -1041,7 +1041,7 @@ test "@addWithOverflow" { |
| 1041 | 1041 | } |
| 1042 | 1042 | }; |
| 1043 | 1043 | try S.doTheTest(); |
| 1044 | comptime try S.doTheTest(); | |
| 1044 | try comptime S.doTheTest(); | |
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | 1047 | test "@subWithOverflow" { |
| ... | ... | @@ -1071,7 +1071,7 @@ test "@subWithOverflow" { |
| 1071 | 1071 | } |
| 1072 | 1072 | }; |
| 1073 | 1073 | try S.doTheTest(); |
| 1074 | comptime try S.doTheTest(); | |
| 1074 | try comptime S.doTheTest(); | |
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | 1077 | test "@mulWithOverflow" { |
| ... | ... | @@ -1092,7 +1092,7 @@ test "@mulWithOverflow" { |
| 1092 | 1092 | } |
| 1093 | 1093 | }; |
| 1094 | 1094 | try S.doTheTest(); |
| 1095 | comptime try S.doTheTest(); | |
| 1095 | try comptime S.doTheTest(); | |
| 1096 | 1096 | } |
| 1097 | 1097 | |
| 1098 | 1098 | test "@shlWithOverflow" { |
| ... | ... | @@ -1113,7 +1113,7 @@ test "@shlWithOverflow" { |
| 1113 | 1113 | } |
| 1114 | 1114 | }; |
| 1115 | 1115 | try S.doTheTest(); |
| 1116 | comptime try S.doTheTest(); | |
| 1116 | try comptime S.doTheTest(); | |
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | 1119 | test "alignment of vectors" { |
test/behavior/while.zig+4-4| ... | ... | @@ -122,7 +122,7 @@ test "while copies its payload" { |
| 122 | 122 | } |
| 123 | 123 | }; |
| 124 | 124 | try S.doTheTest(); |
| 125 | comptime try S.doTheTest(); | |
| 125 | try comptime S.doTheTest(); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | test "continue and break" { |
| ... | ... | @@ -293,7 +293,7 @@ test "while bool 2 break statements and an else" { |
| 293 | 293 | } |
| 294 | 294 | }; |
| 295 | 295 | try S.entry(true, false); |
| 296 | comptime try S.entry(true, false); | |
| 296 | try comptime S.entry(true, false); | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | 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 | 314 | try S.entry(true, false); |
| 315 | comptime try S.entry(true, false); | |
| 315 | try comptime S.entry(true, false); | |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | 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 | 334 | try S.entry(true, false); |
| 335 | comptime try S.entry(true, false); | |
| 335 | try comptime S.entry(true, false); | |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | test "continue inline while loop" { |
test/behavior/wrapping_arithmetic.zig+15-15| ... | ... | @@ -31,12 +31,12 @@ test "wrapping add" { |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | 33 | try S.doTheTest(); |
| 34 | comptime try S.doTheTest(); | |
| 34 | try comptime S.doTheTest(); | |
| 35 | 35 | |
| 36 | comptime try S.testWrapAdd(comptime_int, 0, 0, 0); | |
| 37 | comptime try S.testWrapAdd(comptime_int, 3, 2, 5); | |
| 38 | comptime try S.testWrapAdd(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 1119305249183743626545271163355074748512); | |
| 39 | comptime try S.testWrapAdd(comptime_int, 7, -593423721213448152027139550640105366508, -593423721213448152027139550640105366501); | |
| 36 | try comptime S.testWrapAdd(comptime_int, 0, 0, 0); | |
| 37 | try comptime S.testWrapAdd(comptime_int, 3, 2, 5); | |
| 38 | try comptime S.testWrapAdd(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 1119305249183743626545271163355074748512); | |
| 39 | try comptime S.testWrapAdd(comptime_int, 7, -593423721213448152027139550640105366508, -593423721213448152027139550640105366501); | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | test "wrapping subtraction" { |
| ... | ... | @@ -64,12 +64,12 @@ test "wrapping subtraction" { |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | 66 | try S.doTheTest(); |
| 67 | comptime try S.doTheTest(); | |
| 67 | try comptime S.doTheTest(); | |
| 68 | 68 | |
| 69 | comptime try S.testWrapSub(comptime_int, 0, 0, 0); | |
| 70 | comptime try S.testWrapSub(comptime_int, 3, 2, 1); | |
| 71 | comptime try S.testWrapSub(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 182846383813587550256162760261375991602); | |
| 72 | comptime try S.testWrapSub(comptime_int, 7, -593423721213448152027139550640105366508, 593423721213448152027139550640105366515); | |
| 69 | try comptime S.testWrapSub(comptime_int, 0, 0, 0); | |
| 70 | try comptime S.testWrapSub(comptime_int, 3, 2, 1); | |
| 71 | try comptime S.testWrapSub(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 182846383813587550256162760261375991602); | |
| 72 | try comptime S.testWrapSub(comptime_int, 7, -593423721213448152027139550640105366508, 593423721213448152027139550640105366515); | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | test "wrapping multiplication" { |
| ... | ... | @@ -101,10 +101,10 @@ test "wrapping multiplication" { |
| 101 | 101 | }; |
| 102 | 102 | |
| 103 | 103 | try S.doTheTest(); |
| 104 | comptime try S.doTheTest(); | |
| 104 | try comptime S.doTheTest(); | |
| 105 | 105 | |
| 106 | comptime try S.testWrapMul(comptime_int, 0, 0, 0); | |
| 107 | comptime try S.testWrapMul(comptime_int, 3, 2, 6); | |
| 108 | comptime try S.testWrapMul(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 304852860194144160265083087140337419215516305999637969803722975979232817921935); | |
| 109 | comptime try S.testWrapMul(comptime_int, 7, -593423721213448152027139550640105366508, -4153966048494137064189976854480737565556); | |
| 106 | try comptime S.testWrapMul(comptime_int, 0, 0, 0); | |
| 107 | try comptime S.testWrapMul(comptime_int, 3, 2, 6); | |
| 108 | try comptime S.testWrapMul(comptime_int, 651075816498665588400716961808225370057, 468229432685078038144554201546849378455, 304852860194144160265083087140337419215516305999637969803722975979232817921935); | |
| 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 | 2 | const y = -%x; |
| 3 | 3 | return -y; |
| 4 | 4 | } |
| 5 | const V = @import("std").meta.Vector; | |
| 6 | export fn f2(x: V(4, u32)) V(4, u32) { | |
| 5 | export fn f2(x: @Vector(4, u32)) @Vector(4, u32) { | |
| 7 | 6 | const y = -%x; |
| 8 | 7 | return -y; |
| 9 | 8 | } |
| ... | ... | @@ -13,4 +12,4 @@ export fn f2(x: V(4, u32)) V(4, u32) { |
| 13 | 12 | // target=native |
| 14 | 13 | // |
| 15 | 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 | 1 | comptime { |
| 2 | var a: @import("std").meta.Vector(4, u8) = [_]u8{ 1, 2, 255, 4 }; | |
| 3 | var b: @import("std").meta.Vector(4, u8) = [_]u8{ 5, 6, 1, 8 }; | |
| 2 | var a: @Vector(4, u8) = [_]u8{ 1, 2, 255, 4 }; | |
| 3 | var b: @Vector(4, u8) = [_]u8{ 5, 6, 1, 8 }; | |
| 4 | 4 | var x = a + b; |
| 5 | 5 | _ = x; |
| 6 | 6 | } |
test/cases/compile_errors/nested_vectors.zig+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | export fn entry() void { |
| 2 | const V1 = @import("std").meta.Vector(4, u8); | |
| 2 | const V1 = @Vector(4, u8); | |
| 3 | 3 | const V2 = @Type(.{ .Vector = .{ .len = 4, .child = V1 } }); |
| 4 | 4 | var v: V2 = undefined; |
| 5 | 5 | _ = v; |
test/cases/compile_errors/shuffle_with_selected_index_past_first_vector_length.zig+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | export fn entry() void { |
| 2 | const v: @import("std").meta.Vector(4, u32) = [4]u32{ 10, 11, 12, 13 }; | |
| 3 | const x: @import("std").meta.Vector(4, u32) = [4]u32{ 14, 15, 16, 17 }; | |
| 2 | const v: @Vector(4, u32) = [4]u32{ 10, 11, 12, 13 }; | |
| 3 | const x: @Vector(4, u32) = [4]u32{ 14, 15, 16, 17 }; | |
| 4 | 4 | var z = @shuffle(u32, v, x, [8]i32{ 0, 1, 2, 3, 7, 6, 5, 4 }); |
| 5 | 5 | _ = z; |
| 6 | 6 | } |
test/cases/compile_errors/vector_index_out_of_bounds.zig+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | export 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 | 3 | _ = x; |
| 4 | 4 | } |
| 5 | 5 | |
| ... | ... | @@ -7,4 +7,4 @@ export fn entry() void { |
| 7 | 7 | // backend=stage2 |
| 8 | 8 | // target=native |
| 9 | 9 | // |
| 10 | // :2:49: error: expected 3 vector elements; found 4 | |
| 10 | // :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 | 3 | const testing = std.testing; |
| 4 | 4 | |
| 5 | 5 | test "c import" { |
| 6 | comptime try testing.expect(c.NUMBER == 1234); | |
| 6 | try comptime testing.expect(c.NUMBER == 1234); | |
| 7 | 7 | } |