authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-07 22:24:52-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-07 22:24:52-07:00
log759591577518fcaf03fb90efca67d896d0806458
tree6bf1b773c35cb0f6c124f3ec350479723bbdca69
parent57aa289fdef543a507d8da039f5b7e7f2762c878

stage2: add remaining enum compile error test cases


1 files changed, 20 insertions(+), 0 deletions(-)

test/stage2/cbe.zig+20
......@@ -763,6 +763,26 @@ pub fn addCases(ctx: *TestContext) !void {
763763 ":4:5: error: '_' prong only allowed when switching on non-exhaustive enums",
764764 ":7:11: note: '_' prong here",
765765 });
766
767 case.addError(
768 \\const E = enum { a, b, c };
769 \\export fn foo() void {
770 \\ var x = E.d;
771 \\}
772 , &.{
773 ":3:14: error: enum 'E' has no member named 'd'",
774 ":1:11: note: enum declared here",
775 });
776
777 case.addError(
778 \\const E = enum { a, b, c };
779 \\export fn foo() void {
780 \\ var x: E = .d;
781 \\}
782 , &.{
783 ":3:17: error: enum 'E' has no field named 'd'",
784 ":1:11: note: enum declared here",
785 });
766786 }
767787
768788 ctx.c("empty start function", linux_x64,