Fix body arguments: (@foo(;int x) and mismatch on canonical types)

This commit is contained in:
Christoffer Lerno
2022-12-05 16:23:00 +01:00
parent eb87eb1987
commit 44dfeb621d
2 changed files with 4 additions and 4 deletions

View File

@@ -719,7 +719,7 @@ static Expr *parse_call_expr(ParseContext *c, Expr *left)
advance_and_verify(c, TOKEN_LPAREN);
bool splat = false;
Decl **body_args = NULL;
if (!tok_is(c, TOKEN_RPAREN))
if (!tok_is(c, TOKEN_RPAREN) && !tok_is(c, TOKEN_EOS))
{
// Pick a modest guess.
params = VECNEW(Expr*, 4);

View File

@@ -1676,10 +1676,10 @@ bool sema_expr_analyse_macro_call(SemaContext *context, Expr *call_expr, Expr *s
if (body_param->var.type_info)
{
Type *declare_type = body_param->var.type_info->type->canonical;
if (declare_type != body_arg->type)
if (declare_type != body_arg->type->canonical)
{
SEMA_ERROR(body_arg->var.type_info, "This parameter should be '%s' but was '%s'",
type_to_error_string(declare_type),
SEMA_ERROR(body_arg->var.type_info, "This parameter should be %s but was %s",
type_quoted_error_string(declare_type),
type_quoted_error_string(body_arg->type));
return false;
}