aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/pointers.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-08-28 02:35:53 +0100
committermlugg <mlugg@mlugg.co.uk>2024-08-28 08:39:59 +0100
commit0fe3fd01ddc2cd49c6a2b939577d16b9d2c65ea9 (patch)
tree2c07fddf2b6230360fe618c4de192bc2d24eeaf7 /test/behavior/pointers.zig
parent1a178d499537b922ff05c5d0186ed5a00dbb1a9b (diff)
downloadzig-0fe3fd01ddc2cd49c6a2b939577d16b9d2c65ea9.tar.gz
zig-0fe3fd01ddc2cd49c6a2b939577d16b9d2c65ea9.zip
std: update `std.builtin.Type` fields to follow naming conventions
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
Diffstat (limited to 'test/behavior/pointers.zig')
-rw-r--r--test/behavior/pointers.zig36
1 files changed, 18 insertions, 18 deletions
diff --git a/test/behavior/pointers.zig b/test/behavior/pointers.zig
index f8260d1f0d..07041e70a1 100644
--- a/test/behavior/pointers.zig
+++ b/test/behavior/pointers.zig
@@ -266,8 +266,8 @@ test "allowzero pointer and slice" {
comptime assert(@TypeOf(slice) == []allowzero i32);
try expect(@intFromPtr(&slice[5]) == 20);
- comptime assert(@typeInfo(@TypeOf(ptr)).Pointer.is_allowzero);
- comptime assert(@typeInfo(@TypeOf(slice)).Pointer.is_allowzero);
+ comptime assert(@typeInfo(@TypeOf(ptr)).pointer.is_allowzero);
+ comptime assert(@typeInfo(@TypeOf(slice)).pointer.is_allowzero);
}
test "assign null directly to C pointer and test null equality" {
@@ -441,15 +441,15 @@ test "pointer-integer arithmetic affects the alignment" {
var x: usize = 1;
_ = .{ &ptr, &x };
- try expect(@typeInfo(@TypeOf(ptr)).Pointer.alignment == 8);
+ try expect(@typeInfo(@TypeOf(ptr)).pointer.alignment == 8);
const ptr1 = ptr + 1; // 1 * 4 = 4 -> lcd(4,8) = 4
- try expect(@typeInfo(@TypeOf(ptr1)).Pointer.alignment == 4);
+ try expect(@typeInfo(@TypeOf(ptr1)).pointer.alignment == 4);
const ptr2 = ptr + 4; // 4 * 4 = 16 -> lcd(16,8) = 8
- try expect(@typeInfo(@TypeOf(ptr2)).Pointer.alignment == 8);
+ try expect(@typeInfo(@TypeOf(ptr2)).pointer.alignment == 8);
const ptr3 = ptr + 0; // no-op
- try expect(@typeInfo(@TypeOf(ptr3)).Pointer.alignment == 8);
+ try expect(@typeInfo(@TypeOf(ptr3)).pointer.alignment == 8);
const ptr4 = ptr + x; // runtime-known addend
- try expect(@typeInfo(@TypeOf(ptr4)).Pointer.alignment == 4);
+ try expect(@typeInfo(@TypeOf(ptr4)).pointer.alignment == 4);
}
{
var ptr: [*]align(8) [3]u8 = undefined;
@@ -457,13 +457,13 @@ test "pointer-integer arithmetic affects the alignment" {
_ = .{ &ptr, &x };
const ptr1 = ptr + 17; // 3 * 17 = 51
- try expect(@typeInfo(@TypeOf(ptr1)).Pointer.alignment == 1);
+ try expect(@typeInfo(@TypeOf(ptr1)).pointer.alignment == 1);
const ptr2 = ptr + x; // runtime-known addend
- try expect(@typeInfo(@TypeOf(ptr2)).Pointer.alignment == 1);
+ try expect(@typeInfo(@TypeOf(ptr2)).pointer.alignment == 1);
const ptr3 = ptr + 8; // 3 * 8 = 24 -> lcd(8,24) = 8
- try expect(@typeInfo(@TypeOf(ptr3)).Pointer.alignment == 8);
+ try expect(@typeInfo(@TypeOf(ptr3)).pointer.alignment == 8);
const ptr4 = ptr + 4; // 3 * 4 = 12 -> lcd(8,12) = 4
- try expect(@typeInfo(@TypeOf(ptr4)).Pointer.alignment == 4);
+ try expect(@typeInfo(@TypeOf(ptr4)).pointer.alignment == 4);
}
}
@@ -560,7 +560,7 @@ test "pointer to constant decl preserves alignment" {
const aligned align(8) = @This(){ .a = 3, .b = 4 };
};
- const alignment = @typeInfo(@TypeOf(&S.aligned)).Pointer.alignment;
+ const alignment = @typeInfo(@TypeOf(&S.aligned)).pointer.alignment;
try std.testing.expect(alignment == 8);
}
@@ -641,24 +641,24 @@ const Box2 = struct {
fn mutable() !void {
var box0: Box0 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).Pointer.is_const == false);
+ try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).pointer.is_const == false);
var box1: Box1 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).Pointer.is_const == false);
+ try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).pointer.is_const == false);
var box2: Box2 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).Pointer.is_const == false);
+ try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).pointer.is_const == false);
}
fn constant() !void {
const box0: Box0 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).Pointer.is_const == true);
+ try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).pointer.is_const == true);
const box1: Box1 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).Pointer.is_const == true);
+ try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).pointer.is_const == true);
const box2: Box2 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).Pointer.is_const == true);
+ try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).pointer.is_const == true);
}
test "pointer-to-array constness for zero-size elements, var" {