| ... | ... | @@ -9361,6 +9361,15 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 9361 | 9361 | ir_add_error_node(ira, source_node, buf_sprintf("operator not allowed for errors")); |
| 9362 | 9362 | return ira->codegen->builtin_types.entry_invalid; |
| 9363 | 9363 | } |
| 9364 | TypeTableEntry *intersect_type = get_error_set_intersection(ira, op1->value.type, op2->value.type, source_node); |
| 9365 | if (type_is_invalid(intersect_type)) { |
| 9366 | return ira->codegen->builtin_types.entry_invalid; |
| 9367 | } |
| 9368 | |
| 9369 | if (!resolve_inferred_error_set(ira, intersect_type, source_node)) { |
| 9370 | return ira->codegen->builtin_types.entry_invalid; |
| 9371 | } |
| 9372 | |
| 9364 | 9373 | // exception if one of the operators has the type of the empty error set, we allow the comparison |
| 9365 | 9374 | // (and make it comptime known) |
| 9366 | 9375 | // this is a function which is evaluated at comptime and returns an inferred error set will have an empty |
| ... | ... | @@ -9379,14 +9388,6 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 9379 | 9388 | out_val->data.x_bool = answer; |
| 9380 | 9389 | return ira->codegen->builtin_types.entry_bool; |
| 9381 | 9390 | } |
| 9382 | | TypeTableEntry *intersect_type = get_error_set_intersection(ira, op1->value.type, op2->value.type, source_node); |
| 9383 | | if (type_is_invalid(intersect_type)) { |
| 9384 | | return ira->codegen->builtin_types.entry_invalid; |
| 9385 | | } |
| 9386 | | |
| 9387 | | if (!resolve_inferred_error_set(ira, intersect_type, source_node)) { |
| 9388 | | return ira->codegen->builtin_types.entry_invalid; |
| 9389 | | } |
| 9390 | 9391 | |
| 9391 | 9392 | if (!type_is_global_error_set(intersect_type)) { |
| 9392 | 9393 | if (intersect_type->data.error_set.err_count == 0) { |
| ... | ... | @@ -10940,6 +10941,11 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 10940 | 10941 | if (inferred_err_set_type != nullptr) { |
| 10941 | 10942 | inferred_err_set_type->data.error_set.infer_fn = nullptr; |
| 10942 | 10943 | if (result->value.type->id == TypeTableEntryIdErrorUnion) { |
| 10944 | if (result->value.data.x_err_union.err != nullptr) { |
| 10945 | inferred_err_set_type->data.error_set.err_count = 1; |
| 10946 | inferred_err_set_type->data.error_set.errors = allocate<ErrorTableEntry *>(1); |
| 10947 | inferred_err_set_type->data.error_set.errors[0] = result->value.data.x_err_union.err; |
| 10948 | } |
| 10943 | 10949 | TypeTableEntry *fn_inferred_err_set_type = result->value.type->data.error_union.err_set_type; |
| 10944 | 10950 | inferred_err_set_type->data.error_set.err_count = fn_inferred_err_set_type->data.error_set.err_count; |
| 10945 | 10951 | inferred_err_set_type->data.error_set.errors = fn_inferred_err_set_type->data.error_set.errors; |