aboutsummaryrefslogtreecommitdiff
path: root/test/cases/error.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/cases/error.zig')
-rw-r--r--test/cases/error.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/cases/error.zig b/test/cases/error.zig
index 3d2835e723..a8150620b2 100644
--- a/test/cases/error.zig
+++ b/test/cases/error.zig
@@ -123,3 +123,14 @@ fn testExplicitErrorSetCast(set1: Set1) void {
var y = Set1(x);
assert(y == error.A);
}
+
+test "comptime test error for empty error set" {
+ testComptimeTestErrorEmptySet(1234);
+ comptime testComptimeTestErrorEmptySet(1234);
+}
+
+const EmptyErrorSet = error {};
+
+fn testComptimeTestErrorEmptySet(x: EmptyErrorSet!i32) void {
+ if (x) |v| assert(v == 1234) else |err| @compileError("bad");
+}