authorgravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-08-21 14:37:50-06:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-22 03:20:12-04:00
loga049c31f2184895c731636b6f71c5743200d64fc
tree22da0c2f0538fae98526925db835091c2f54ee7d
parente919744c7ad2b224bef00ffc35ccacbe31a0aae7

Remove TypeInfo.Error.value


3 files changed, 1 insertions(+), 7 deletions(-)

lib/std/builtin.zig-2
...@@ -289,8 +289,6 @@ pub const TypeInfo = union(enum) {...@@ -289,8 +289,6 @@ pub const TypeInfo = union(enum) {
289 /// therefore must be kept in sync with the compiler implementation.289 /// therefore must be kept in sync with the compiler implementation.
290 pub const Error = struct {290 pub const Error = struct {
291 name: []const u8,291 name: []const u8,
292 /// This field is ignored when using @Type().
293 value: comptime_int,
294 };292 };
295293
296 /// This data structure is used by the Zig language code generation and294 /// This data structure is used by the Zig language code generation and
src/ir.cpp+1-4
...@@ -25494,9 +25494,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy...@@ -25494,9 +25494,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy
25494 error_val->special = ConstValSpecialStatic;25494 error_val->special = ConstValSpecialStatic;
25495 error_val->type = type_info_error_type;25495 error_val->type = type_info_error_type;
2549625496
25497 ZigValue **inner_fields = alloc_const_vals_ptrs(ira->codegen, 2);25497 ZigValue **inner_fields = alloc_const_vals_ptrs(ira->codegen, 1);
25498 inner_fields[1]->special = ConstValSpecialStatic;
25499 inner_fields[1]->type = ira->codegen->builtin_types.entry_num_lit_int;
2550025498
25501 ZigValue *name = nullptr;25499 ZigValue *name = nullptr;
25502 if (error->cached_error_name_val != nullptr)25500 if (error->cached_error_name_val != nullptr)
...@@ -25504,7 +25502,6 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy...@@ -25504,7 +25502,6 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy
25504 if (name == nullptr)25502 if (name == nullptr)
25505 name = create_const_str_lit(ira->codegen, &error->name)->data.x_ptr.data.ref.pointee;25503 name = create_const_str_lit(ira->codegen, &error->name)->data.x_ptr.data.ref.pointee;
25506 init_const_slice(ira->codegen, inner_fields[0], name, 0, buf_len(&error->name), true);25504 init_const_slice(ira->codegen, inner_fields[0], name, 0, buf_len(&error->name), true);
25507 bigint_init_unsigned(&inner_fields[1]->data.x_bigint, error->value);
2550825505
25509 error_val->data.x_struct.fields = inner_fields;25506 error_val->data.x_struct.fields = inner_fields;
25510 error_val->parent.id = ConstParentIdArray;25507 error_val->parent.id = ConstParentIdArray;
test/stage1/behavior/type_info.zig-1
...@@ -153,7 +153,6 @@ fn testErrorSet() void {...@@ -153,7 +153,6 @@ fn testErrorSet() void {
153 expect(error_set_info == .ErrorSet);153 expect(error_set_info == .ErrorSet);
154 expect(error_set_info.ErrorSet.?.len == 3);154 expect(error_set_info.ErrorSet.?.len == 3);
155 expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "First"));155 expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "First"));
156 expect(error_set_info.ErrorSet.?[2].value == @errorToInt(TestErrorSet.Third));
157156
158 const error_union_info = @typeInfo(TestErrorSet!usize);157 const error_union_info = @typeInfo(TestErrorSet!usize);
159 expect(error_union_info == .ErrorUnion);158 expect(error_union_info == .ErrorUnion);