| author | |
| committer | |
| log | 98a01f99c9b6834608055417169c2b3531ea67b6 |
| tree | ee920753881775df052875b2029ad8eca2e934d5 |
| parent | e5d4a694ea7dd251e10d6434c9321b5e0a548d4b |
2 files changed, 9 insertions(+), 1 deletions(-)
src/Sema.zig+1-1| ... | @@ -18910,7 +18910,7 @@ fn resolvePeerTypes( | ... | @@ -18910,7 +18910,7 @@ fn resolvePeerTypes( |
| 18910 | } | 18910 | } |
| 18911 | 18911 | ||
| 18912 | const chosen_set_ty = err_set_ty orelse chosen_ty.errorUnionSet(); | 18912 | const chosen_set_ty = err_set_ty orelse chosen_ty.errorUnionSet(); |
| 18913 | const candidate_set_ty = chosen_ty.errorUnionSet(); | 18913 | const candidate_set_ty = candidate_ty.errorUnionSet(); |
| 18914 | 18914 | ||
| 18915 | if (.ok == try sema.coerceInMemoryAllowedErrorSets(block, chosen_set_ty, candidate_set_ty, src, src)) { | 18915 | if (.ok == try sema.coerceInMemoryAllowedErrorSets(block, chosen_set_ty, candidate_set_ty, src, src)) { |
| 18916 | err_set_ty = chosen_set_ty; | 18916 | err_set_ty = chosen_set_ty; |
test/behavior/error.zig+8| ... | @@ -626,3 +626,11 @@ test "inferred error set equality" { | ... | @@ -626,3 +626,11 @@ test "inferred error set equality" { |
| 626 | try expect(BarError == BarError); | 626 | try expect(BarError == BarError); |
| 627 | try expect(BazError == BazError); | 627 | try expect(BazError == BazError); |
| 628 | } | 628 | } |
| 629 | |||
| 630 | test "peer type resolution of two different error unions" { | ||
| 631 | const a: error{B}!void = {}; | ||
| 632 | const b: error{A}!void = {}; | ||
| 633 | var cond = true; | ||
| 634 | const err = if (cond) a else b; | ||
| 635 | try err; | ||
| 636 | } |