From a049c31f2184895c731636b6f71c5743200d64fc Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Fri, 21 Aug 2020 14:37:50 -0600 Subject: [PATCH] Remove TypeInfo.Error.value --- lib/std/builtin.zig | 2 -- src/ir.cpp | 5 +---- test/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 index 919f45e730..3d103d6d06 100644 --- 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 index 976c50b8ff..8d65b91021 100644 --- 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 index ab26558c04..d0da8815f7 100644 --- 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);