diff --git a/src/codegen.cpp b/src/codegen.cpp index c533e66d61..e3f182e17c 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1790,7 +1790,8 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, IrExecutable *executable, assert(op1->value.type == op2->value.type || op_id == IrBinOpBitShiftLeftLossy || op_id == IrBinOpBitShiftLeftExact || op_id == IrBinOpBitShiftRightLossy || - op_id == IrBinOpBitShiftRightExact); + op_id == IrBinOpBitShiftRightExact || + (op1->value.type->id == TypeTableEntryIdErrorSet && op2->value.type->id == TypeTableEntryIdErrorSet)); TypeTableEntry *type_entry = op1->value.type; bool want_runtime_safety = bin_op_instruction->safety_check_on && diff --git a/src/ir.cpp b/src/ir.cpp index 3f3dfb1ad7..0f9020c9dc 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -7258,8 +7258,8 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod continue; } // unset all the errors - for (uint32_t i = 0; i < prev_err_set_type->data.error_set.err_count; i += 1) { - ErrorTableEntry *error_entry = prev_err_set_type->data.error_set.errors[i]; + for (uint32_t i = 0; i < err_set_type->data.error_set.err_count; i += 1) { + ErrorTableEntry *error_entry = err_set_type->data.error_set.errors[i]; errors[error_entry->value] = nullptr; } for (uint32_t i = 0; i < cur_err_set_type->data.error_set.err_count; i += 1) { @@ -7320,6 +7320,19 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod if (cur_type->id == TypeTableEntryIdErrorUnion && types_match_const_cast_only(ira, cur_type->data.error_union.payload_type, prev_type, source_node).id == ConstCastResultIdOk) { + if (err_set_type != nullptr) { + TypeTableEntry *cur_err_set_type = cur_type->data.error_union.err_set_type; + if (!resolve_inferred_error_set(ira, cur_err_set_type, cur_inst->source_node)) { + return ira->codegen->builtin_types.entry_invalid; + } + if (type_is_global_error_set(cur_err_set_type) || type_is_global_error_set(err_set_type)) { + err_set_type = ira->codegen->builtin_types.entry_global_error_set; + prev_inst = cur_inst; + continue; + } + + err_set_type = get_error_set_union(ira->codegen, errors, err_set_type, cur_err_set_type); + } prev_inst = cur_inst; continue; } diff --git a/std/debug/index.zig b/std/debug/index.zig index a759a2af16..2bb03a6706 100644 --- a/std/debug/index.zig +++ b/std/debug/index.zig @@ -264,7 +264,7 @@ pub fn openSelfDebugInfo(allocator: &mem.Allocator) !&ElfStackTrace { } } -fn printLineFromFile(allocator: &mem.Allocator, out_stream: &io.OutStream, line_info: &const LineInfo) !void { +fn printLineFromFile(allocator: &mem.Allocator, out_stream: var, line_info: &const LineInfo) !void { var f = try io.File.openRead(line_info.file_name, allocator); defer f.close(); // TODO fstat and make sure that the file has the correct size @@ -1054,7 +1054,7 @@ fn readULeb128(in_stream: var) !u64 { } } -fn readILeb128(in_stream: &io.InStream) !i64 { +fn readILeb128(in_stream: var) !i64 { var result: i64 = 0; var shift: usize = 0;