AstGen: add check for missing builtin argument

Closes #13817
This commit is contained in:
Veikka Tuominen 2022-12-08 19:28:01 +02:00 committed by Andrew Kelley
parent b483c796c6
commit 5831b68341
2 changed files with 17 additions and 0 deletions

View File

@ -9098,6 +9098,8 @@ fn nodeMayNeedMemoryLocation(tree: *const Ast, start_node: Ast.Node.Index, have_
.always => return true,
.forward1 => node = node_datas[node].rhs,
}
// Missing builtin arg is not a parsing error, expect an error later.
if (node == 0) return false;
},
.builtin_call, .builtin_call_comma => {
@ -9112,6 +9114,8 @@ fn nodeMayNeedMemoryLocation(tree: *const Ast, start_node: Ast.Node.Index, have_
.always => return true,
.forward1 => node = params[1],
}
// Missing builtin arg is not a parsing error, expect an error later.
if (node == 0) return false;
},
}
}

View File

@ -0,0 +1,13 @@
comptime {
const v = @as();
}
comptime {
const u = @bitCast(u32);
}
// error
// backend=stage2
// target=native
//
// :2:15: error: expected 2 arguments, found 0
// :5:15: error: expected 2 arguments, found 1