zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit a049c31f2184895c731636b6f71c5743200d64fc (tree)
parent e919744c7ad2b224bef00ffc35ccacbe31a0aae7
Author: Tadeo Kondrak <me@tadeo.ca>
Date:   Fri, 21 Aug 2020 14:37:50 -0600

Remove TypeInfo.Error.value

Diffstat:
Mlib/std/builtin.zig | 2--
Msrc/ir.cpp | 5+----
Mtest/stage1/behavior/type_info.zig | 1-
3 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig @@ -289,8 +289,6 @@ pub const TypeInfo = union(enum) { /// therefore must be kept in sync with the compiler implementation. pub const Error = struct { name: []const u8, - /// This field is ignored when using @Type(). - value: comptime_int, }; /// This data structure is used by the Zig language code generation and diff --git a/src/ir.cpp b/src/ir.cpp @@ -25494,9 +25494,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy error_val->special = ConstValSpecialStatic; error_val->type = type_info_error_type; - ZigValue **inner_fields = alloc_const_vals_ptrs(ira->codegen, 2); - inner_fields[1]->special = ConstValSpecialStatic; - inner_fields[1]->type = ira->codegen->builtin_types.entry_num_lit_int; + ZigValue **inner_fields = alloc_const_vals_ptrs(ira->codegen, 1); ZigValue *name = nullptr; if (error->cached_error_name_val != nullptr) @@ -25504,7 +25502,6 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy if (name == nullptr) name = create_const_str_lit(ira->codegen, &error->name)->data.x_ptr.data.ref.pointee; init_const_slice(ira->codegen, inner_fields[0], name, 0, buf_len(&error->name), true); - bigint_init_unsigned(&inner_fields[1]->data.x_bigint, error->value); error_val->data.x_struct.fields = inner_fields; error_val->parent.id = ConstParentIdArray; diff --git a/test/stage1/behavior/type_info.zig b/test/stage1/behavior/type_info.zig @@ -153,7 +153,6 @@ fn testErrorSet() void { expect(error_set_info == .ErrorSet); expect(error_set_info.ErrorSet.?.len == 3); expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "First")); - expect(error_set_info.ErrorSet.?[2].value == @errorToInt(TestErrorSet.Third)); const error_union_info = @typeInfo(TestErrorSet!usize); expect(error_union_info == .ErrorUnion);