aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-04-07 22:24:52 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-04-07 22:24:52 -0700
commit759591577518fcaf03fb90efca67d896d0806458 (patch)
tree6bf1b773c35cb0f6c124f3ec350479723bbdca69
parent57aa289fdef543a507d8da039f5b7e7f2762c878 (diff)
downloadzig-759591577518fcaf03fb90efca67d896d0806458.tar.gz
zig-759591577518fcaf03fb90efca67d896d0806458.zip
stage2: add remaining enum compile error test cases
-rw-r--r--test/stage2/cbe.zig20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig
index 1f590e2c47..02c1e3d333 100644
--- a/test/stage2/cbe.zig
+++ b/test/stage2/cbe.zig
@@ -763,6 +763,26 @@ pub fn addCases(ctx: *TestContext) !void {
":4:5: error: '_' prong only allowed when switching on non-exhaustive enums",
":7:11: note: '_' prong here",
});
+
+ case.addError(
+ \\const E = enum { a, b, c };
+ \\export fn foo() void {
+ \\ var x = E.d;
+ \\}
+ , &.{
+ ":3:14: error: enum 'E' has no member named 'd'",
+ ":1:11: note: enum declared here",
+ });
+
+ case.addError(
+ \\const E = enum { a, b, c };
+ \\export fn foo() void {
+ \\ var x: E = .d;
+ \\}
+ , &.{
+ ":3:17: error: enum 'E' has no field named 'd'",
+ ":1:11: note: enum declared here",
+ });
}
ctx.c("empty start function", linux_x64,