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.
This commit is contained in:
mlugg
2024-08-28 02:35:53 +01:00
parent 1a178d4995
commit 0fe3fd01dd
336 changed files with 4105 additions and 4112 deletions

View File

@@ -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" {