mirror of
https://github.com/ziglang/zig.git
synced 2025-12-25 07:33:08 +00:00
stage1: fix unresolved inferred error sets
This commit is contained in:
parent
557d75d58a
commit
250dd9ac21
12
src/ir.cpp
12
src/ir.cpp
@ -18177,12 +18177,6 @@ static IrInstGen *ir_analyze_instruction_merge_err_sets(IrAnalyze *ira,
|
||||
if (type_is_invalid(op2_type))
|
||||
return ira->codegen->invalid_inst_gen;
|
||||
|
||||
if (type_is_global_error_set(op1_type) ||
|
||||
type_is_global_error_set(op2_type))
|
||||
{
|
||||
return ir_const_type(ira, &instruction->base.base, ira->codegen->builtin_types.entry_global_error_set);
|
||||
}
|
||||
|
||||
if (!resolve_inferred_error_set(ira->codegen, op1_type, instruction->op1->child->base.source_node)) {
|
||||
return ira->codegen->invalid_inst_gen;
|
||||
}
|
||||
@ -18191,6 +18185,12 @@ static IrInstGen *ir_analyze_instruction_merge_err_sets(IrAnalyze *ira,
|
||||
return ira->codegen->invalid_inst_gen;
|
||||
}
|
||||
|
||||
if (type_is_global_error_set(op1_type) ||
|
||||
type_is_global_error_set(op2_type))
|
||||
{
|
||||
return ir_const_type(ira, &instruction->base.base, ira->codegen->builtin_types.entry_global_error_set);
|
||||
}
|
||||
|
||||
size_t errors_count = ira->codegen->errors_by_index.length;
|
||||
ErrorTableEntry **errors = heap::c_allocator.allocate<ErrorTableEntry *>(errors_count);
|
||||
for (uint32_t i = 0, count = op1_type->data.error_set.err_count; i < count; i += 1) {
|
||||
|
||||
@ -50,6 +50,7 @@ comptime {
|
||||
_ = @import("behavior/bugs/4769_b.zig");
|
||||
_ = @import("behavior/bugs/4769_c.zig");
|
||||
_ = @import("behavior/bugs/4954.zig");
|
||||
_ = @import("behavior/bugs/5487.zig");
|
||||
_ = @import("behavior/bugs/394.zig");
|
||||
_ = @import("behavior/bugs/421.zig");
|
||||
_ = @import("behavior/bugs/529.zig");
|
||||
|
||||
12
test/stage1/behavior/bugs/5487.zig
Normal file
12
test/stage1/behavior/bugs/5487.zig
Normal file
@ -0,0 +1,12 @@
|
||||
const io = @import("std").io;
|
||||
|
||||
pub fn write(_: void, bytes: []const u8) !usize {
|
||||
return 0;
|
||||
}
|
||||
pub fn outStream() io.OutStream(void, @TypeOf(write).ReturnType.ErrorSet, write) {
|
||||
return io.OutStream(void, @TypeOf(write).ReturnType.ErrorSet, write){ .context = {} };
|
||||
}
|
||||
|
||||
test "crash" {
|
||||
_ = io.multiOutStream(.{outStream()});
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user