| author | |
| committer | |
| log | 213c4fc25f214a0d8763bd7976db9ae3eec0f232 |
| tree | 5ceaf1f1947006bac5ab6c43edd9f876c4ff8127 |
| parent | d764716cb5cdcf3dec07d66ce87be915327f564e |
| signature |
In preparation for its removal, as accepted in
https://github.com/ziglang/zig/issues/1593.22 files changed, 29 insertions(+), 128 deletions(-)
lib/std/Io/Reader.zig-5| ... | ... | @@ -2097,7 +2097,6 @@ test "deserialize signed LEB128" { |
| 2097 | 2097 | try testing.expectEqual(std.math.minInt(i128), testLeb128(i128, "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x7E")); |
| 2098 | 2098 | |
| 2099 | 2099 | // Specific cases |
| 2100 | try testing.expectEqual(0, testLeb128(i0, "\x00")); | |
| 2101 | 2100 | try testing.expectEqual(0, testLeb128(i2, "\x00")); |
| 2102 | 2101 | try testing.expectEqual(0, testLeb128(i8, "\x00")); |
| 2103 | 2102 | |
| ... | ... | @@ -2134,8 +2133,6 @@ test "deserialize signed LEB128" { |
| 2134 | 2133 | try testing.expectError(error.EndOfStream, testLeb128(i128, &end_of_stream)); |
| 2135 | 2134 | |
| 2136 | 2135 | // Overflow |
| 2137 | try testing.expectError(error.Overflow, testLeb128(i0, "\x01")); | |
| 2138 | try testing.expectError(error.Overflow, testLeb128(i0, "\x7F")); | |
| 2139 | 2136 | try testing.expectError(error.Overflow, testLeb128(i8, "\x80\x01")); |
| 2140 | 2137 | try testing.expectError(error.Overflow, testLeb128(i8, "\xFF\x7E")); |
| 2141 | 2138 | try testing.expectError(error.Overflow, testLeb128(i8, "\x80\x80\x40")); |
| ... | ... | @@ -2145,7 +2142,6 @@ test "deserialize signed LEB128" { |
| 2145 | 2142 | try testing.expectError(error.Overflow, testLeb128(i64, "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01")); |
| 2146 | 2143 | try testing.expectError(error.Overflow, testLeb128(i64, "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x40")); |
| 2147 | 2144 | |
| 2148 | try testing.expectError(error.Overflow, testLeb128(i0, &overflow)); | |
| 2149 | 2145 | try testing.expectError(error.Overflow, testLeb128(i7, &overflow)); |
| 2150 | 2146 | try testing.expectError(error.Overflow, testLeb128(i8, &overflow)); |
| 2151 | 2147 | try testing.expectError(error.Overflow, testLeb128(i14, &overflow)); |
| ... | ... | @@ -2159,7 +2155,6 @@ test "deserialize signed LEB128" { |
| 2159 | 2155 | try testing.expectEqual(0x80, testLeb128(i64, "\x80\x81\x00")); |
| 2160 | 2156 | try testing.expectEqual(0x80, testLeb128(i64, "\x80\x81\x80\x00")); |
| 2161 | 2157 | |
| 2162 | try testing.expectEqual(0, testLeb128(i0, &long_zero)); | |
| 2163 | 2158 | try testing.expectEqual(0, testLeb128(i7, &long_zero)); |
| 2164 | 2159 | try testing.expectEqual(0, testLeb128(i8, &long_zero)); |
| 2165 | 2160 | try testing.expectEqual(0, testLeb128(i14, &long_zero)); |
lib/std/Io/Writer.zig-1| ... | ... | @@ -1924,7 +1924,6 @@ test "serialize signed LEB128" { |
| 1924 | 1924 | try testLeb128Encoding(i128, std.math.minInt(i128), "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x7E"); |
| 1925 | 1925 | |
| 1926 | 1926 | // Specific cases |
| 1927 | try testLeb128Encoding(i0, 0, "\x00"); | |
| 1928 | 1927 | try testLeb128Encoding(i8, 0, "\x00"); |
| 1929 | 1928 | |
| 1930 | 1929 | try testLeb128Encoding(i2, -1, "\x7F"); |
lib/std/json/static_test.zig-7| ... | ... | @@ -22,7 +22,6 @@ const Primitives = struct { |
| 22 | 22 | f32: f32, |
| 23 | 23 | f64: f64, |
| 24 | 24 | u0: u0, |
| 25 | i0: i0, | |
| 26 | 25 | u1: u1, |
| 27 | 26 | i1: i1, |
| 28 | 27 | u8: u8, |
| ... | ... | @@ -35,7 +34,6 @@ const primitives_0 = Primitives{ |
| 35 | 34 | .f32 = 0, |
| 36 | 35 | .f64 = 0, |
| 37 | 36 | .u0 = 0, |
| 38 | .i0 = 0, | |
| 39 | 37 | .u1 = 0, |
| 40 | 38 | .i1 = 0, |
| 41 | 39 | .u8 = 0, |
| ... | ... | @@ -48,7 +46,6 @@ const primitives_0_doc_0 = |
| 48 | 46 | \\ "f32": 0, |
| 49 | 47 | \\ "f64": 0, |
| 50 | 48 | \\ "u0": 0, |
| 51 | \\ "i0": 0, | |
| 52 | 49 | \\ "u1": 0, |
| 53 | 50 | \\ "i1": 0, |
| 54 | 51 | \\ "u8": 0, |
| ... | ... | @@ -62,7 +59,6 @@ const primitives_0_doc_1 = // looks like a float. |
| 62 | 59 | \\ "f32": 0.0, |
| 63 | 60 | \\ "f64": 0.0, |
| 64 | 61 | \\ "u0": 0.0, |
| 65 | \\ "i0": 0.0, | |
| 66 | 62 | \\ "u1": 0.0, |
| 67 | 63 | \\ "i1": 0.0, |
| 68 | 64 | \\ "u8": 0.0, |
| ... | ... | @@ -76,7 +72,6 @@ const primitives_1 = Primitives{ |
| 76 | 72 | .f32 = 1073741824, |
| 77 | 73 | .f64 = 1152921504606846976, |
| 78 | 74 | .u0 = 0, |
| 79 | .i0 = 0, | |
| 80 | 75 | .u1 = 1, |
| 81 | 76 | .i1 = -1, |
| 82 | 77 | .u8 = 255, |
| ... | ... | @@ -89,7 +84,6 @@ const primitives_1_doc_0 = |
| 89 | 84 | \\ "f32": 1073741824, |
| 90 | 85 | \\ "f64": 1152921504606846976, |
| 91 | 86 | \\ "u0": 0, |
| 92 | \\ "i0": 0, | |
| 93 | 87 | \\ "u1": 1, |
| 94 | 88 | \\ "i1": -1, |
| 95 | 89 | \\ "u8": 255, |
| ... | ... | @@ -103,7 +97,6 @@ const primitives_1_doc_1 = // float rounding. |
| 103 | 97 | \\ "f32": 1073741825, |
| 104 | 98 | \\ "f64": 1152921504606846977, |
| 105 | 99 | \\ "u0": 0, |
| 106 | \\ "i0": 0, | |
| 107 | 100 | \\ "u1": 1, |
| 108 | 101 | \\ "i1": -1, |
| 109 | 102 | \\ "u8": 255, |
lib/std/math.zig+12-18| ... | ... | @@ -1141,13 +1141,11 @@ test isPowerOfTwo { |
| 1141 | 1141 | pub fn ByteAlignedInt(comptime T: type) type { |
| 1142 | 1142 | const info = @typeInfo(T).int; |
| 1143 | 1143 | const bits = (info.bits + 7) / 8 * 8; |
| 1144 | const extended_type = std.meta.Int(info.signedness, bits); | |
| 1145 | return extended_type; | |
| 1144 | return @Int(info.signedness, bits); | |
| 1146 | 1145 | } |
| 1147 | 1146 | |
| 1148 | 1147 | test ByteAlignedInt { |
| 1149 | 1148 | try testing.expect(ByteAlignedInt(u0) == u0); |
| 1150 | try testing.expect(ByteAlignedInt(i0) == i0); | |
| 1151 | 1149 | try testing.expect(ByteAlignedInt(u3) == u8); |
| 1152 | 1150 | try testing.expect(ByteAlignedInt(u8) == u8); |
| 1153 | 1151 | try testing.expect(ByteAlignedInt(i111) == i112); |
| ... | ... | @@ -1218,7 +1216,7 @@ pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(@typeInfo( |
| 1218 | 1216 | comptime assert(@typeInfo(T) == .int); |
| 1219 | 1217 | comptime assert(@typeInfo(T).int.signedness == .unsigned); |
| 1220 | 1218 | assert(value != 0); |
| 1221 | const PromotedType = std.meta.Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1); | |
| 1219 | const PromotedType = @Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1); | |
| 1222 | 1220 | const ShiftType = std.math.Log2Int(PromotedType); |
| 1223 | 1221 | return @as(PromotedType, 1) << @as(ShiftType, @intCast(@typeInfo(T).int.bits - @clz(value - 1))); |
| 1224 | 1222 | } |
| ... | ... | @@ -1230,7 +1228,7 @@ pub fn ceilPowerOfTwo(comptime T: type, value: T) (error{Overflow}!T) { |
| 1230 | 1228 | comptime assert(@typeInfo(T) == .int); |
| 1231 | 1229 | const info = @typeInfo(T).int; |
| 1232 | 1230 | comptime assert(info.signedness == .unsigned); |
| 1233 | const PromotedType = std.meta.Int(info.signedness, info.bits + 1); | |
| 1231 | const PromotedType = @Int(info.signedness, info.bits + 1); | |
| 1234 | 1232 | const overflowBit = @as(PromotedType, 1) << info.bits; |
| 1235 | 1233 | const x = ceilPowerOfTwoPromote(T, value); |
| 1236 | 1234 | if (overflowBit & x != 0) { |
| ... | ... | @@ -1442,19 +1440,17 @@ test lerp { |
| 1442 | 1440 | |
| 1443 | 1441 | /// Returns the maximum value of integer type T. |
| 1444 | 1442 | pub fn maxInt(comptime T: type) comptime_int { |
| 1445 | const info = @typeInfo(T); | |
| 1446 | const bit_count = info.int.bits; | |
| 1447 | if (bit_count == 0) return 0; | |
| 1448 | return (1 << (bit_count - @intFromBool(info.int.signedness == .signed))) - 1; | |
| 1443 | const info = @typeInfo(T).int; | |
| 1444 | return (1 << (info.bits - @intFromBool(info.signedness == .signed))) - 1; | |
| 1449 | 1445 | } |
| 1450 | 1446 | |
| 1451 | 1447 | /// Returns the minimum value of integer type T. |
| 1452 | 1448 | pub fn minInt(comptime T: type) comptime_int { |
| 1453 | const info = @typeInfo(T); | |
| 1454 | const bit_count = info.int.bits; | |
| 1455 | if (info.int.signedness == .unsigned) return 0; | |
| 1456 | if (bit_count == 0) return 0; | |
| 1457 | return -(1 << (bit_count - 1)); | |
| 1449 | const info = @typeInfo(T).int; | |
| 1450 | return switch (info.signedness) { | |
| 1451 | .unsigned => 0, | |
| 1452 | .signed => -(1 << (info.bits - 1)), | |
| 1453 | }; | |
| 1458 | 1454 | } |
| 1459 | 1455 | |
| 1460 | 1456 | test maxInt { |
| ... | ... | @@ -1466,7 +1462,6 @@ test maxInt { |
| 1466 | 1462 | try testing.expect(maxInt(u64) == 18446744073709551615); |
| 1467 | 1463 | try testing.expect(maxInt(u128) == 340282366920938463463374607431768211455); |
| 1468 | 1464 | |
| 1469 | try testing.expect(maxInt(i0) == 0); | |
| 1470 | 1465 | try testing.expect(maxInt(i1) == 0); |
| 1471 | 1466 | try testing.expect(maxInt(i8) == 127); |
| 1472 | 1467 | try testing.expect(maxInt(i16) == 32767); |
| ... | ... | @@ -1486,7 +1481,6 @@ test minInt { |
| 1486 | 1481 | try testing.expect(minInt(u64) == 0); |
| 1487 | 1482 | try testing.expect(minInt(u128) == 0); |
| 1488 | 1483 | |
| 1489 | try testing.expect(minInt(i0) == 0); | |
| 1490 | 1484 | try testing.expect(minInt(i1) == -1); |
| 1491 | 1485 | try testing.expect(minInt(i8) == -128); |
| 1492 | 1486 | try testing.expect(minInt(i16) == -32768); |
| ... | ... | @@ -1710,8 +1704,8 @@ pub inline fn boolMask(comptime MaskInt: type, value: bool) MaskInt { |
| 1710 | 1704 | if (@typeInfo(MaskInt) != .int) |
| 1711 | 1705 | @compileError("boolMask requires an integer mask type."); |
| 1712 | 1706 | |
| 1713 | if (MaskInt == u0 or MaskInt == i0) | |
| 1714 | @compileError("boolMask cannot convert to u0 or i0, they are too small."); | |
| 1707 | if (MaskInt == u0) | |
| 1708 | @compileError("boolMask cannot convert to u0, it is too small."); | |
| 1715 | 1709 | |
| 1716 | 1710 | // The u1 and i1 cases tend to overflow, |
| 1717 | 1711 | // so we special case them here. |
lib/std/math/big/int_test.zig-3| ... | ... | @@ -602,7 +602,6 @@ test "bitcount/to" { |
| 602 | 602 | try testing.expectEqual(0, a.bitCountTwosComp()); |
| 603 | 603 | |
| 604 | 604 | try testing.expectEqual(0, try a.toInt(u0)); |
| 605 | try testing.expectEqual(0, try a.toInt(i0)); | |
| 606 | 605 | |
| 607 | 606 | try a.set(-1); |
| 608 | 607 | try testing.expectEqual(1, a.bitCountTwosComp()); |
| ... | ... | @@ -631,7 +630,6 @@ test "fits" { |
| 631 | 630 | |
| 632 | 631 | try a.set(0); |
| 633 | 632 | try testing.expect(a.fits(u0)); |
| 634 | try testing.expect(a.fits(i0)); | |
| 635 | 633 | |
| 636 | 634 | try a.set(255); |
| 637 | 635 | try testing.expect(!a.fits(u0)); |
| ... | ... | @@ -711,7 +709,6 @@ test "twos complement limit set" { |
| 711 | 709 | try testTwosComplementLimit(u1); |
| 712 | 710 | try testTwosComplementLimit(i1); |
| 713 | 711 | try testTwosComplementLimit(u0); |
| 714 | try testTwosComplementLimit(i0); | |
| 715 | 712 | try testTwosComplementLimit(u65); |
| 716 | 713 | try testTwosComplementLimit(i65); |
| 717 | 714 | } |
lib/std/math/nextafter.zig+1-2| ... | ... | @@ -23,7 +23,7 @@ pub fn nextAfter(comptime T: type, x: T, y: T) T { |
| 23 | 23 | fn nextAfterInt(comptime T: type, x: T, y: T) T { |
| 24 | 24 | comptime assert(@typeInfo(T) == .int or @typeInfo(T) == .comptime_int); |
| 25 | 25 | return if (@typeInfo(T) == .int and @bitSizeOf(T) < 2) |
| 26 | // Special case for `i0`, `u0`, `i1`, and `u1`. | |
| 26 | // Special case for `u0`, `i1`, and `u1`. | |
| 27 | 27 | y |
| 28 | 28 | else if (y > x) |
| 29 | 29 | x + 1 |
| ... | ... | @@ -102,7 +102,6 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T { |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | test "int" { |
| 105 | try expect(nextAfter(i0, 0, 0) == 0); | |
| 106 | 105 | try expect(nextAfter(u0, 0, 0) == 0); |
| 107 | 106 | try expect(nextAfter(i1, 0, 0) == 0); |
| 108 | 107 | try expect(nextAfter(i1, 0, -1) == -1); |
lib/std/math/powi.zig+2-3| ... | ... | @@ -15,12 +15,12 @@ const testing = std.testing; |
| 15 | 15 | /// - Underflow: Absolute value of result smaller than 1 |
| 16 | 16 | /// |
| 17 | 17 | /// Edge case rules ordered by precedence: |
| 18 | /// - powi(T, x, 0) = 1 unless T is i1, i0, u0 | |
| 18 | /// - powi(T, x, 0) = 1 unless T is i1, u0 | |
| 19 | 19 | /// - powi(T, 0, x) = 0 when x > 0 |
| 20 | 20 | /// - powi(T, 0, x) = Overflow |
| 21 | 21 | /// - powi(T, 1, y) = 1 |
| 22 | 22 | /// - powi(T, -1, y) = -1 for y an odd integer |
| 23 | /// - powi(T, -1, y) = 1 unless T is i1, i0, u0 | |
| 23 | /// - powi(T, -1, y) = 1 unless T is i1, u0 | |
| 24 | 24 | /// - powi(T, -1, y) = Overflow |
| 25 | 25 | /// - powi(T, x, y) = Overflow when y >= @bitSizeOf(x) |
| 26 | 26 | /// - powi(T, x, y) = Underflow when y < 0 |
| ... | ... | @@ -189,7 +189,6 @@ test "powi.special" { |
| 189 | 189 | |
| 190 | 190 | test "powi.narrow" { |
| 191 | 191 | try testing.expectError(error.Overflow, powi(u0, 0, 0)); |
| 192 | try testing.expectError(error.Overflow, powi(i0, 0, 0)); | |
| 193 | 192 | try testing.expectError(error.Overflow, powi(i1, 0, 0)); |
| 194 | 193 | try testing.expectError(error.Overflow, powi(i1, -1, 0)); |
| 195 | 194 | try testing.expectError(error.Overflow, powi(i1, 0, -1)); |
lib/std/math/signbit.zig-1| ... | ... | @@ -13,7 +13,6 @@ pub fn signbit(x: anytype) bool { |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | test signbit { |
| 16 | try testInts(i0); | |
| 17 | 16 | try testInts(u0); |
| 18 | 17 | try testInts(i1); |
| 19 | 18 | try testInts(u1); |
lib/std/mem.zig-2| ... | ... | @@ -370,7 +370,6 @@ test zeroes { |
| 370 | 370 | comptime comptime_field: u8 = 5, |
| 371 | 371 | |
| 372 | 372 | integral_types: struct { |
| 373 | integer_0: i0, | |
| 374 | 373 | integer_8: i8, |
| 375 | 374 | integer_16: i16, |
| 376 | 375 | integer_32: i32, |
| ... | ... | @@ -405,7 +404,6 @@ test zeroes { |
| 405 | 404 | |
| 406 | 405 | const b = zeroes(ZigStruct); |
| 407 | 406 | try testing.expectEqual(@as(u8, 5), b.comptime_field); |
| 408 | try testing.expectEqual(@as(i8, 0), b.integral_types.integer_0); | |
| 409 | 407 | try testing.expectEqual(@as(i8, 0), b.integral_types.integer_8); |
| 410 | 408 | try testing.expectEqual(@as(i16, 0), b.integral_types.integer_16); |
| 411 | 409 | try testing.expectEqual(@as(i32, 0), b.integral_types.integer_32); |
lib/std/meta.zig+1-1| ... | ... | @@ -1067,7 +1067,7 @@ test hasUniqueRepresentation { |
| 1067 | 1067 | |
| 1068 | 1068 | try testing.expect(!hasUniqueRepresentation(TestUnion4)); |
| 1069 | 1069 | |
| 1070 | inline for ([_]type{ i0, u8, i16, u32, i64 }) |T| { | |
| 1070 | inline for ([_]type{ u8, i16, u32, i64 }) |T| { | |
| 1071 | 1071 | try testing.expect(hasUniqueRepresentation(T)); |
| 1072 | 1072 | try testing.expect(hasUniqueRepresentation(enum(T) { _ })); |
| 1073 | 1073 | } |
test/behavior/atomics.zig-1| ... | ... | @@ -369,7 +369,6 @@ test "atomics with different types" { |
| 369 | 369 | try testAtomicsWithType(u24, 2, 1); |
| 370 | 370 | |
| 371 | 371 | try testAtomicsWithType(u0, 0, 0); |
| 372 | try testAtomicsWithType(i0, 0, 0); | |
| 373 | 372 | |
| 374 | 373 | try testAtomicsWithType(enum(u32) { x = 1234, y = 5678 }, .x, .y); |
| 375 | 374 | try testAtomicsWithType(enum(u19) { x = 1234, y = 5678 }, .x, .y); |
test/behavior/cast.zig-3| ... | ... | @@ -3079,8 +3079,6 @@ test "@intFromFloat boundary cases" { |
| 3079 | 3079 | |
| 3080 | 3080 | try case(u0, 1.0, .down, 0); |
| 3081 | 3081 | try case(u0, -1.0, .up, 0); |
| 3082 | try case(i0, 1.0, .down, 0); | |
| 3083 | try case(i0, -1.0, .up, 0); | |
| 3084 | 3082 | |
| 3085 | 3083 | try case(u10, 1024.0, .down, 1023); |
| 3086 | 3084 | try case(u10, -1.0, .up, 0); |
| ... | ... | @@ -3111,7 +3109,6 @@ test "@intFromFloat vector boundary cases" { |
| 3111 | 3109 | try case(i8, .{ -129.0, 128.0 }, .{ -128, 127 }); |
| 3112 | 3110 | |
| 3113 | 3111 | try case(u0, .{ -1.0, 1.0 }, .{ 0, 0 }); |
| 3114 | try case(i0, .{ -1.0, 1.0 }, .{ 0, 0 }); | |
| 3115 | 3112 | |
| 3116 | 3113 | try case(u10, .{ -1.0, 1024.0 }, .{ 0, 1023 }); |
| 3117 | 3114 | try case(i10, .{ -513.0, 512.0 }, .{ -512, 511 }); |
test/behavior/field_parent_ptr.zig+5-5| ... | ... | @@ -1903,7 +1903,7 @@ test "@fieldParentPtr tagged union all zero-bit fields" { |
| 1903 | 1903 | |
| 1904 | 1904 | const C = union(enum) { |
| 1905 | 1905 | a: u0, |
| 1906 | b: i0, | |
| 1906 | b: void, | |
| 1907 | 1907 | }; |
| 1908 | 1908 | |
| 1909 | 1909 | { |
| ... | ... | @@ -1938,20 +1938,20 @@ test "@fieldParentPtr tagged union all zero-bit fields" { |
| 1938 | 1938 | } |
| 1939 | 1939 | |
| 1940 | 1940 | { |
| 1941 | const c: C = .{ .b = 0 }; | |
| 1941 | const c: C = .{ .b = {} }; | |
| 1942 | 1942 | const pcf = &c.b; |
| 1943 | 1943 | const pc: *const C = @alignCast(@fieldParentPtr("b", pcf)); |
| 1944 | 1944 | try expect(pc == &c); |
| 1945 | 1945 | } |
| 1946 | 1946 | { |
| 1947 | const c: C = .{ .b = 0 }; | |
| 1947 | const c: C = .{ .b = {} }; | |
| 1948 | 1948 | const pcf = &c.b; |
| 1949 | 1949 | var pc: *const C = undefined; |
| 1950 | 1950 | pc = @alignCast(@fieldParentPtr("b", pcf)); |
| 1951 | 1951 | try expect(pc == &c); |
| 1952 | 1952 | } |
| 1953 | 1953 | { |
| 1954 | const c: C = .{ .b = 0 }; | |
| 1954 | const c: C = .{ .b = {} }; | |
| 1955 | 1955 | var pcf: @TypeOf(&c.b) = undefined; |
| 1956 | 1956 | pcf = &c.b; |
| 1957 | 1957 | var pc: *const C = undefined; |
| ... | ... | @@ -1960,7 +1960,7 @@ test "@fieldParentPtr tagged union all zero-bit fields" { |
| 1960 | 1960 | } |
| 1961 | 1961 | { |
| 1962 | 1962 | var c: C = undefined; |
| 1963 | c = .{ .b = 0 }; | |
| 1963 | c = .{ .b = {} }; | |
| 1964 | 1964 | var pcf: @TypeOf(&c.b) = undefined; |
| 1965 | 1965 | pcf = &c.b; |
| 1966 | 1966 | var pc: *C = undefined; |
test/behavior/int_comparison_elision.zig-1| ... | ... | @@ -7,7 +7,6 @@ test "int comparison elision" { |
| 7 | 7 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 8 | 8 | |
| 9 | 9 | testIntEdges(u0); |
| 10 | testIntEdges(i0); | |
| 11 | 10 | testIntEdges(u1); |
| 12 | 11 | testIntEdges(i1); |
| 13 | 12 | testIntEdges(u4); |
test/behavior/math.zig-1| ... | ... | @@ -401,7 +401,6 @@ test "binary not" { |
| 401 | 401 | try expect(not(u64, 0x0123_4567_89AB_CDEF) == 0xFEDC_BA98_7654_3210); |
| 402 | 402 | try expect(not(u64, 0xFEDC_BA98_7654_3210) == 0x0123_4567_89AB_CDEF); |
| 403 | 403 | |
| 404 | try expect(not(i0, 0) == 0); | |
| 405 | 404 | try expect(not(i1, 0) == -1); |
| 406 | 405 | try expect(not(i1, -1) == 0); |
| 407 | 406 | try expect(not(i5, -2) == 1); |
test/behavior/switch_loop.zig+2-2| ... | ... | @@ -547,12 +547,12 @@ test "switch loop with packed unions" { |
| 547 | 547 | test "switch loop with packed unions with OPV" { |
| 548 | 548 | const P = packed union { |
| 549 | 549 | a: u0, |
| 550 | b: i0, | |
| 550 | b: void, | |
| 551 | 551 | |
| 552 | 552 | fn doTheTest(p: @This()) !void { |
| 553 | 553 | var looped = false; |
| 554 | 554 | s: switch (p) { |
| 555 | .{ .b = 0 } => |x| { | |
| 555 | .{ .b = {} } => |x| { | |
| 556 | 556 | comptime assert(x.a == 0); |
| 557 | 557 | if (looped) break :s; |
| 558 | 558 | looped = true; |
test/behavior/truncate.zig-25| ... | ... | @@ -31,31 +31,6 @@ test "truncate.u0.var" { |
| 31 | 31 | try expect(z == 0); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | test "truncate i0 to larger integer allowed and has comptime-known result" { | |
| 35 | var x: i0 = 0; | |
| 36 | _ = &x; | |
| 37 | const y: i8 = @truncate(x); | |
| 38 | comptime assert(y == 0); | |
| 39 | } | |
| 40 | ||
| 41 | test "truncate.i0.literal" { | |
| 42 | const z: i0 = @truncate(0); | |
| 43 | try expect(z == 0); | |
| 44 | } | |
| 45 | ||
| 46 | test "truncate.i0.const" { | |
| 47 | const c0: isize = 0; | |
| 48 | const z: i0 = @truncate(c0); | |
| 49 | try expect(z == 0); | |
| 50 | } | |
| 51 | ||
| 52 | test "truncate.i0.var" { | |
| 53 | var d: i8 = 2; | |
| 54 | _ = &d; | |
| 55 | const z: i0 = @truncate(d); | |
| 56 | try expect(z == 0); | |
| 57 | } | |
| 58 | ||
| 59 | 34 | test "truncate on comptime integer" { |
| 60 | 35 | const x: u16 = @truncate(9999); |
| 61 | 36 | try expect(x == 9999); |
test/cases/compile_errors/leading_zero_in_integer.zig+5-6| ... | ... | @@ -3,7 +3,6 @@ export fn entry1() void { |
| 3 | 3 | _ = T; |
| 4 | 4 | } |
| 5 | 5 | export fn entry2() void { |
| 6 | _ = i0; | |
| 7 | 6 | _ = u0; |
| 8 | 7 | var x: i01 = 1; |
| 9 | 8 | _ = x; |
| ... | ... | @@ -18,8 +17,8 @@ export fn entry4() void { |
| 18 | 17 | // error |
| 19 | 18 | // |
| 20 | 19 | // :2:15: error: primitive integer type 'u000123' has leading zero |
| 21 | // :8:12: error: primitive integer type 'i01' has leading zero | |
| 22 | // :12:9: error: number '000123' has leading zero | |
| 23 | // :12:9: note: use '0o' prefix for octal literals | |
| 24 | // :15:9: error: number '01' has leading zero | |
| 25 | // :15:9: note: use '0o' prefix for octal literals | |
| 20 | // :7:12: error: primitive integer type 'i01' has leading zero | |
| 21 | // :11:9: error: number '000123' has leading zero | |
| 22 | // :11:9: note: use '0o' prefix for octal literals | |
| 23 | // :14:9: error: number '01' has leading zero | |
| 24 | // :14:9: note: use '0o' prefix for octal literals |
test/cases/compile_errors/zero_width_nonexhaustive_enum.zig+1-7| ... | ... | @@ -1,8 +1,3 @@ |
| 1 | comptime { | |
| 2 | const E = enum(i0) { a, _ }; | |
| 3 | _ = @as(E, undefined); | |
| 4 | } | |
| 5 | ||
| 6 | 1 | comptime { |
| 7 | 2 | const E = enum(u0) { a, _ }; |
| 8 | 3 | _ = @as(E, undefined); |
| ... | ... | @@ -16,5 +11,4 @@ comptime { |
| 16 | 11 | // error |
| 17 | 12 | // |
| 18 | 13 | // :2:15: error: non-exhaustive enum specifies every value |
| 19 | // :7:15: error: non-exhaustive enum specifies every value | |
| 20 | // :12:29: error: enum tag value '1' too large for type 'u0' | |
| 14 | // :7:29: error: enum tag value '1' too large for type 'u0' |
test/cases/safety/@intFromFloat cannot fit - boundary case - i0 max.zig	 deleted-16| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | |
| 3 | _ = stack_trace; | |
| 4 | if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) { | |
| 5 | std.process.exit(0); | |
| 6 | } | |
| 7 | std.process.exit(1); | |
| 8 | } | |
| 9 | var x: f32 = 1.0; | |
| 10 | pub fn main() !void { | |
| 11 | _ = @as(i0, @intFromFloat(x)); | |
| 12 | return error.TestFailed; | |
| 13 | } | |
| 14 | // run | |
| 15 | // backend=selfhosted,llvm | |
| 16 | // target=x86_64-linux,aarch64-linux |
test/cases/safety/@intFromFloat cannot fit - boundary case - i0 min.zig	 deleted-16| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | |
| 3 | _ = stack_trace; | |
| 4 | if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) { | |
| 5 | std.process.exit(0); | |
| 6 | } | |
| 7 | std.process.exit(1); | |
| 8 | } | |
| 9 | var x: f32 = -1.0; | |
| 10 | pub fn main() !void { | |
| 11 | _ = @as(i0, @intFromFloat(x)); | |
| 12 | return error.TestFailed; | |
| 13 | } | |
| 14 | // run | |
| 15 | // backend=selfhosted,llvm | |
| 16 | // target=x86_64-linux,aarch64-linux |
test/src/Debugger.zig-2| ... | ... | @@ -56,7 +56,6 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void { |
| 56 | 56 | \\ u24_16777215: u24 = 16777215, |
| 57 | 57 | \\ u32_0: u32 = 0, |
| 58 | 58 | \\ u32_4294967295: u32 = 4294967295, |
| 59 | \\ i0_0: i0 = 0, | |
| 60 | 59 | \\ @"i1_-1": i1 = -1, |
| 61 | 60 | \\ i1_0: i1 = 0, |
| 62 | 61 | \\ @"i2_-2": i2 = -2, |
| ... | ... | @@ -139,7 +138,6 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void { |
| 139 | 138 | \\ (u24) .u24_16777215 = 16777215 |
| 140 | 139 | \\ (u32) .u32_0 = 0 |
| 141 | 140 | \\ (u32) .u32_4294967295 = 4294967295 |
| 142 | \\ (i0) .i0_0 = 0 | |
| 143 | 141 | \\ (i1) .@"i1_-1" = -1 |
| 144 | 142 | \\ (i1) .i1_0 = 0 |
| 145 | 143 | \\ (i2) .@"i2_-2" = -2 |