From 44dfeb621de3b89a9340e0e9788a7eedacb7745c Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Mon, 5 Dec 2022 16:23:00 +0100 Subject: [PATCH] Fix body arguments: (@foo(;int x) and mismatch on canonical types) --- src/compiler/parse_expr.c | 2 +- src/compiler/sema_expr.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/parse_expr.c b/src/compiler/parse_expr.c index b5d38395e..bf117bda0 100644 --- a/src/compiler/parse_expr.c +++ b/src/compiler/parse_expr.c @@ -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); diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index d7b09f7a7..5c55e34a5 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -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; }