From 10b8171466f6a2572cea0b8e70eba33be0020ac2 Mon Sep 17 00:00:00 2001 From: Robin Voetter Date: Sun, 8 Oct 2023 21:21:15 +0200 Subject: [PATCH] spirv: handle errors in switch --- src/codegen/spirv.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 6fff39f951..bb2fe4219c 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -3924,6 +3924,7 @@ const DeclGen = struct { }; break :blk if (backing_bits <= 32) @as(u32, 1) else 2; }, + .ErrorSet => 1, else => return self.todo("implement switch for type {s}", .{@tagName(cond_ty.zigTypeTag(mod))}), // TODO: Figure out which types apply here, and work around them as we can only do integers. }; @@ -3977,6 +3978,7 @@ const DeclGen = struct { // TODO: figure out of cond_ty is correct (something with enum literals) break :blk (try value.intFromEnum(cond_ty, mod)).toUnsignedInt(mod); // TODO: composite integer constants }, + .ErrorSet => value.getErrorInt(mod), else => unreachable, }; const int_lit: spec.LiteralContextDependentNumber = switch (cond_words) {