Sema: analyzeInlineCallArg needs a block for the arg and the param

This commit is contained in:
Veikka Tuominen
2022-07-25 13:48:21 +03:00
parent 370793a36b
commit 2f34d06d01
3 changed files with 58 additions and 22 deletions

View File

@@ -183,6 +183,30 @@ pub fn addCases(ctx: *TestContext) !void {
});
}
{
const case = ctx.obj("argument causes error ", .{});
case.backend = .stage2;
case.addSourceFile("b.zig",
\\pub const ElfDynLib = struct {
\\ pub fn lookup(self: *ElfDynLib, comptime T: type) ?T {
\\ _ = self;
\\ return undefined;
\\ }
\\};
);
case.addError(
\\pub export fn entry() void {
\\ var lib: @import("b.zig").ElfDynLib = undefined;
\\ _ = lib.lookup(fn () void);
\\}
, &[_][]const u8{
":3:12: error: unable to resolve comptime value",
":3:12: note: argument to function being called at comptime must be comptime known",
});
}
// TODO test this in stage2, but we won't even try in stage1
//ctx.objErrStage1("inline fn calls itself indirectly",
// \\export fn foo() void {