mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
Sema: check for astgen failures in semaStructFields
The struct might be a top level struct in which case it might not have Zir. Closes #12548
This commit is contained in:
+18
-1
@@ -184,7 +184,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
}
|
||||
|
||||
{
|
||||
const case = ctx.obj("argument causes error ", .{});
|
||||
const case = ctx.obj("argument causes error", .{});
|
||||
case.backend = .stage2;
|
||||
|
||||
case.addSourceFile("b.zig",
|
||||
@@ -208,6 +208,23 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
const case = ctx.obj("astgen failure in file struct", .{});
|
||||
case.backend = .stage2;
|
||||
|
||||
case.addSourceFile("b.zig",
|
||||
\\bad
|
||||
);
|
||||
|
||||
case.addError(
|
||||
\\pub export fn entry() void {
|
||||
\\ _ = (@sizeOf(@import("b.zig")));
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
":1:1: error: struct field missing type",
|
||||
});
|
||||
}
|
||||
|
||||
// TODO test this in stage2, but we won't even try in stage1
|
||||
//ctx.objErrStage1("inline fn calls itself indirectly",
|
||||
// \\export fn foo() void {
|
||||
|
||||
Reference in New Issue
Block a user