aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/langref.html.in4
-rw-r--r--lib/std/array_hash_map.zig8
-rw-r--r--lib/std/builtin.zig11
-rw-r--r--lib/std/crypto/phc_encoding.zig8
-rw-r--r--lib/std/enums.zig2
-rw-r--r--lib/std/fmt.zig2
-rw-r--r--lib/std/hash/auto_hash.zig6
-rw-r--r--lib/std/hash_map.zig20
-rw-r--r--lib/std/io/multi_writer.zig2
-rw-r--r--lib/std/json.zig26
-rw-r--r--lib/std/mem.zig8
-rw-r--r--lib/std/meta.zig36
-rw-r--r--lib/std/meta/trailer_flags.zig20
-rw-r--r--lib/std/meta/trait.zig4
-rw-r--r--lib/std/multi_array_list.zig26
-rw-r--r--lib/std/os/uefi/protocols/device_path_protocol.zig4
-rw-r--r--lib/std/start.zig2
-rw-r--r--lib/std/testing.zig2
-rw-r--r--lib/std/x/os/socket.zig8
-rw-r--r--lib/std/zig/Ast.zig2
-rw-r--r--lib/std/zig/c_translation.zig2
-rw-r--r--lib/std/zig/parse.zig2
-rw-r--r--src/Air.zig2
-rw-r--r--src/AstGen.zig2
-rw-r--r--src/Autodoc.zig4
-rw-r--r--src/InternPool.zig4
-rw-r--r--src/Liveness.zig2
-rw-r--r--src/Sema.zig50
-rw-r--r--src/Zir.zig2
-rw-r--r--src/arch/aarch64/CodeGen.zig2
-rw-r--r--src/arch/aarch64/Mir.zig2
-rw-r--r--src/arch/arm/CodeGen.zig2
-rw-r--r--src/arch/arm/Mir.zig2
-rw-r--r--src/arch/riscv64/CodeGen.zig2
-rw-r--r--src/arch/riscv64/Mir.zig2
-rw-r--r--src/arch/sparc64/Mir.zig2
-rw-r--r--src/arch/wasm/CodeGen.zig2
-rw-r--r--src/arch/wasm/Mir.zig2
-rw-r--r--src/arch/x86_64/CodeGen.zig2
-rw-r--r--src/arch/x86_64/Mir.zig2
-rw-r--r--src/codegen/spirv/Section.zig14
-rw-r--r--src/link/tapi/yaml.zig10
-rw-r--r--src/print_zir.zig8
-rw-r--r--src/translate_c/ast.zig4
-rw-r--r--src/type.zig2
-rw-r--r--src/value.zig2
-rw-r--r--stage1/zig1.wasmbin2314930 -> 2327578 bytes
-rw-r--r--test/behavior/bitcast.zig2
-rw-r--r--test/behavior/bugs/12786.zig2
-rw-r--r--test/behavior/bugs/12794.zig2
-rw-r--r--test/behavior/bugs/12885.zig6
-rw-r--r--test/behavior/bugs/13435.zig2
-rw-r--r--test/behavior/bugs/6456.zig2
-rw-r--r--test/behavior/generics.zig1
-rw-r--r--test/behavior/reflection.zig8
-rw-r--r--test/behavior/tuple.zig6
-rw-r--r--test/behavior/tuple_declarations.zig10
-rw-r--r--test/behavior/type.zig48
-rw-r--r--test/behavior/type_info.zig43
-rw-r--r--test/behavior/union.zig2
-rw-r--r--test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig2
-rw-r--r--test/cases/compile_errors/dereference_anyopaque.zig2
-rw-r--r--test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig2
-rw-r--r--test/cases/compile_errors/reified_enum_field_value_overflow.zig1
-rw-r--r--test/cases/compile_errors/reify_enum_with_duplicate_field.zig1
-rw-r--r--test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig1
-rw-r--r--test/cases/compile_errors/reify_struct.zig10
-rw-r--r--test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig2
-rw-r--r--test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig2
-rw-r--r--test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig2
-rw-r--r--test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig1
-rw-r--r--test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig1
-rw-r--r--test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig7
-rw-r--r--test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig9
-rw-r--r--test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig4
-rw-r--r--test/cases/fn_typeinfo_passed_to_comptime_fn.zig2
76 files changed, 236 insertions, 280 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in
index 9f70e85f81..08fa59746d 100644
--- a/doc/langref.html.in
+++ b/doc/langref.html.in
@@ -4253,7 +4253,7 @@ fn isFieldOptional(comptime T: type, field_index: usize) !bool {
return switch (field_index) {
// This prong is analyzed `fields.len - 1` times with `idx` being an
// unique comptime-known value each time.
- inline 0...fields.len - 1 => |idx| @typeInfo(fields[idx].field_type) == .Optional,
+ inline 0...fields.len - 1 => |idx| @typeInfo(fields[idx].type) == .Optional,
else => return error.IndexOutOfBounds,
};
}
@@ -5242,7 +5242,7 @@ const math = std.math;
const testing = std.testing;
test "fn reflection" {
- try testing.expect(@typeInfo(@TypeOf(testing.expect)).Fn.args[0].arg_type.? == bool);
+ try testing.expect(@typeInfo(@TypeOf(testing.expect)).Fn.params[0].type.? == bool);
try testing.expect(@typeInfo(@TypeOf(testing.tmpDir)).Fn.return_type.? == testing.TmpDir);
try testing.expect(@typeInfo(@TypeOf(math.Log2Int)).Fn.is_generic);
diff --git a/lib/std/array_hash_map.zig b/lib/std/array_hash_map.zig
index 1d6d86f8f5..cf04a54116 100644
--- a/lib/std/array_hash_map.zig
+++ b/lib/std/array_hash_map.zig
@@ -2270,13 +2270,13 @@ test "reIndex" {
test "auto store_hash" {
const HasCheapEql = AutoArrayHashMap(i32, i32);
const HasExpensiveEql = AutoArrayHashMap([32]i32, i32);
- try testing.expect(meta.fieldInfo(HasCheapEql.Data, .hash).field_type == void);
- try testing.expect(meta.fieldInfo(HasExpensiveEql.Data, .hash).field_type != void);
+ try testing.expect(meta.fieldInfo(HasCheapEql.Data, .hash).type == void);
+ try testing.expect(meta.fieldInfo(HasExpensiveEql.Data, .hash).type != void);
const HasCheapEqlUn = AutoArrayHashMapUnmanaged(i32, i32);
const HasExpensiveEqlUn = AutoArrayHashMapUnmanaged([32]i32, i32);
- try testing.expect(meta.fieldInfo(HasCheapEqlUn.Data, .hash).field_type == void);
- try testing.expect(meta.fieldInfo(HasExpensiveEqlUn.Data, .hash).field_type != void);
+ try testing.expect(meta.fieldInfo(HasCheapEqlUn.Data, .hash).type == void);
+ try testing.expect(meta.fieldInfo(HasExpensiveEqlUn.Data, .hash).type != void);
}
test "sort" {
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index 2d56b477f9..a0b3011d5c 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -280,8 +280,7 @@ pub const Type = union(enum) {
/// therefore must be kept in sync with the compiler implementation.
pub const StructField = struct {
name: []const u8,
- /// TODO rename to `type`
- field_type: type,
+ type: type,
default_value: ?*const anyopaque,
is_comptime: bool,
alignment: comptime_int,
@@ -331,8 +330,6 @@ pub const Type = union(enum) {
/// This data structure is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.
pub const Enum = struct {
- /// TODO enums should no longer have this field in type info.
- layout: ContainerLayout,
tag_type: type,
fields: []const EnumField,
decls: []const Declaration,
@@ -343,7 +340,7 @@ pub const Type = union(enum) {
/// therefore must be kept in sync with the compiler implementation.
pub const UnionField = struct {
name: []const u8,
- field_type: type,
+ type: type,
alignment: comptime_int,
};
@@ -367,14 +364,14 @@ pub const Type = union(enum) {
is_var_args: bool,
/// TODO change the language spec to make this not optional.
return_type: ?type,
- args: []const Param,
+ params: []const Param,
/// This data structure is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.
pub const Param = struct {
is_generic: bool,
is_noalias: bool,
- arg_type: ?type,
+ type: ?type,
};
};
diff --git a/lib/std/crypto/phc_encoding.zig b/lib/std/crypto/phc_encoding.zig
index bba03a3fff..4b6965d040 100644
--- a/lib/std/crypto/phc_encoding.zig
+++ b/lib/std/crypto/phc_encoding.zig
@@ -110,9 +110,9 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
var found = false;
inline for (comptime meta.fields(HashResult)) |p| {
if (mem.eql(u8, p.name, param.key)) {
- switch (@typeInfo(p.field_type)) {
+ switch (@typeInfo(p.type)) {
.Int => @field(out, p.name) = fmt.parseUnsigned(
- p.field_type,
+ p.type,
param.value,
10,
) catch return Error.InvalidEncoding,
@@ -161,7 +161,7 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
// with default values
var expected_fields: usize = 0;
inline for (comptime meta.fields(HashResult)) |p| {
- if (@typeInfo(p.field_type) != .Optional and p.default_value == null) {
+ if (@typeInfo(p.type) != .Optional and p.default_value == null) {
expected_fields += 1;
}
}
@@ -223,7 +223,7 @@ fn serializeTo(params: anytype, out: anytype) !void {
{
const value = @field(params, p.name);
try out.writeAll(if (has_params) params_delimiter else fields_delimiter);
- if (@typeInfo(p.field_type) == .Struct) {
+ if (@typeInfo(p.type) == .Struct) {
var buf: [@TypeOf(value).max_encoded_length]u8 = undefined;
try out.print("{s}{s}{s}", .{ p.name, kv_delimiter, try value.toB64(&buf) });
} else {
diff --git a/lib/std/enums.zig b/lib/std/enums.zig
index 0fdbf03162..2640e6aac9 100644
--- a/lib/std/enums.zig
+++ b/lib/std/enums.zig
@@ -15,7 +15,7 @@ pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_def
for (std.meta.fields(E)) |field| {
fields = fields ++ &[_]StructField{.{
.name = field.name,
- .field_type = Data,
+ .type = Data,
.default_value = if (field_default) |d| @ptrCast(?*const anyopaque, &d) else null,
.is_comptime = false,
.alignment = if (@sizeOf(Data) > 0) @alignOf(Data) else 0,
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig
index 8c65ab6fd2..57771d8e51 100644
--- a/lib/std/fmt.zig
+++ b/lib/std/fmt.zig
@@ -1724,7 +1724,7 @@ pub const ParseIntError = error{
/// ) !void;
///
pub fn Formatter(comptime format_fn: anytype) type {
- const Data = @typeInfo(@TypeOf(format_fn)).Fn.args[0].arg_type.?;
+ const Data = @typeInfo(@TypeOf(format_fn)).Fn.params[0].type.?;
return struct {
data: Data,
pub fn format(
diff --git a/lib/std/hash/auto_hash.zig b/lib/std/hash/auto_hash.zig
index aac4b0feaf..d4640262f2 100644
--- a/lib/std/hash/auto_hash.zig
+++ b/lib/std/hash/auto_hash.zig
@@ -134,7 +134,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
hash(hasher, tag, strat);
inline for (info.fields) |field| {
if (@field(tag_type, field.name) == tag) {
- if (field.field_type != void) {
+ if (field.type != void) {
hash(hasher, @field(key, field.name), strat);
}
// TODO use a labelled break when it does not crash the compiler. cf #2908
@@ -163,14 +163,14 @@ fn typeContainsSlice(comptime K: type) bool {
}
if (meta.trait.is(.Struct)(K)) {
inline for (@typeInfo(K).Struct.fields) |field| {
- if (typeContainsSlice(field.field_type)) {
+ if (typeContainsSlice(field.type)) {
return true;
}
}
}
if (meta.trait.is(.Union)(K)) {
inline for (@typeInfo(K).Union.fields) |field| {
- if (typeContainsSlice(field.field_type)) {
+ if (typeContainsSlice(field.type)) {
return true;
}
}
diff --git a/lib/std/hash_map.zig b/lib/std/hash_map.zig
index 7f9783f91d..05205e6f07 100644
--- a/lib/std/hash_map.zig
+++ b/lib/std/hash_map.zig
@@ -186,11 +186,11 @@ pub fn verifyContext(
const info = @typeInfo(@TypeOf(hash));
if (info == .Fn) {
const func = info.Fn;
- if (func.args.len != 2) {
+ if (func.params.len != 2) {
errors = errors ++ lazy.err_invalid_hash_signature;
} else {
var emitted_signature = false;
- if (func.args[0].arg_type) |Self| {
+ if (func.params[0].type) |Self| {
if (Self == Context) {
// pass, this is always fine.
} else if (Self == *const Context) {
@@ -231,12 +231,12 @@ pub fn verifyContext(
errors = errors ++ ", but is " ++ @typeName(Self);
}
}
- if (func.args[1].arg_type != null and func.args[1].arg_type.? != PseudoKey) {
+ if (func.params[1].type != null and func.params[1].type.? != PseudoKey) {
if (!emitted_signature) {
errors = errors ++ lazy.err_invalid_hash_signature;
emitted_signature = true;
}
- errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.args[1].arg_type.?);
+ errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.params[1].type.?);
}
if (func.return_type != null and func.return_type.? != Hash) {
if (!emitted_signature) {
@@ -263,11 +263,11 @@ pub fn verifyContext(
if (info == .Fn) {
const func = info.Fn;
const args_len = if (is_array) 4 else 3;
- if (func.args.len != args_len) {
+ if (func.params.len != args_len) {
errors = errors ++ lazy.err_invalid_eql_signature;
} else {
var emitted_signature = false;
- if (func.args[0].arg_type) |Self| {
+ if (func.params[0].type) |Self| {
if (Self == Context) {
// pass, this is always fine.
} else if (Self == *const Context) {
@@ -308,19 +308,19 @@ pub fn verifyContext(
errors = errors ++ ", but is " ++ @typeName(Self);
}
}
- if (func.args[1].arg_type.? != PseudoKey) {
+ if (func.params[1].type.? != PseudoKey) {
if (!emitted_signature) {
errors = errors ++ lazy.err_invalid_eql_signature;
emitted_signature = true;
}
- errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.args[1].arg_type.?);
+ errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.params[1].type.?);
}
- if (func.args[2].arg_type.? != Key) {
+ if (func.params[2].type.? != Key) {
if (!emitted_signature) {
errors = errors ++ lazy.err_invalid_eql_signature;
emitted_signature = true;
}
- errors = errors ++ lazy.deep_prefix ++ "Third parameter must be " ++ @typeName(Key) ++ ", but is " ++ @typeName(func.args[2].arg_type.?);
+ errors = errors ++ lazy.deep_prefix ++ "Third parameter must be " ++ @typeName(Key) ++ ", but is " ++ @typeName(func.params[2].type.?);
}
if (func.return_type.? != bool) {
if (!emitted_signature) {
diff --git a/lib/std/io/multi_writer.zig b/lib/std/io/multi_writer.zig
index ae683848d0..b3f64f1553 100644
--- a/lib/std/io/multi_writer.zig
+++ b/lib/std/io/multi_writer.zig
@@ -6,7 +6,7 @@ const testing = std.testing;
pub fn MultiWriter(comptime Writers: type) type {
comptime var ErrSet = error{};
inline for (@typeInfo(Writers).Struct.fields) |field| {
- const StreamType = field.field_type;
+ const StreamType = field.type;
ErrSet = ErrSet || StreamType.Error;
}
diff --git a/lib/std/json.zig b/lib/std/json.zig
index 17fc13b0dc..f16d70da80 100644
--- a/lib/std/json.zig
+++ b/lib/std/json.zig
@@ -1362,7 +1362,7 @@ fn ParseInternalErrorImpl(comptime T: type, comptime inferred_types: []const typ
if (unionInfo.tag_type) |_| {
var errors = error{NoUnionMembersMatched};
for (unionInfo.fields) |u_field| {
- errors = errors || ParseInternalErrorImpl(u_field.field_type, inferred_types ++ [_]type{T});
+ errors = errors || ParseInternalErrorImpl(u_field.type, inferred_types ++ [_]type{T});
}
return errors;
} else {
@@ -1379,7 +1379,7 @@ fn ParseInternalErrorImpl(comptime T: type, comptime inferred_types: []const typ
MissingField,
} || SkipValueError || TokenStream.Error;
for (structInfo.fields) |field| {
- errors = errors || ParseInternalErrorImpl(field.field_type, inferred_types ++ [_]type{T});
+ errors = errors || ParseInternalErrorImpl(field.type, inferred_types ++ [_]type{T});
}
return errors;
},
@@ -1491,7 +1491,7 @@ fn parseInternal(
inline for (unionInfo.fields) |u_field| {
// take a copy of tokens so we can withhold mutations until success
var tokens_copy = tokens.*;
- if (parseInternal(u_field.field_type, token, &tokens_copy, options)) |value| {
+ if (parseInternal(u_field.type, token, &tokens_copy, options)) |value| {
tokens.* = tokens_copy;
return @unionInit(T, u_field.name, value);
} else |err| {
@@ -1519,7 +1519,7 @@ fn parseInternal(
errdefer {
inline for (structInfo.fields) |field, i| {
if (fields_seen[i] and !field.is_comptime) {
- parseFree(field.field_type, @field(r, field.name), options);
+ parseFree(field.type, @field(r, field.name), options);
}
}
}
@@ -1547,24 +1547,24 @@ fn parseInternal(
// }
if (options.duplicate_field_behavior == .UseFirst) {
// unconditonally ignore value. for comptime fields, this skips check against default_value
- parseFree(field.field_type, try parse(field.field_type, tokens, child_options), child_options);
+ parseFree(field.type, try parse(field.type, tokens, child_options), child_options);
found = true;
break;
} else if (options.duplicate_field_behavior == .Error) {
return error.DuplicateJSONField;
} else if (options.duplicate_field_behavior == .UseLast) {
if (!field.is_comptime) {
- parseFree(field.field_type, @field(r, field.name), child_options);
+ parseFree(field.type, @field(r, field.name), child_options);
}
fields_seen[i] = false;
}
}
if (field.is_comptime) {
- if (!try parsesTo(field.field_type, @ptrCast(*align(1) const field.field_type, field.default_value.?).*, tokens, child_options)) {
+ if (!try parsesTo(field.type, @ptrCast(*align(1) const field.type, field.default_value.?).*, tokens, child_options)) {
return error.UnexpectedValue;
}
} else {
- @field(r, field.name) = try parse(field.field_type, tokens, child_options);
+ @field(r, field.name) = try parse(field.type, tokens, child_options);
}
fields_seen[i] = true;
found = true;
@@ -1587,7 +1587,7 @@ fn parseInternal(
if (!fields_seen[i]) {
if (field.default_value) |default_ptr| {
if (!field.is_comptime) {
- const default = @ptrCast(*align(1) const field.field_type, default_ptr).*;
+ const default = @ptrCast(*align(1) const field.type, default_ptr).*;
@field(r, field.name) = default;
}
} else {
@@ -1732,7 +1732,7 @@ pub fn parseFree(comptime T: type, value: T, options: ParseOptions) void {
if (unionInfo.tag_type) |UnionTagType| {
inline for (unionInfo.fields) |u_field| {
if (value == @field(UnionTagType, u_field.name)) {
- parseFree(u_field.field_type, @field(value, u_field.name), options);
+ parseFree(u_field.type, @field(value, u_field.name), options);
break;
}
}
@@ -1743,7 +1743,7 @@ pub fn parseFree(comptime T: type, value: T, options: ParseOptions) void {
.Struct => |structInfo| {
inline for (structInfo.fields) |field| {
if (!field.is_comptime) {
- parseFree(field.field_type, @field(value, field.name), options);
+ parseFree(field.type, @field(value, field.name), options);
}
}
},
@@ -2270,12 +2270,12 @@ pub fn stringify(
}
inline for (S.fields) |Field| {
// don't include void fields
- if (Field.field_type == void) continue;
+ if (Field.type == void) continue;
var emit_field = true;
// don't include optional fields that are null when emit_null_optional_fields is set to false
- if (@typeInfo(Field.field_type) == .Optional) {
+ if (@typeInfo(Field.type) == .Optional) {
if (options.emit_null_optional_fields == false) {
if (@field(value, Field.name) == null) {
emit_field = false;
diff --git a/lib/std/mem.zig b/lib/std/mem.zig
index a6b7490dab..17281390a8 100644
--- a/lib/std/mem.zig
+++ b/lib/std/mem.zig
@@ -300,7 +300,7 @@ pub fn zeroes(comptime T: type) T {
if (comptime meta.containerLayout(T) == .Extern) {
// The C language specification states that (global) unions
// should be zero initialized to the first named member.
- return @unionInit(T, info.fields[0].name, zeroes(info.fields[0].field_type));
+ return @unionInit(T, info.fields[0].name, zeroes(info.fields[0].type));
}
@compileError("Can't set a " ++ @typeName(T) ++ " to zero.");
@@ -435,7 +435,7 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
inline for (struct_info.fields) |field| {
if (field.default_value) |default_value_ptr| {
- const default_value = @ptrCast(*align(1) const field.field_type, default_value_ptr).*;
+ const default_value = @ptrCast(*align(1) const field.type, default_value_ptr).*;
@field(value, field.name) = default_value;
}
}
@@ -452,9 +452,9 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
@compileError("Encountered an initializer for `" ++ field.name ++ "`, but it is not a field of " ++ @typeName(T));
}
- switch (@typeInfo(field.field_type)) {
+ switch (@typeInfo(field.type)) {
.Struct => {
- @field(value, field.name) = zeroInit(field.field_type, @field(init, field.name));
+ @field(value, field.name) = zeroInit(field.type, @field(init, field.name));
},
else => {
@field(value, field.name) = @field(init, field.name);
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index 71e37ad8a6..39d561469f 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -371,16 +371,12 @@ test "std.meta.assumeSentinel" {
pub fn containerLayout(comptime T: type) Type.ContainerLayout {
return switch (@typeInfo(T)) {
.Struct => |info| info.layout,
- .Enum => |info| info.layout,
.Union => |info| info.layout,
- else => @compileError("Expected struct, enum or union type, found '" ++ @typeName(T) ++ "'"),
+ else => @compileError("expected struct or union type, found '" ++ @typeName(T) ++ "'"),
};
}
test "std.meta.containerLayout" {
- const E1 = enum {
- A,
- };
const S1 = struct {};
const S2 = packed struct {};
const S3 = extern struct {};
@@ -394,7 +390,6 @@ test "std.meta.containerLayout" {
a: u8,
};
- try testing.expect(containerLayout(E1) == .Auto);
try testing.expect(containerLayout(S1) == .Auto);
try testing.expect(containerLayout(S2) == .Packed);
try testing.expect(containerLayout(S3) == .Extern);
@@ -522,8 +517,8 @@ test "std.meta.fields" {
try testing.expect(mem.eql(u8, e2f[0].name, "A"));
try testing.expect(mem.eql(u8, sf[0].name, "a"));
try testing.expect(mem.eql(u8, uf[0].name, "a"));
- try testing.expect(comptime sf[0].field_type == u8);
- try testing.expect(comptime uf[0].field_type == u8);
+ try testing.expect(comptime sf[0].type == u8);
+ try testing.expect(comptime uf[0].type == u8);
}
pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeInfo(T)) {
@@ -557,8 +552,8 @@ test "std.meta.fieldInfo" {
try testing.expect(mem.eql(u8, e2f.name, "A"));
try testing.expect(mem.eql(u8, sf.name, "a"));
try testing.expect(mem.eql(u8, uf.name, "a"));
- try testing.expect(comptime sf.field_type == u8);
- try testing.expect(comptime uf.field_type == u8);
+ try testing.expect(comptime sf.type == u8);
+ try testing.expect(comptime uf.type == u8);
}
pub fn fieldNames(comptime T: type) *const [fields(T).len][]const u8 {
@@ -634,7 +629,6 @@ pub fn FieldEnum(comptime T: type) type {
if (field_infos.len == 0) {
return @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = u0,
.fields = &.{},
.decls = &.{},
@@ -664,7 +658,6 @@ pub fn FieldEnum(comptime T: type) type {
}
return @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = std.math.IntFittingRange(0, field_infos.len - 1),
.fields = &enumFields,
.decls = &decls,
@@ -677,10 +670,6 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {
// TODO: https://github.com/ziglang/zig/issues/7419
// testing.expectEqual(@typeInfo(expected).Enum, @typeInfo(actual).Enum);
try testing.expectEqual(
- @typeInfo(expected).Enum.layout,
- @typeInfo(actual).Enum.layout,
- );
- try testing.expectEqual(
@typeInfo(expected).Enum.tag_type,
@typeInfo(actual).Enum.tag_type,
);
@@ -740,7 +729,6 @@ pub fn DeclEnum(comptime T: type) type {
}
return @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = std.math.IntFittingRange(0, fieldInfos.len - 1),
.fields = &enumDecls,
.decls = &decls,
@@ -831,7 +819,7 @@ pub fn TagPayload(comptime U: type, comptime tag: Tag(U)) type {
inline for (info.fields) |field_info| {
if (comptime mem.eql(u8, field_info.name, @tagName(tag)))
- return field_info.field_type;
+ return field_info.type;
}
unreachable;
@@ -1084,9 +1072,9 @@ pub fn ArgsTuple(comptime Function: type) type {
if (function_info.is_var_args)
@compileError("Cannot create ArgsTuple for variadic function");
- var argument_field_list: [function_info.args.len]type = undefined;
- inline for (function_info.args) |arg, i| {
- const T = arg.arg_type.?;
+ var argument_field_list: [function_info.params.len]type = undefined;
+ inline for (function_info.params) |arg, i| {
+ const T = arg.type.?;
argument_field_list[i] = T;
}
@@ -1111,7 +1099,7 @@ fn CreateUniqueTuple(comptime N: comptime_int, comptime types: [N]type) type {
var num_buf: [128]u8 = undefined;
tuple_fields[i] = .{
.name = std.fmt.bufPrint(&num_buf, "{d}", .{i}) catch unreachable,
- .field_type = T,
+ .type = T,
.default_value = null,
.is_comptime = false,
.alignment = if (@sizeOf(T) > 0) @alignOf(T) else 0,
@@ -1146,8 +1134,8 @@ const TupleTester = struct {
@compileError("Argument count mismatch");
inline for (fields_list) |fld, i| {
- if (expected[i] != fld.field_type) {
- @compileError("Field " ++ fld.name ++ " expected to be type " ++ @typeName(expected[i]) ++ ", but was type " ++ @typeName(fld.field_type));
+ if (expected[i] != fld.type) {
+ @compileError("Field " ++ fld.name ++ " expected to be type " ++ @typeName(expected[i]) ++ ", but was type " ++ @typeName(fld.type));
}
}
}
diff --git a/lib/std/meta/trailer_flags.zig b/lib/std/meta/trailer_flags.zig
index 34fb17eb0a..e50950018d 100644
--- a/lib/std/meta/trailer_flags.zig
+++ b/lib/std/meta/trailer_flags.zig
@@ -24,10 +24,10 @@ pub fn TrailerFlags(comptime Fields: type) type {
inline for (@typeInfo(Fields).Struct.fields) |struct_field, i| {
fields[i] = Type.StructField{
.name = struct_field.name,
- .field_type = ?struct_field.field_type,
- .default_value = &@as(?struct_field.field_type, null),
+ .type = ?struct_field.type,
+ .default_value = &@as(?struct_field.type, null),
.is_comptime = false,
- .alignment = @alignOf(?struct_field.field_type),
+ .alignment = @alignOf(?struct_field.type),
};
}
break :blk @Type(.{
@@ -105,26 +105,26 @@ pub fn TrailerFlags(comptime Fields: type) type {
const active = (self.bits & (1 << i)) != 0;
if (i == @enumToInt(field)) {
assert(active);
- return mem.alignForwardGeneric(usize, off, @alignOf(field_info.field_type));
+ return mem.alignForwardGeneric(usize, off, @alignOf(field_info.type));
} else if (active) {
- off = mem.alignForwardGeneric(usize, off, @alignOf(field_info.field_type));
- off += @sizeOf(field_info.field_type);
+ off = mem.alignForwardGeneric(usize, off, @alignOf(field_info.type));
+ off += @sizeOf(field_info.type);
}
}
}
pub fn Field(comptime field: FieldEnum) type {
- return @typeInfo(Fields).Struct.fields[@enumToInt(field)].field_type;
+ return @typeInfo(Fields).Struct.fields[@enumToInt(field)].type;
}
pub fn sizeInBytes(self: Self) usize {
var off: usize = 0;
inline for (@typeInfo(Fields).Struct.fields) |field, i| {
- if (@sizeOf(field.field_type) == 0)
+ if (@sizeOf(field.type) == 0)
continue;
if ((self.bits & (1 << i)) != 0) {
- off = mem.alignForwardGeneric(usize, off, @alignOf(field.field_type));
- off += @sizeOf(field.field_type);
+ off = mem.alignForwardGeneric(usize, off, @alignOf(field.type));
+ off += @sizeOf(field.type);
}
}
return off;
diff --git a/lib/std/meta/trait.zig b/lib/std/meta/trait.zig
index 2e9c2165f7..843ada7f56 100644
--- a/lib/std/meta/trait.zig
+++ b/lib/std/meta/trait.zig
@@ -154,7 +154,6 @@ pub fn isExtern(comptime T: type) bool {
return switch (@typeInfo(T)) {
.Struct => |s| s.layout == .Extern,
.Union => |u| u.layout == .Extern,
- .Enum => |e| e.layout == .Extern,
else => false,
};
}
@@ -172,7 +171,6 @@ pub fn isPacked(comptime T: type) bool {
return switch (@typeInfo(T)) {
.Struct => |s| s.layout == .Packed,
.Union => |u| u.layout == .Packed,
- .Enum => |e| e.layout == .Packed,
else => false,
};
}
@@ -566,7 +564,7 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {
var sum_size = @as(usize, 0);
inline for (info.fields) |field| {
- const FieldType = field.field_type;
+ const FieldType = field.type;
if (comptime !hasUniqueRepresentation(FieldType)) return false;
sum_size += @sizeOf(FieldType);
}
diff --git a/lib/std/multi_array_list.zig b/lib/std/multi_array_list.zig
index e05b87c0be..38c8276b9a 100644
--- a/lib/std/multi_array_list.zig
+++ b/lib/std/multi_array_list.zig
@@ -84,9 +84,9 @@ pub fn MultiArrayList(comptime S: type) type {
var data: [fields.len]Data = undefined;
for (fields) |field_info, i| {
data[i] = .{
- .size = @sizeOf(field_info.field_type),
+ .size = @sizeOf(field_info.type),
.size_index = i,
- .alignment = if (@sizeOf(field_info.field_type) == 0) 1 else field_info.alignment,
+ .alignment = if (@sizeOf(field_info.type) == 0) 1 else field_info.alignment,
};
}
const Sort = struct {
@@ -294,10 +294,10 @@ pub fn MultiArrayList(comptime S: type) type {
) catch {
const self_slice = self.slice();
inline for (fields) |field_info, i| {
- if (@sizeOf(field_info.field_type) != 0) {
+ if (@sizeOf(field_info.type) != 0) {
const field = @intToEnum(Field, i);
const dest_slice = self_slice.items(field)[new_len..];
- const byte_count = dest_slice.len * @sizeOf(field_info.field_type);
+ const byte_count = dest_slice.len * @sizeOf(field_info.type);
// We use memset here for more efficient codegen in safety-checked,
// valgrind-enabled builds. Otherwise the valgrind client request
// will be repeated for every element.
@@ -316,9 +316,9 @@ pub fn MultiArrayList(comptime S: type) type {
const self_slice = self.slice();
const other_slice = other.slice();
inline for (fields) |field_info, i| {
- if (@sizeOf(field_info.field_type) != 0) {
+ if (@sizeOf(field_info.type) != 0) {
const field = @intToEnum(Field, i);
- mem.copy(field_info.field_type, other_slice.items(field), self_slice.items(field));
+ mem.copy(field_info.type, other_slice.items(field), self_slice.items(field));
}
}
gpa.free(self.allocatedBytes());
@@ -377,9 +377,9 @@ pub fn MultiArrayList(comptime S: type) type {
const self_slice = self.slice();
const other_slice = other.slice();
inline for (fields) |field_info, i| {
- if (@sizeOf(field_info.field_type) != 0) {
+ if (@sizeOf(field_info.type) != 0) {
const field = @intToEnum(Field, i);
- mem.copy(field_info.field_type, other_slice.items(field), self_slice.items(field));
+ mem.copy(field_info.type, other_slice.items(field), self_slice.items(field));
}
}
gpa.free(self.allocatedBytes());
@@ -396,9 +396,9 @@ pub fn MultiArrayList(comptime S: type) type {
const self_slice = self.slice();
const result_slice = result.slice();
inline for (fields) |field_info, i| {
- if (@sizeOf(field_info.field_type) != 0) {
+ if (@sizeOf(field_info.type) != 0) {
const field = @intToEnum(Field, i);
- mem.copy(field_info.field_type, result_slice.items(field), self_slice.items(field));
+ mem.copy(field_info.type, result_slice.items(field), self_slice.items(field));
}
}
return result;
@@ -413,10 +413,10 @@ pub fn MultiArrayList(comptime S: type) type {
pub fn swap(sc: @This(), a_index: usize, b_index: usize) void {
inline for (fields) |field_info, i| {
- if (@sizeOf(field_info.field_type) != 0) {
+ if (@sizeOf(field_info.type) != 0) {
const field = @intToEnum(Field, i);
const ptr = sc.slice.items(field);
- mem.swap(field_info.field_type, &ptr[a_index], &ptr[b_index]);
+ mem.swap(field_info.type, &ptr[a_index], &ptr[b_index]);
}
}
}
@@ -449,7 +449,7 @@ pub fn MultiArrayList(comptime S: type) type {
}
fn FieldType(comptime field: Field) type {
- return meta.fieldInfo(S, field).field_type;
+ return meta.fieldInfo(S, field).type;
}
/// This function is used in tools/zig-gdb.py to fetch the child type to facilitate
diff --git a/lib/std/os/uefi/protocols/device_path_protocol.zig b/lib/std/os/uefi/protocols/device_path_protocol.zig
index 338c9ea50d..6df6442fe6 100644
--- a/lib/std/os/uefi/protocols/device_path_protocol.zig
+++ b/lib/std/os/uefi/protocols/device_path_protocol.zig
@@ -81,7 +81,7 @@ pub const DevicePathProtocol = extern struct {
// Got the associated union type for self.type, now
// we need to initialize it and its subtype
if (self.type == enum_value) {
- var subtype = self.initSubtype(ufield.field_type);
+ var subtype = self.initSubtype(ufield.type);
if (subtype) |sb| {
// e.g. return .{ .Hardware = .{ .Pci = @ptrCast(...) } }
@@ -103,7 +103,7 @@ pub const DevicePathProtocol = extern struct {
if (self.subtype == tag_val) {
// e.g. expr = .{ .Pci = @ptrCast(...) }
- return @unionInit(TUnion, subtype.name, @ptrCast(subtype.field_type, self));
+ return @unionInit(TUnion, subtype.name, @ptrCast(subtype.type, self));
}
}
diff --git a/lib/std/start.zig b/lib/std/start.zig
index b8c74a6373..dcc0b7427a 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -634,7 +634,7 @@ pub fn callMain() u8 {
}
pub fn call_wWinMain() std.os.windows.INT {
- const MAIN_HINSTANCE = @typeInfo(@TypeOf(root.wWinMain)).Fn.args[0].arg_type.?;
+ const MAIN_HINSTANCE = @typeInfo(@TypeOf(root.wWinMain)).Fn.params[0].type.?;
const hInstance = @ptrCast(MAIN_HINSTANCE, std.os.windows.kernel32.GetModuleHandleW(null).?);
const lpCmdLine = std.os.windows.kernel32.GetCommandLineW();
diff --git a/lib/std/testing.zig b/lib/std/testing.zig
index 72f3ba2d9e..53877967c9 100644
--- a/lib/std/testing.zig
+++ b/lib/std/testing.zig
@@ -802,7 +802,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime
const ArgsTuple = std.meta.ArgsTuple(@TypeOf(test_fn));
const fn_args_fields = @typeInfo(ArgsTuple).Struct.fields;
- if (fn_args_fields.len == 0 or fn_args_fields[0].field_type != std.mem.Allocator) {
+ if (fn_args_fields.len == 0 or fn_args_fields[0].type != std.mem.Allocator) {
@compileError("The provided function must have an " ++ @typeName(std.mem.Allocator) ++ " as its first argument");
}
const expected_args_tuple_len = fn_args_fields.len - 1;
diff --git a/lib/std/x/os/socket.zig b/lib/std/x/os/socket.zig
index 3de9359cc5..99782710cb 100644
--- a/lib/std/x/os/socket.zig
+++ b/lib/std/x/os/socket.zig
@@ -230,12 +230,12 @@ pub const Socket = struct {
pub fn setName(self: *Self, name: []const u8) void {
self.name = @ptrToInt(name.ptr);
- self.name_len = @intCast(meta.fieldInfo(Self, .name_len).field_type, name.len);
+ self.name_len = @intCast(meta.fieldInfo(Self, .name_len).type, name.len);
}
pub fn setBuffers(self: *Self, buffers: []const Buffer) void {
self.buffers = @ptrToInt(buffers.ptr);
- self.buffers_len = @intCast(meta.fieldInfo(Self, .buffers_len).field_type, buffers.len);
+ self.buffers_len = @intCast(meta.fieldInfo(Self, .buffers_len).type, buffers.len);
}
pub fn setControl(self: *Self, control: []const u8) void {
@@ -243,12 +243,12 @@ pub const Socket = struct {
self.control = Buffer.from(control);
} else {
self.control = @ptrToInt(control.ptr);
- self.control_len = @intCast(meta.fieldInfo(Self, .control_len).field_type, control.len);
+ self.control_len = @intCast(meta.fieldInfo(Self, .control_len).type, control.len);
}
}
pub fn setFlags(self: *Self, flags: u32) void {
- self.flags = @intCast(meta.fieldInfo(Self, .flags).field_type, flags);
+ self.flags = @intCast(meta.fieldInfo(Self, .flags).type, flags);
}
pub fn getName(self: Self) []const u8 {
diff --git a/lib/std/zig/Ast.zig b/lib/std/zig/Ast.zig
index 961a5f7eab..43cda7a977 100644
--- a/lib/std/zig/Ast.zig
+++ b/lib/std/zig/Ast.zig
@@ -125,7 +125,7 @@ pub fn extraData(tree: Ast, index: usize, comptime T: type) T {
const fields = std.meta.fields(T);
var result: T = undefined;
inline for (fields) |field, i| {
- comptime assert(field.field_type == Node.Index);
+ comptime assert(field.type == Node.Index);
@field(result, field.name) = tree.extra_data[index + i];
}
return result;
diff --git a/lib/std/zig/c_translation.zig b/lib/std/zig/c_translation.zig
index aa9d59dae9..a050e592a2 100644
--- a/lib/std/zig/c_translation.zig
+++ b/lib/std/zig/c_translation.zig
@@ -50,7 +50,7 @@ pub fn cast(comptime DestType: type, target: anytype) DestType {
},
.Union => |info| {
inline for (info.fields) |field| {
- if (field.field_type == SourceType) return @unionInit(DestType, field.name, target);
+ if (field.type == SourceType) return @unionInit(DestType, field.name, target);
}
@compileError("cast to union type '" ++ @typeName(DestType) ++ "' from type '" ++ @typeName(SourceType) ++ "' which is not present in union");
},
diff --git a/lib/std/zig/parse.zig b/lib/std/zig/parse.zig
index 0155cf0d75..205b094e93 100644
--- a/lib/std/zig/parse.zig
+++ b/lib/std/zig/parse.zig
@@ -153,7 +153,7 @@ const Parser = struct {
try p.extra_data.ensureUnusedCapacity(p.gpa, fields.len);
const result = @intCast(u32, p.extra_data.items.len);
inline for (fields) |field| {
- comptime assert(field.field_type == Node.Index);
+ comptime assert(field.type == Node.Index);
p.extra_data.appendAssumeCapacity(@field(extra, field.name));
}
return result;
diff --git a/src/Air.zig b/src/Air.zig
index 707e700f08..7528d72bda 100644
--- a/src/Air.zig
+++ b/src/Air.zig
@@ -1260,7 +1260,7 @@ pub fn extraData(air: Air, comptime T: type, index: usize) struct { data: T, end
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
- @field(result, field.name) = switch (field.field_type) {
+ @field(result, field.name) = switch (field.type) {
u32 => air.extra[i],
Inst.Ref => @intToEnum(Inst.Ref, air.extra[i]),
i32 => @bitCast(i32, air.extra[i]),
diff --git a/src/AstGen.zig b/src/AstGen.zig
index 8df3d56a88..9d9fae3c13 100644
--- a/src/AstGen.zig
+++ b/src/AstGen.zig
@@ -79,7 +79,7 @@ fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void {
const fields = std.meta.fields(@TypeOf(extra));
var i = index;
inline for (fields) |field| {
- astgen.extra.items[i] = switch (field.field_type) {
+ astgen.extra.items[i] = switch (field.type) {
u32 => @field(extra, field.name),
Zir.Inst.Ref => @enumToInt(@field(extra, field.name)),
i32 => @bitCast(u32, @field(extra, field.name)),
diff --git a/src/Autodoc.zig b/src/Autodoc.zig
index 55ff048482..246b97037a 100644
--- a/src/Autodoc.zig
+++ b/src/Autodoc.zig
@@ -637,9 +637,9 @@ const DocData = struct {
inline for (comptime std.meta.fields(Type)) |case| {
if (@field(Type, case.name) == active_tag) {
const current_value = @field(self, case.name);
- inline for (comptime std.meta.fields(case.field_type)) |f| {
+ inline for (comptime std.meta.fields(case.type)) |f| {
try jsw.arrayElem();
- if (f.field_type == std.builtin.Type.Pointer.Size) {
+ if (f.type == std.builtin.Type.Pointer.Size) {
try jsw.emitNumber(@enumToInt(@field(current_value, f.name)));
} else {
try std.json.stringify(@field(current_value, f.name), opts, w);
diff --git a/src/InternPool.zig b/src/InternPool.zig
index 5e50780315..74155ca657 100644
--- a/src/InternPool.zig
+++ b/src/InternPool.zig
@@ -259,7 +259,7 @@ fn addExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 {
const fields = std.meta.fields(@TypeOf(extra));
const result = @intCast(u32, ip.extra.items.len);
inline for (fields) |field| {
- ip.extra.appendAssumeCapacity(switch (field.field_type) {
+ ip.extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
Index => @enumToInt(@field(extra, field.name)),
i32 => @bitCast(u32, @field(extra, field.name)),
@@ -274,7 +274,7 @@ fn extraData(ip: InternPool, comptime T: type, index: usize) T {
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
- @field(result, field.name) = switch (field.field_type) {
+ @field(result, field.name) = switch (field.type) {
u32 => ip.extra.items[i],
Index => @intToEnum(Index, ip.extra.items[i]),
i32 => @bitCast(i32, ip.extra.items[i]),
diff --git a/src/Liveness.zig b/src/Liveness.zig
index d129dc01bf..b5fd597326 100644
--- a/src/Liveness.zig
+++ b/src/Liveness.zig
@@ -718,7 +718,7 @@ const Analysis = struct {
const fields = std.meta.fields(@TypeOf(extra));
const result = @intCast(u32, a.extra.items.len);
inline for (fields) |field| {
- a.extra.appendAssumeCapacity(switch (field.field_type) {
+ a.extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
else => @compileError("bad field type"),
});
diff --git a/src/Sema.zig b/src/Sema.zig
index 38a095f898..e4f82d6438 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -15319,7 +15319,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
Value.makeBool(is_generic),
// is_noalias: bool,
Value.makeBool(is_noalias),
- // arg_type: ?type,
+ // type: ?type,
param_ty_val,
};
param_val.* = try Value.Tag.aggregate.create(params_anon_decl.arena(), param_fields);
@@ -15693,14 +15693,8 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
const decls_val = try sema.typeInfoDecls(block, src, type_info_ty, ty.getNamespace());
- const field_values = try sema.arena.create([5]Value);
+ const field_values = try sema.arena.create([4]Value);
field_values.* = .{
- // layout: ContainerLayout,
- try Value.Tag.enum_field_index.create(
- sema.arena,
- @enumToInt(std.builtin.Type.ContainerLayout.Auto),
- ),
-
// tag_type: type,
try Value.Tag.ty.create(sema.arena, int_tag_ty),
// fields: []const EnumField,
@@ -15770,7 +15764,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
union_field_fields.* = .{
// name: []const u8,
name_val,
- // field_type: type,
+ // type: type,
try Value.Tag.ty.create(fields_anon_decl.arena(), field.ty),
// alignment: comptime_int,
try Value.Tag.int_u64.create(fields_anon_decl.arena(), alignment),
@@ -15883,7 +15877,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
struct_field_fields.* = .{
// name: []const u8,
name_val,
- // field_type: type,
+ // type: type,
try Value.Tag.ty.create(fields_anon_decl.arena(), field_ty),
// default_value: ?*const anyopaque,
try default_val_ptr.copy(fields_anon_decl.arena()),
@@ -15928,7 +15922,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
struct_field_fields.* = .{
// name: []const u8,
name_val,
- // field_type: type,
+ // type: type,
try Value.Tag.ty.create(fields_anon_decl.arena(), field.ty),
// default_value: ?*const anyopaque,
try default_val_ptr.copy(fields_anon_decl.arena()),
@@ -18315,22 +18309,14 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
.Enum => {
const struct_val: []const Value = union_val.val.castTag(.aggregate).?.data;
// TODO use reflection instead of magic numbers here
- // layout: ContainerLayout,
- const layout_val = struct_val[0];
// tag_type: type,
- const tag_type_val = struct_val[1];
+ const tag_type_val = struct_val[0];
// fields: []const EnumField,
- const fields_val = struct_val[2];
+ const fields_val = struct_val[1];
// decls: []const Declaration,
- const decls_val = struct_val[3];
+ const decls_val = struct_val[2];
// is_exhaustive: bool,
- const is_exhaustive_val = struct_val[4];
-
- // enum layout is always auto
- const layout = layout_val.toEnum(std.builtin.Type.ContainerLayout);
- if (layout != .Auto) {
- return sema.fail(block, src, "reified enums must have a layout .Auto", .{});
- }
+ const is_exhaustive_val = struct_val[3];
// Decls
if (decls_val.sliceLen(mod) > 0) {
@@ -18577,8 +18563,8 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
// TODO use reflection instead of magic numbers here
// name: []const u8
const name_val = field_struct_val[0];
- // field_type: type,
- const field_type_val = field_struct_val[1];
+ // type: type,
+ const type_val = field_struct_val[1];
// alignment: comptime_int,
const alignment_val = field_struct_val[2];
@@ -18612,7 +18598,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
}
var buffer: Value.ToTypeBuffer = undefined;
- const field_ty = try field_type_val.toType(&buffer).copy(new_decl_arena_allocator);
+ const field_ty = try type_val.toType(&buffer).copy(new_decl_arena_allocator);
gop.value_ptr.* = .{
.ty = field_ty,
.abi_align = @intCast(u32, (try alignment_val.getUnsignedIntAdvanced(target, sema)).?),
@@ -18733,7 +18719,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
const arg_is_generic = arg_val[0].toBool();
// is_noalias: bool,
const arg_is_noalias = arg_val[1].toBool();
- // arg_type: ?type,
+ // type: ?type,
const param_type_opt_val = arg_val[2];
if (arg_is_generic) {
@@ -18831,9 +18817,9 @@ fn reifyStruct(
// TODO use reflection instead of magic numbers here
// name: []const u8
const name_val = field_struct_val[0];
- // field_type: type,
- const field_type_val = field_struct_val[1];
- //default_value: ?*const anyopaque,
+ // type: type,
+ const type_val = field_struct_val[1];
+ // default_value: ?*const anyopaque,
const default_value_val = field_struct_val[2];
// is_comptime: bool,
const is_comptime_val = field_struct_val[3];
@@ -18896,7 +18882,7 @@ fn reifyStruct(
}
var buffer: Value.ToTypeBuffer = undefined;
- const field_ty = try field_type_val.toType(&buffer).copy(new_decl_arena_allocator);
+ const field_ty = try type_val.toType(&buffer).copy(new_decl_arena_allocator);
gop.value_ptr.* = .{
.ty = field_ty,
.abi_align = abi_align,
@@ -31572,7 +31558,7 @@ pub fn addExtraAssumeCapacity(sema: *Sema, extra: anytype) u32 {
const fields = std.meta.fields(@TypeOf(extra));
const result = @intCast(u32, sema.air_extra.items.len);
inline for (fields) |field| {
- sema.air_extra.appendAssumeCapacity(switch (field.field_type) {
+ sema.air_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
Air.Inst.Ref => @enumToInt(@field(extra, field.name)),
i32 => @bitCast(u32, @field(extra, field.name)),
diff --git a/src/Zir.zig b/src/Zir.zig
index 6e7164878c..faa8d43638 100644
--- a/src/Zir.zig
+++ b/src/Zir.zig
@@ -71,7 +71,7 @@ pub fn extraData(code: Zir, comptime T: type, index: usize) struct { data: T, en
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
- @field(result, field.name) = switch (field.field_type) {
+ @field(result, field.name) = switch (field.type) {
u32 => code.extra[i],
Inst.Ref => @intToEnum(Inst.Ref, code.extra[i]),
i32 => @bitCast(i32, code.extra[i]),
diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig
index 8c87a005d5..acaffad5fe 100644
--- a/src/arch/aarch64/CodeGen.zig
+++ b/src/arch/aarch64/CodeGen.zig
@@ -477,7 +477,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 {
const fields = std.meta.fields(@TypeOf(extra));
const result = @intCast(u32, self.mir_extra.items.len);
inline for (fields) |field| {
- self.mir_extra.appendAssumeCapacity(switch (field.field_type) {
+ self.mir_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
i32 => @bitCast(u32, @field(extra, field.name)),
else => @compileError("bad field type"),
diff --git a/src/arch/aarch64/Mir.zig b/src/arch/aarch64/Mir.zig
index e5541a5988..cc478c874a 100644
--- a/src/arch/aarch64/Mir.zig
+++ b/src/arch/aarch64/Mir.zig
@@ -505,7 +505,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
- @field(result, field.name) = switch (field.field_type) {
+ @field(result, field.name) = switch (field.type) {
u32 => mir.extra[i],
i32 => @bitCast(i32, mir.extra[i]),
else => @compileError("bad field type"),
diff --git a/src/arch/arm/CodeGen.zig b/src/arch/arm/CodeGen.zig
index 9d6d18d5c9..be0a35f54d 100644
--- a/src/arch/arm/CodeGen.zig
+++ b/src/arch/arm/CodeGen.zig
@@ -386,7 +386,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 {
const fields = std.meta.fields(@TypeOf(extra));
const result = @intCast(u32, self.mir_extra.items.len);
inline for (fields) |field| {
- self.mir_extra.appendAssumeCapacity(switch (field.field_type) {
+ self.mir_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
i32 => @bitCast(u32, @field(extra, field.name)),
else => @compileError("bad field type"),
diff --git a/src/arch/arm/Mir.zig b/src/arch/arm/Mir.zig
index 3478d8dc58..07a8384c2c 100644
--- a/src/arch/arm/Mir.zig
+++ b/src/arch/arm/Mir.zig
@@ -283,7 +283,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
- @field(result, field.name) = switch (field.field_type) {
+ @field(result, field.name) = switch (field.type) {
u32 => mir.extra[i],
i32 => @bitCast(i32, mir.extra[i]),
else => @compileError("bad field type"),
diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig
index 24e24076f7..1aa443341f 100644
--- a/src/arch/riscv64/CodeGen.zig
+++ b/src/arch/riscv64/CodeGen.zig
@@ -340,7 +340,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 {
const fields = std.meta.fields(@TypeOf(extra));
const result = @intCast(u32, self.mir_extra.items.len);
inline for (fields) |field| {
- self.mir_extra.appendAssumeCapacity(switch (field.field_type) {
+ self.mir_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
i32 => @bitCast(u32, @field(extra, field.name)),
else => @compileError("bad field type"),
diff --git a/src/arch/riscv64/Mir.zig b/src/arch/riscv64/Mir.zig
index 5df3a86229..97accb7642 100644
--- a/src/arch/riscv64/Mir.zig
+++ b/src/arch/riscv64/Mir.zig
@@ -132,7 +132,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
- @field(result, field.name) = switch (field.field_type) {
+ @field(result, field.name) = switch (field.type) {
u32 => mir.extra[i],
i32 => @bitCast(i32, mir.extra[i]),
else => @compileError("bad field type"),
diff --git a/src/arch/sparc64/Mir.zig b/src/arch/sparc64/Mir.zig
index 744bd84943..f854152a2f 100644
--- a/src/arch/sparc64/Mir.zig
+++ b/src/arch/sparc64/Mir.zig
@@ -347,7 +347,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
- @field(result, field.name) = switch (field.field_type) {
+ @field(result, field.name) = switch (field.type) {
u32 => mir.extra[i],
i32 => @bitCast(i32, mir.extra[i]),
else => @compileError("bad field type"),
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index 70a2aea3c9..d175b96034 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -960,7 +960,7 @@ fn addExtraAssumeCapacity(func: *CodeGen, extra: anytype) error{OutOfMemory}!u32
const fields = std.meta.fields(@TypeOf(extra));
const result = @intCast(u32, func.mir_extra.items.len);
inline for (fields) |field| {
- func.mir_extra.appendAssumeCapacity(switch (field.field_type) {
+ func.mir_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
else => |field_type| @compileError("Unsupported field type " ++ @typeName(field_type)),
});
diff --git a/src/arch/wasm/Mir.zig b/src/arch/wasm/Mir.zig
index 0f33dd9350..66969a9c21 100644
--- a/src/arch/wasm/Mir.zig
+++ b/src/arch/wasm/Mir.zig
@@ -589,7 +589,7 @@ pub fn extraData(self: *const Mir, comptime T: type, index: usize) struct { data
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
- @field(result, field.name) = switch (field.field_type) {
+ @field(result, field.name) = switch (field.type) {
u32 => self.extra[i],
else => |field_type| @compileError("Unsupported field type " ++ @typeName(field_type)),
};
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig
index d0599150bd..e0cf3b946d 100644
--- a/src/arch/x86_64/CodeGen.zig
+++ b/src/arch/x86_64/CodeGen.zig
@@ -374,7 +374,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 {
const fields = std.meta.fields(@TypeOf(extra));
const result = @intCast(u32, self.mir_extra.items.len);
inline for (fields) |field| {
- self.mir_extra.appendAssumeCapacity(switch (field.field_type) {
+ self.mir_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
i32 => @bitCast(u32, @field(extra, field.name)),
else => @compileError("bad field type"),
diff --git a/src/arch/x86_64/Mir.zig b/src/arch/x86_64/Mir.zig
index 5bd8dc68f6..df2052ca6e 100644
--- a/src/arch/x86_64/Mir.zig
+++ b/src/arch/x86_64/Mir.zig
@@ -612,7 +612,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
- @field(result, field.name) = switch (field.field_type) {
+ @field(result, field.name) = switch (field.type) {
u32 => mir.extra[i],
i32 => @bitCast(i32, mir.extra[i]),
else => @compileError("bad field type"),
diff --git a/src/codegen/spirv/Section.zig b/src/codegen/spirv/Section.zig
index 768525028e..83f594dcef 100644
--- a/src/codegen/spirv/Section.zig
+++ b/src/codegen/spirv/Section.zig
@@ -116,7 +116,7 @@ fn writeOperands(section: *Section, comptime Operands: type, operands: Operands)
};
inline for (fields) |field| {
- section.writeOperand(field.field_type, @field(operands, field.name));
+ section.writeOperand(field.type, @field(operands, field.name));
}
}
@@ -196,7 +196,7 @@ fn writeContextDependentNumber(section: *Section, operand: spec.LiteralContextDe
fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand) void {
var mask: Word = 0;
inline for (@typeInfo(Operand).Struct.fields) |field, bit| {
- switch (@typeInfo(field.field_type)) {
+ switch (@typeInfo(field.type)) {
.Optional => if (@field(operand, field.name) != null) {
mask |= 1 << @intCast(u5, bit);
},
@@ -214,7 +214,7 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand
section.writeWord(mask);
inline for (@typeInfo(Operand).Struct.fields) |field| {
- switch (@typeInfo(field.field_type)) {
+ switch (@typeInfo(field.type)) {
.Optional => |info| if (@field(operand, field.name)) |child| {
section.writeOperands(info.child, child);
},
@@ -230,7 +230,7 @@ fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operan
inline for (@typeInfo(Operand).Union.fields) |field| {
if (@field(Operand, field.name) == tag) {
- section.writeOperands(field.field_type, @field(operand, field.name));
+ section.writeOperands(field.type, @field(operand, field.name));
return;
}
}
@@ -250,7 +250,7 @@ fn operandsSize(comptime Operands: type, operands: Operands) usize {
var total: usize = 0;
inline for (fields) |field| {
- total += operandSize(field.field_type, @field(operands, field.name));
+ total += operandSize(field.type, @field(operands, field.name));
}
return total;
@@ -304,7 +304,7 @@ fn extendedMaskSize(comptime Operand: type, operand: Operand) usize {
var total: usize = 0;
var any_set = false;
inline for (@typeInfo(Operand).Struct.fields) |field| {
- switch (@typeInfo(field.field_type)) {
+ switch (@typeInfo(field.type)) {
.Optional => |info| if (@field(operand, field.name)) |child| {
total += operandsSize(info.child, child);
any_set = true;
@@ -326,7 +326,7 @@ fn extendedUnionSize(comptime Operand: type, operand: Operand) usize {
inline for (@typeInfo(Operand).Union.fields) |field| {
if (@field(Operand, field.name) == tag) {
// Add one for the tag itself.
- return 1 + operandsSize(field.field_type, @field(operand, field.name));
+ return 1 + operandsSize(field.type, @field(operand, field.name));
}
}
unreachable;
diff --git a/src/link/tapi/yaml.zig b/src/link/tapi/yaml.zig
index 9039d3b4f1..748f1c138f 100644
--- a/src/link/tapi/yaml.zig
+++ b/src/link/tapi/yaml.zig
@@ -339,7 +339,7 @@ pub const Yaml = struct {
if (union_info.tag_type) |_| {
inline for (union_info.fields) |field| {
- if (self.parseValue(field.field_type, value)) |u_value| {
+ if (self.parseValue(field.type, value)) |u_value| {
return @unionInit(T, field.name, u_value);
} else |err| {
if (@as(@TypeOf(err) || error{TypeMismatch}, err) != error.TypeMismatch) return err;
@@ -366,16 +366,16 @@ pub const Yaml = struct {
break :blk map.get(field_name);
};
- if (@typeInfo(field.field_type) == .Optional) {
- @field(parsed, field.name) = try self.parseOptional(field.field_type, value);
+ if (@typeInfo(field.type) == .Optional) {
+ @field(parsed, field.name) = try self.parseOptional(field.type, value);
continue;
}
const unwrapped = value orelse {
- log.debug("missing struct field: {s}: {s}", .{ field.name, @typeName(field.field_type) });
+ log.debug("missing struct field: {s}: {s}", .{ field.name, @typeName(field.type) });
return error.StructFieldMissing;
};
- @field(parsed, field.name) = try self.parseValue(field.field_type, unwrapped);
+ @field(parsed, field.name) = try self.parseValue(field.type, unwrapped);
}
return parsed;
diff --git a/src/print_zir.zig b/src/print_zir.zig
index 6dbaf51bc3..b17ef954fc 100644
--- a/src/print_zir.zig
+++ b/src/print_zir.zig
@@ -1312,7 +1312,7 @@ const Writer = struct {
type_len: u32 = 0,
align_len: u32 = 0,
init_len: u32 = 0,
- field_type: Zir.Inst.Ref = .none,
+ type: Zir.Inst.Ref = .none,
name: u32,
is_comptime: bool,
};
@@ -1353,7 +1353,7 @@ const Writer = struct {
if (has_type_body) {
fields[field_i].type_len = self.code.extra[extra_index];
} else {
- fields[field_i].field_type = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
+ fields[field_i].type = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
}
extra_index += 1;
@@ -1384,8 +1384,8 @@ const Writer = struct {
} else {
try stream.print("@\"{d}\": ", .{i});
}
- if (field.field_type != .none) {
- try self.writeInstRef(stream, field.field_type);
+ if (field.type != .none) {
+ try self.writeInstRef(stream, field.type);
}
if (field.type_len > 0) {
diff --git a/src/translate_c/ast.zig b/src/translate_c/ast.zig
index 1ed2eb568c..78175a611b 100644
--- a/src/translate_c/ast.zig
+++ b/src/translate_c/ast.zig
@@ -392,7 +392,7 @@ pub const Node = extern union {
}
pub fn Data(comptime t: Tag) type {
- return std.meta.fieldInfo(t.Type(), .data).field_type;
+ return std.meta.fieldInfo(t.Type(), .data).type;
}
};
@@ -845,7 +845,7 @@ const Context = struct {
try c.extra_data.ensureUnusedCapacity(c.gpa, fields.len);
const result = @intCast(u32, c.extra_data.items.len);
inline for (fields) |field| {
- comptime std.debug.assert(field.field_type == NodeIndex);
+ comptime std.debug.assert(field.type == NodeIndex);
c.extra_data.appendAssumeCapacity(@field(extra, field.name));
}
return result;
diff --git a/src/type.zig b/src/type.zig
index 64702509dc..41e287829b 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -6216,7 +6216,7 @@ pub const Type = extern union {
}
pub fn Data(comptime t: Tag) type {
- return std.meta.fieldInfo(t.Type(), .data).field_type;
+ return std.meta.fieldInfo(t.Type(), .data).type;
}
};
diff --git a/src/value.zig b/src/value.zig
index b0558487f9..839b3d7580 100644
--- a/src/value.zig
+++ b/src/value.zig
@@ -338,7 +338,7 @@ pub const Value = extern union {
}
pub fn Data(comptime t: Tag) type {
- return std.meta.fieldInfo(t.Type(), .data).field_type;
+ return std.meta.fieldInfo(t.Type(), .data).type;
}
};
diff --git a/stage1/zig1.wasm b/stage1/zig1.wasm
index fd166c5ae0..7f19d7ddbc 100644
--- a/stage1/zig1.wasm
+++ b/stage1/zig1.wasm
Binary files differ
diff --git a/test/behavior/bitcast.zig b/test/behavior/bitcast.zig
index 73b20f3568..8e0bf4ec32 100644
--- a/test/behavior/bitcast.zig
+++ b/test/behavior/bitcast.zig
@@ -358,7 +358,7 @@ test "comptime @bitCast packed struct to int and back" {
const rt_cast = @bitCast(S, i);
const ct_cast = comptime @bitCast(S, @as(Int, 0));
inline for (@typeInfo(S).Struct.fields) |field| {
- if (@typeInfo(field.field_type) == .Vector)
+ if (@typeInfo(field.type) == .Vector)
continue; //TODO: https://github.com/ziglang/zig/issues/13201
try expectEqual(@field(rt_cast, field.name), @field(ct_cast, field.name));
diff --git a/test/behavior/bugs/12786.zig b/test/behavior/bugs/12786.zig
index e8c1a2333f..958b1ebf86 100644
--- a/test/behavior/bugs/12786.zig
+++ b/test/behavior/bugs/12786.zig
@@ -8,7 +8,7 @@ fn NamespacedGlobals(comptime modules: anytype) type {
.fields = &.{
.{
.name = "globals",
- .field_type = modules.mach.globals,
+ .type = modules.mach.globals,
.default_value = null,
.is_comptime = false,
.alignment = @alignOf(modules.mach.globals),
diff --git a/test/behavior/bugs/12794.zig b/test/behavior/bugs/12794.zig
index 530f81cff2..2d4f8bafd9 100644
--- a/test/behavior/bugs/12794.zig
+++ b/test/behavior/bugs/12794.zig
@@ -7,7 +7,7 @@ fn NamespacedComponents(comptime modules: anytype) type {
.is_tuple = false,
.fields = &.{.{
.name = "components",
- .field_type = @TypeOf(modules.components),
+ .type = @TypeOf(modules.components),
.default_value = null,
.is_comptime = false,
.alignment = @alignOf(@TypeOf(modules.components)),
diff --git a/test/behavior/bugs/12885.zig b/test/behavior/bugs/12885.zig
index 2a802efd04..517def14a1 100644
--- a/test/behavior/bugs/12885.zig
+++ b/test/behavior/bugs/12885.zig
@@ -15,8 +15,8 @@ test "ErrorSet comptime_field_ptr" {
}
const fn_info = .{
- .args = [_]builtin.Type.Fn.Param{
- .{ .is_generic = false, .is_noalias = false, .arg_type = u8 },
+ .params = [_]builtin.Type.Fn.Param{
+ .{ .is_generic = false, .is_noalias = false, .type = u8 },
},
};
const Bar = @Type(.{
@@ -26,7 +26,7 @@ const Bar = @Type(.{
.is_generic = false,
.is_var_args = false,
.return_type = void,
- .args = &fn_info.args,
+ .params = &fn_info.params,
},
});
test "fn comptime_field_ptr" {
diff --git a/test/behavior/bugs/13435.zig b/test/behavior/bugs/13435.zig
index a23735f2f4..86a43afa0c 100644
--- a/test/behavior/bugs/13435.zig
+++ b/test/behavior/bugs/13435.zig
@@ -8,7 +8,7 @@ fn CreateUnion(comptime T: type) type {
.fields = &[_]std.builtin.Type.UnionField{
.{
.name = "field",
- .field_type = T,
+ .type = T,
.alignment = @alignOf(T),
},
},
diff --git a/test/behavior/bugs/6456.zig b/test/behavior/bugs/6456.zig
index a47f0c0d6c..03c687232f 100644
--- a/test/behavior/bugs/6456.zig
+++ b/test/behavior/bugs/6456.zig
@@ -23,7 +23,7 @@ test "issue 6456" {
fields = fields ++ &[_]StructField{StructField{
.alignment = 0,
.name = name,
- .field_type = usize,
+ .type = usize,
.default_value = &@as(?usize, null),
.is_comptime = false,
}};
diff --git a/test/behavior/generics.zig b/test/behavior/generics.zig
index dafbfbafe8..17194fc445 100644
--- a/test/behavior/generics.zig
+++ b/test/behavior/generics.zig
@@ -273,7 +273,6 @@ test "generic function instantiation turns into comptime call" {
var enumFields: [1]std.builtin.Type.EnumField = .{.{ .name = "A", .value = 0 }};
return @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = u0,
.fields = &enumFields,
.decls = &.{},
diff --git a/test/behavior/reflection.zig b/test/behavior/reflection.zig
index c0246f1221..4c3f8ccad5 100644
--- a/test/behavior/reflection.zig
+++ b/test/behavior/reflection.zig
@@ -9,10 +9,10 @@ test "reflection: function return type, var args, and param types" {
const info = @typeInfo(@TypeOf(dummy)).Fn;
try expect(info.return_type.? == i32);
try expect(!info.is_var_args);
- try expect(info.args.len == 3);
- try expect(info.args[0].arg_type.? == bool);
- try expect(info.args[1].arg_type.? == i32);
- try expect(info.args[2].arg_type.? == f32);
+ try expect(info.params.len == 3);
+ try expect(info.params[0].type.? == bool);
+ try expect(info.params[1].type.? == i32);
+ try expect(info.params[2].type.? == f32);
}
}
diff --git a/test/behavior/tuple.zig b/test/behavior/tuple.zig
index 9738d4e75b..da51127412 100644
--- a/test/behavior/tuple.zig
+++ b/test/behavior/tuple.zig
@@ -136,14 +136,14 @@ test "array-like initializer for tuple types" {
.fields = &.{
.{
.name = "0",
- .field_type = i32,
+ .type = i32,
.default_value = null,
.is_comptime = false,
.alignment = @alignOf(i32),
},
.{
.name = "1",
- .field_type = u8,
+ .type = u8,
.default_value = null,
.is_comptime = false,
.alignment = @alignOf(i32),
@@ -314,7 +314,7 @@ test "zero sized struct in tuple handled correctly" {
.decls = &.{},
.fields = &.{.{
.name = "0",
- .field_type = struct {},
+ .type = struct {},
.default_value = null,
.is_comptime = false,
.alignment = 0,
diff --git a/test/behavior/tuple_declarations.zig b/test/behavior/tuple_declarations.zig
index 7beab1ca8f..87d4997c8b 100644
--- a/test/behavior/tuple_declarations.zig
+++ b/test/behavior/tuple_declarations.zig
@@ -20,13 +20,13 @@ test "tuple declaration type info" {
try expect(info.is_tuple);
try expectEqualStrings(info.fields[0].name, "0");
- try expect(info.fields[0].field_type == u32);
+ try expect(info.fields[0].type == u32);
try expect(@ptrCast(*const u32, @alignCast(@alignOf(u32), info.fields[0].default_value)).* == 1);
try expect(info.fields[0].is_comptime);
try expect(info.fields[0].alignment == 2);
try expectEqualStrings(info.fields[1].name, "1");
- try expect(info.fields[1].field_type == []const u8);
+ try expect(info.fields[1].type == []const u8);
try expect(info.fields[1].default_value == null);
try expect(!info.fields[1].is_comptime);
try expect(info.fields[1].alignment == @alignOf([]const u8));
@@ -44,13 +44,13 @@ test "tuple declaration type info" {
try expect(info.is_tuple);
try expectEqualStrings(info.fields[0].name, "0");
- try expect(info.fields[0].field_type == u1);
+ try expect(info.fields[0].type == u1);
try expectEqualStrings(info.fields[1].name, "1");
- try expect(info.fields[1].field_type == u30);
+ try expect(info.fields[1].type == u30);
try expectEqualStrings(info.fields[2].name, "2");
- try expect(info.fields[2].field_type == u1);
+ try expect(info.fields[2].type == u1);
}
}
diff --git a/test/behavior/type.zig b/test/behavior/type.zig
index b2db2a73b5..325bf0a8ed 100644
--- a/test/behavior/type.zig
+++ b/test/behavior/type.zig
@@ -268,10 +268,10 @@ test "Type.Struct" {
const infoA = @typeInfo(A).Struct;
try testing.expectEqual(Type.ContainerLayout.Auto, infoA.layout);
try testing.expectEqualSlices(u8, "x", infoA.fields[0].name);
- try testing.expectEqual(u8, infoA.fields[0].field_type);
+ try testing.expectEqual(u8, infoA.fields[0].type);
try testing.expectEqual(@as(?*const anyopaque, null), infoA.fields[0].default_value);
try testing.expectEqualSlices(u8, "y", infoA.fields[1].name);
- try testing.expectEqual(u32, infoA.fields[1].field_type);
+ try testing.expectEqual(u32, infoA.fields[1].type);
try testing.expectEqual(@as(?*const anyopaque, null), infoA.fields[1].default_value);
try testing.expectEqualSlices(Type.Declaration, &.{}, infoA.decls);
try testing.expectEqual(@as(bool, false), infoA.is_tuple);
@@ -286,10 +286,10 @@ test "Type.Struct" {
const infoB = @typeInfo(B).Struct;
try testing.expectEqual(Type.ContainerLayout.Extern, infoB.layout);
try testing.expectEqualSlices(u8, "x", infoB.fields[0].name);
- try testing.expectEqual(u8, infoB.fields[0].field_type);
+ try testing.expectEqual(u8, infoB.fields[0].type);
try testing.expectEqual(@as(?*const anyopaque, null), infoB.fields[0].default_value);
try testing.expectEqualSlices(u8, "y", infoB.fields[1].name);
- try testing.expectEqual(u32, infoB.fields[1].field_type);
+ try testing.expectEqual(u32, infoB.fields[1].type);
try testing.expectEqual(@as(u32, 5), @ptrCast(*align(1) const u32, infoB.fields[1].default_value.?).*);
try testing.expectEqual(@as(usize, 0), infoB.decls.len);
try testing.expectEqual(@as(bool, false), infoB.is_tuple);
@@ -298,10 +298,10 @@ test "Type.Struct" {
const infoC = @typeInfo(C).Struct;
try testing.expectEqual(Type.ContainerLayout.Packed, infoC.layout);
try testing.expectEqualSlices(u8, "x", infoC.fields[0].name);
- try testing.expectEqual(u8, infoC.fields[0].field_type);
+ try testing.expectEqual(u8, infoC.fields[0].type);
try testing.expectEqual(@as(u8, 3), @ptrCast(*const u8, infoC.fields[0].default_value.?).*);
try testing.expectEqualSlices(u8, "y", infoC.fields[1].name);
- try testing.expectEqual(u32, infoC.fields[1].field_type);
+ try testing.expectEqual(u32, infoC.fields[1].type);
try testing.expectEqual(@as(u32, 5), @ptrCast(*align(1) const u32, infoC.fields[1].default_value.?).*);
try testing.expectEqual(@as(usize, 0), infoC.decls.len);
try testing.expectEqual(@as(bool, false), infoC.is_tuple);
@@ -311,10 +311,10 @@ test "Type.Struct" {
const infoD = @typeInfo(D).Struct;
try testing.expectEqual(Type.ContainerLayout.Auto, infoD.layout);
try testing.expectEqualSlices(u8, "x", infoD.fields[0].name);
- try testing.expectEqual(comptime_int, infoD.fields[0].field_type);
+ try testing.expectEqual(comptime_int, infoD.fields[0].type);
try testing.expectEqual(@as(comptime_int, 3), @ptrCast(*const comptime_int, infoD.fields[0].default_value.?).*);
try testing.expectEqualSlices(u8, "y", infoD.fields[1].name);
- try testing.expectEqual(comptime_int, infoD.fields[1].field_type);
+ try testing.expectEqual(comptime_int, infoD.fields[1].type);
try testing.expectEqual(@as(comptime_int, 5), @ptrCast(*const comptime_int, infoD.fields[1].default_value.?).*);
try testing.expectEqual(@as(usize, 0), infoD.decls.len);
try testing.expectEqual(@as(bool, false), infoD.is_tuple);
@@ -324,10 +324,10 @@ test "Type.Struct" {
const infoE = @typeInfo(E).Struct;
try testing.expectEqual(Type.ContainerLayout.Auto, infoE.layout);
try testing.expectEqualSlices(u8, "0", infoE.fields[0].name);
- try testing.expectEqual(comptime_int, infoE.fields[0].field_type);
+ try testing.expectEqual(comptime_int, infoE.fields[0].type);
try testing.expectEqual(@as(comptime_int, 1), @ptrCast(*const comptime_int, infoE.fields[0].default_value.?).*);
try testing.expectEqualSlices(u8, "1", infoE.fields[1].name);
- try testing.expectEqual(comptime_int, infoE.fields[1].field_type);
+ try testing.expectEqual(comptime_int, infoE.fields[1].type);
try testing.expectEqual(@as(comptime_int, 2), @ptrCast(*const comptime_int, infoE.fields[1].default_value.?).*);
try testing.expectEqual(@as(usize, 0), infoE.decls.len);
try testing.expectEqual(@as(bool, true), infoE.is_tuple);
@@ -354,7 +354,6 @@ test "Type.Enum" {
const Foo = @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = u8,
.fields = &.{
.{ .name = "a", .value = 1 },
@@ -369,7 +368,6 @@ test "Type.Enum" {
try testing.expectEqual(@as(u8, 5), @enumToInt(Foo.b));
const Bar = @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = u32,
.fields = &.{
.{ .name = "a", .value = 1 },
@@ -396,8 +394,8 @@ test "Type.Union" {
.layout = .Extern,
.tag_type = null,
.fields = &.{
- .{ .name = "int", .field_type = i32, .alignment = @alignOf(f32) },
- .{ .name = "float", .field_type = f32, .alignment = @alignOf(f32) },
+ .{ .name = "int", .type = i32, .alignment = @alignOf(f32) },
+ .{ .name = "float", .type = f32, .alignment = @alignOf(f32) },
},
.decls = &.{},
},
@@ -412,8 +410,8 @@ test "Type.Union" {
.layout = .Packed,
.tag_type = null,
.fields = &.{
- .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
- .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
+ .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
+ .{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
},
.decls = &.{},
},
@@ -424,7 +422,6 @@ test "Type.Union" {
const Tag = @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = u1,
.fields = &.{
.{ .name = "signed", .value = 0 },
@@ -439,8 +436,8 @@ test "Type.Union" {
.layout = .Auto,
.tag_type = Tag,
.fields = &.{
- .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
- .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
+ .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
+ .{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
},
.decls = &.{},
},
@@ -456,7 +453,6 @@ test "Type.Union from Type.Enum" {
const Tag = @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = u0,
.fields = &.{
.{ .name = "working_as_expected", .value = 0 },
@@ -470,7 +466,7 @@ test "Type.Union from Type.Enum" {
.layout = .Auto,
.tag_type = Tag,
.fields = &.{
- .{ .name = "working_as_expected", .field_type = u32, .alignment = @alignOf(u32) },
+ .{ .name = "working_as_expected", .type = u32, .alignment = @alignOf(u32) },
},
.decls = &.{},
},
@@ -487,7 +483,7 @@ test "Type.Union from regular enum" {
.layout = .Auto,
.tag_type = E,
.fields = &.{
- .{ .name = "working_as_expected", .field_type = u32, .alignment = @alignOf(u32) },
+ .{ .name = "working_as_expected", .type = u32, .alignment = @alignOf(u32) },
},
.decls = &.{},
},
@@ -512,9 +508,9 @@ test "Type.Fn" {
.is_generic = false,
.is_var_args = false,
.return_type = void,
- .args = &.{
- .{ .is_generic = false, .is_noalias = false, .arg_type = c_int },
- .{ .is_generic = false, .is_noalias = false, .arg_type = some_ptr },
+ .params = &.{
+ .{ .is_generic = false, .is_noalias = false, .type = c_int },
+ .{ .is_generic = false, .is_noalias = false, .type = some_ptr },
},
} };
@@ -537,7 +533,7 @@ test "reified struct field name from optional payload" {
.layout = .Auto,
.fields = &.{.{
.name = name,
- .field_type = u8,
+ .type = u8,
.default_value = null,
.is_comptime = false,
.alignment = 1,
diff --git a/test/behavior/type_info.zig b/test/behavior/type_info.zig
index 2d9eec645a..8c895ceb00 100644
--- a/test/behavior/type_info.zig
+++ b/test/behavior/type_info.zig
@@ -238,7 +238,6 @@ fn testEnum() !void {
const os_info = @typeInfo(Os);
try expect(os_info == .Enum);
- try expect(os_info.Enum.layout == .Auto);
try expect(os_info.Enum.fields.len == 4);
try expect(mem.eql(u8, os_info.Enum.fields[1].name, "Macos"));
try expect(os_info.Enum.fields[3].value == 3);
@@ -257,7 +256,7 @@ fn testUnion() !void {
try expect(typeinfo_info.Union.layout == .Auto);
try expect(typeinfo_info.Union.tag_type.? == TypeId);
try expect(typeinfo_info.Union.fields.len == 24);
- try expect(typeinfo_info.Union.fields[4].field_type == @TypeOf(@typeInfo(u8).Int));
+ try expect(typeinfo_info.Union.fields[4].type == @TypeOf(@typeInfo(u8).Int));
try expect(typeinfo_info.Union.decls.len == 22);
const TestNoTagUnion = union {
@@ -271,7 +270,7 @@ fn testUnion() !void {
try expect(notag_union_info.Union.layout == .Auto);
try expect(notag_union_info.Union.fields.len == 2);
try expect(notag_union_info.Union.fields[0].alignment == @alignOf(void));
- try expect(notag_union_info.Union.fields[1].field_type == u32);
+ try expect(notag_union_info.Union.fields[1].type == u32);
try expect(notag_union_info.Union.fields[1].alignment == @alignOf(u32));
const TestExternUnion = extern union {
@@ -281,7 +280,7 @@ fn testUnion() !void {
const extern_union_info = @typeInfo(TestExternUnion);
try expect(extern_union_info.Union.layout == .Extern);
try expect(extern_union_info.Union.tag_type == null);
- try expect(extern_union_info.Union.fields[0].field_type == *anyopaque);
+ try expect(extern_union_info.Union.fields[0].type == *anyopaque);
}
test "type info: struct info" {
@@ -319,7 +318,7 @@ fn testPackedStruct() !void {
try expect(struct_info.Struct.backing_integer == u128);
try expect(struct_info.Struct.fields.len == 4);
try expect(struct_info.Struct.fields[0].alignment == 0);
- try expect(struct_info.Struct.fields[2].field_type == f32);
+ try expect(struct_info.Struct.fields[2].type == f32);
try expect(struct_info.Struct.fields[2].default_value == null);
try expect(@ptrCast(*align(1) const u32, struct_info.Struct.fields[3].default_value.?).* == 4);
try expect(struct_info.Struct.fields[3].alignment == 0);
@@ -365,7 +364,7 @@ fn testFunction() !void {
try expect(fn_info.Fn.alignment > 0);
try expect(fn_info.Fn.calling_convention == .C);
try expect(!fn_info.Fn.is_generic);
- try expect(fn_info.Fn.args.len == 2);
+ try expect(fn_info.Fn.params.len == 2);
try expect(fn_info.Fn.is_var_args);
try expect(fn_info.Fn.return_type.? == usize);
const fn_aligned_info = @typeInfo(@TypeOf(typeInfoFooAligned));
@@ -377,31 +376,31 @@ extern fn typeInfoFooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize
test "type info: generic function types" {
const G1 = @typeInfo(@TypeOf(generic1));
- try expect(G1.Fn.args.len == 1);
- try expect(G1.Fn.args[0].is_generic == true);
- try expect(G1.Fn.args[0].arg_type == null);
+ try expect(G1.Fn.params.len == 1);
+ try expect(G1.Fn.params[0].is_generic == true);
+ try expect(G1.Fn.params[0].type == null);
try expect(G1.Fn.return_type == void);
const G2 = @typeInfo(@TypeOf(generic2));
- try expect(G2.Fn.args.len == 3);
- try expect(G2.Fn.args[0].is_generic == false);
- try expect(G2.Fn.args[0].arg_type == type);
- try expect(G2.Fn.args[1].is_generic == true);
- try expect(G2.Fn.args[1].arg_type == null);
- try expect(G2.Fn.args[2].is_generic == false);
- try expect(G2.Fn.args[2].arg_type == u8);
+ try expect(G2.Fn.params.len == 3);
+ try expect(G2.Fn.params[0].is_generic == false);
+ try expect(G2.Fn.params[0].type == type);
+ try expect(G2.Fn.params[1].is_generic == true);
+ try expect(G2.Fn.params[1].type == null);
+ try expect(G2.Fn.params[2].is_generic == false);
+ try expect(G2.Fn.params[2].type == u8);
try expect(G2.Fn.return_type == void);
const G3 = @typeInfo(@TypeOf(generic3));
- try expect(G3.Fn.args.len == 1);
- try expect(G3.Fn.args[0].is_generic == true);
- try expect(G3.Fn.args[0].arg_type == null);
+ try expect(G3.Fn.params.len == 1);
+ try expect(G3.Fn.params[0].is_generic == true);
+ try expect(G3.Fn.params[0].type == null);
try expect(G3.Fn.return_type == null);
const G4 = @typeInfo(@TypeOf(generic4));
- try expect(G4.Fn.args.len == 1);
- try expect(G4.Fn.args[0].is_generic == true);
- try expect(G4.Fn.args[0].arg_type == null);
+ try expect(G4.Fn.params.len == 1);
+ try expect(G4.Fn.params[0].is_generic == true);
+ try expect(G4.Fn.params[0].type == null);
try expect(G4.Fn.return_type == null);
}
diff --git a/test/behavior/union.zig b/test/behavior/union.zig
index b6ec305eac..4200311e2c 100644
--- a/test/behavior/union.zig
+++ b/test/behavior/union.zig
@@ -454,7 +454,7 @@ test "global union with single field is correctly initialized" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
glbl = Foo1{
- .f = @typeInfo(Foo1).Union.fields[0].field_type{ .x = 123 },
+ .f = @typeInfo(Foo1).Union.fields[0].type{ .x = 123 },
};
try expect(glbl.f.x == 123);
}
diff --git a/test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig b/test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig
index abaff066ad..7951b4dec0 100644
--- a/test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig
+++ b/test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig
@@ -9,7 +9,7 @@ pub export fn entry() void {
const info = @typeInfo(Widget).Union;
inline for (info.fields) |field| {
if (foo()) {
- switch (field.field_type) {
+ switch (field.type) {
u0 => a = 2,
else => unreachable,
}
diff --git a/test/cases/compile_errors/dereference_anyopaque.zig b/test/cases/compile_errors/dereference_anyopaque.zig
index df58a11085..6dbbdfe1e2 100644
--- a/test/cases/compile_errors/dereference_anyopaque.zig
+++ b/test/cases/compile_errors/dereference_anyopaque.zig
@@ -16,7 +16,7 @@ fn parseFree(comptime T: type, value: T, allocator: std.mem.Allocator) void {
.Struct => |structInfo| {
inline for (structInfo.fields) |field| {
if (!field.is_comptime)
- parseFree(field.field_type, undefined, allocator);
+ parseFree(field.type, undefined, allocator);
}
},
.Pointer => |ptrInfo| {
diff --git a/test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig b/test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig
index 8c17e9100b..9f0fb6773d 100644
--- a/test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig
+++ b/test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig
@@ -1,6 +1,6 @@
export fn entry() void {
_ = @Type(.{ .Struct = .{ .layout = .Packed, .fields = &.{
- .{ .name = "one", .field_type = u4, .default_value = null, .is_comptime = false, .alignment = 2 },
+ .{ .name = "one", .type = u4, .default_value = null, .is_comptime = false, .alignment = 2 },
}, .decls = &.{}, .is_tuple = false } });
}
diff --git a/test/cases/compile_errors/reified_enum_field_value_overflow.zig b/test/cases/compile_errors/reified_enum_field_value_overflow.zig
index ad8596ebcc..d9f0e2057f 100644
--- a/test/cases/compile_errors/reified_enum_field_value_overflow.zig
+++ b/test/cases/compile_errors/reified_enum_field_value_overflow.zig
@@ -1,6 +1,5 @@
comptime {
const E = @Type(.{ .Enum = .{
- .layout = .Auto,
.tag_type = u1,
.fields = &.{
.{ .name = "f0", .value = 0 },
diff --git a/test/cases/compile_errors/reify_enum_with_duplicate_field.zig b/test/cases/compile_errors/reify_enum_with_duplicate_field.zig
index f8cadd9185..a4779b65ef 100644
--- a/test/cases/compile_errors/reify_enum_with_duplicate_field.zig
+++ b/test/cases/compile_errors/reify_enum_with_duplicate_field.zig
@@ -1,7 +1,6 @@
export fn entry() void {
_ = @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = u32,
.fields = &.{
.{ .name = "A", .value = 0 },
diff --git a/test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig b/test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig
index c3211fe301..b9be7cdaed 100644
--- a/test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig
+++ b/test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig
@@ -1,7 +1,6 @@
export fn entry() void {
_ = @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = u32,
.fields = &.{
.{ .name = "A", .value = 10 },
diff --git a/test/cases/compile_errors/reify_struct.zig b/test/cases/compile_errors/reify_struct.zig
index 1c6001ced6..42b8e42af5 100644
--- a/test/cases/compile_errors/reify_struct.zig
+++ b/test/cases/compile_errors/reify_struct.zig
@@ -3,7 +3,7 @@ comptime {
.layout = .Auto,
.fields = &.{.{
.name = "foo",
- .field_type = u32,
+ .type = u32,
.default_value = null,
.is_comptime = false,
.alignment = 4,
@@ -17,7 +17,7 @@ comptime {
.layout = .Auto,
.fields = &.{.{
.name = "3",
- .field_type = u32,
+ .type = u32,
.default_value = null,
.is_comptime = false,
.alignment = 4,
@@ -31,7 +31,7 @@ comptime {
.layout = .Auto,
.fields = &.{.{
.name = "0",
- .field_type = u32,
+ .type = u32,
.default_value = null,
.is_comptime = true,
.alignment = 4,
@@ -45,7 +45,7 @@ comptime {
.layout = .Extern,
.fields = &.{.{
.name = "0",
- .field_type = u32,
+ .type = u32,
.default_value = null,
.is_comptime = true,
.alignment = 4,
@@ -59,7 +59,7 @@ comptime {
.layout = .Packed,
.fields = &.{.{
.name = "0",
- .field_type = u32,
+ .type = u32,
.default_value = null,
.is_comptime = true,
.alignment = 4,
diff --git a/test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig b/test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig
index cf80c9f4ba..abdccdf36d 100644
--- a/test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig
+++ b/test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig
@@ -5,7 +5,7 @@ const Foo = @Type(.{
.is_generic = true,
.is_var_args = false,
.return_type = u0,
- .args = &.{},
+ .params = &.{},
},
});
comptime { _ = Foo; }
diff --git a/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig b/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig
index 8328ee9b97..f3542d583a 100644
--- a/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig
+++ b/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig
@@ -5,7 +5,7 @@ const Foo = @Type(.{
.is_generic = false,
.is_var_args = true,
.return_type = u0,
- .args = &.{},
+ .params = &.{},
},
});
comptime { _ = Foo; }
diff --git a/test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig b/test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig
index f6587dcd7e..49335ab693 100644
--- a/test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig
+++ b/test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig
@@ -5,7 +5,7 @@ const Foo = @Type(.{
.is_generic = false,
.is_var_args = false,
.return_type = null,
- .args = &.{},
+ .params = &.{},
},
});
comptime { _ = Foo; }
diff --git a/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig b/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig
index e72b783d83..60c6ce9a59 100644
--- a/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig
+++ b/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig
@@ -1,6 +1,5 @@
const Tag = @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = bool,
.fields = &.{},
.decls = &.{},
diff --git a/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig b/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig
index 1c237a17bd..896d689046 100644
--- a/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig
+++ b/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig
@@ -1,6 +1,5 @@
const Tag = @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = undefined,
.fields = &.{},
.decls = &.{},
diff --git a/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig b/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig
index ccd0000494..96da0752df 100644
--- a/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig
+++ b/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig
@@ -1,6 +1,5 @@
const Tag = @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = u2,
.fields = &.{
.{ .name = "signed", .value = 0 },
@@ -16,8 +15,8 @@ const Tagged = @Type(.{
.layout = .Auto,
.tag_type = Tag,
.fields = &.{
- .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
- .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
+ .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
+ .{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
},
.decls = &.{},
},
@@ -31,6 +30,6 @@ export fn entry() void {
// backend=stage2
// target=native
//
-// :14:16: error: enum field(s) missing in union
+// :13:16: error: enum field(s) missing in union
// :1:13: note: field 'arst' missing, declared here
// :1:13: note: enum declared here
diff --git a/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig b/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig
index 9d6170b9d0..559eb81fcd 100644
--- a/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig
+++ b/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig
@@ -1,6 +1,5 @@
const Tag = @Type(.{
.Enum = .{
- .layout = .Auto,
.tag_type = u1,
.fields = &.{
.{ .name = "signed", .value = 0 },
@@ -15,9 +14,9 @@ const Tagged = @Type(.{
.layout = .Auto,
.tag_type = Tag,
.fields = &.{
- .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
- .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
- .{ .name = "arst", .field_type = f32, .alignment = @alignOf(f32) },
+ .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
+ .{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
+ .{ .name = "arst", .type = f32, .alignment = @alignOf(f32) },
},
.decls = &.{},
},
@@ -31,5 +30,5 @@ export fn entry() void {
// backend=stage2
// target=native
//
-// :13:16: error: no field named 'arst' in enum 'tmp.Tag'
+// :12:16: error: no field named 'arst' in enum 'tmp.Tag'
// :1:13: note: enum declared here
diff --git a/test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig b/test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig
index aba11031a4..df70934871 100644
--- a/test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig
+++ b/test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig
@@ -3,7 +3,7 @@ const Untagged = @Type(.{
.layout = .Auto,
.tag_type = null,
.fields = &.{
- .{ .name = "foo", .field_type = opaque {}, .alignment = 1 },
+ .{ .name = "foo", .type = opaque {}, .alignment = 1 },
},
.decls = &.{},
},
@@ -17,4 +17,4 @@ export fn entry() usize {
// target=native
//
// :1:18: error: opaque types have unknown size and therefore cannot be directly embedded in unions
-// :6:45: note: opaque declared here
+// :6:39: note: opaque declared here
diff --git a/test/cases/fn_typeinfo_passed_to_comptime_fn.zig b/test/cases/fn_typeinfo_passed_to_comptime_fn.zig
index 29f1d0c67b..31673e5b81 100644
--- a/test/cases/fn_typeinfo_passed_to_comptime_fn.zig
+++ b/test/cases/fn_typeinfo_passed_to_comptime_fn.zig
@@ -9,7 +9,7 @@ fn someFn(arg: ?*c_int) f64 {
return 8;
}
fn foo(comptime info: std.builtin.Type) !void {
- try std.testing.expect(info.Fn.args[0].arg_type.? == ?*c_int);
+ try std.testing.expect(info.Fn.params[0].type.? == ?*c_int);
}
// run