aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTechatrix <19954306+Techatrix@users.noreply.github.com>2024-01-16 05:46:31 +0100
committerTechatrix <19954306+Techatrix@users.noreply.github.com>2024-01-16 05:55:26 +0100
commit8b9425c248a36afc9cd4f76707b61553b577ce14 (patch)
tree5b2303610b1e05f71986eb03bc196ebe21f6cc93 /src
parent32e88251e48d9f4a412b08acbd04d5694ec91e19 (diff)
downloadzig-8b9425c248a36afc9cd4f76707b61553b577ce14.tar.gz
zig-8b9425c248a36afc9cd4f76707b61553b577ce14.zip
AstGen: add error message for capture error by ref in switch on error
Diffstat (limited to 'src')
-rw-r--r--src/AstGen.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig
index b32ee67b0a..3956af2ddb 100644
--- a/src/AstGen.zig
+++ b/src/AstGen.zig
@@ -7219,7 +7219,9 @@ fn switchExprErrUnion(
};
const capture_token = case.payload_token orelse break :blk &err_scope.base;
- assert(token_tags[capture_token] == .identifier);
+ if (token_tags[capture_token] != .identifier) {
+ return astgen.failTok(capture_token + 1, "error set cannot be captured by reference", .{});
+ }
const capture_slice = tree.tokenSlice(capture_token);
if (mem.eql(u8, capture_slice, "_")) {