From 993197cd868f312d19ab694dd3a5250e39077f67 Mon Sep 17 00:00:00 2001 From: Robin Voetter Date: Fri, 17 Dec 2021 04:46:42 +0100 Subject: [PATCH] stage2: merged error sets in wrapErrorUnion --- src/Sema.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Sema.zig b/src/Sema.zig index a82a56c253..bdbdea42e7 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -13990,6 +13990,13 @@ fn wrapErrorUnion( if (data.errors.contains(expected_name)) break :ok; return sema.failWithErrorSetCodeMissing(block, inst_src, dest_err_set_ty, inst_ty); }, + .error_set_merged => { + const expected_name = val.castTag(.@"error").?.data.name; + const error_set = dest_err_set_ty.castTag(.error_set_merged).?.data; + if (!error_set.contains(expected_name)) { + return sema.failWithErrorSetCodeMissing(block, inst_src, dest_err_set_ty, inst_ty); + } + }, else => unreachable, } return sema.addConstant(dest_ty, val);