stage1: fix exporting enums
After extern enums were removed, stage1 was left in an incorrect state of checking for `extern enum` for exported enums. This commit fixes it to look for an explicit integer tag type instead, and adds test coverage for the compile error case as well as the success case. closes #9498
This commit is contained in:
@@ -23,6 +23,20 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
});
|
||||
}
|
||||
|
||||
ctx.objErrStage1("exported enum without explicit integer tag type",
|
||||
\\const E = enum { one, two };
|
||||
\\comptime {
|
||||
\\ @export(E, .{ .name = "E" });
|
||||
\\}
|
||||
\\const e: E = .two;
|
||||
\\comptime {
|
||||
\\ @export(e, .{ .name = "e" });
|
||||
\\}
|
||||
, &.{
|
||||
"tmp.zig:3:13: error: exported enum without explicit integer tag type",
|
||||
"tmp.zig:7:13: error: exported enum value without explicit integer tag type",
|
||||
});
|
||||
|
||||
ctx.objErrStage1("issue #9346: return outside of function scope",
|
||||
\\pub const empty = return 1;
|
||||
, &.{"tmp.zig:1:19: error: 'return' outside function scope"});
|
||||
|
||||
Reference in New Issue
Block a user