Commit 7595915775

Andrew Kelley <andrew@ziglang.org>
2021-04-08 07:24:52
stage2: add remaining enum compile error test cases
1 parent 57aa289
Changed files (1)
test
stage2
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,