From be52ca3879b6857e905074b541af3b39897f8719 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Wed, 21 Nov 2012 20:53:00 +0100 Subject: [PATCH] More verbose error for invalid parameter types --- ast.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ast.c b/ast.c index b1ceb1c..f6a5d87 100644 --- a/ast.c +++ b/ast.c @@ -783,8 +783,12 @@ bool ast_call_check_types(ast_call *self) for (i = 0; i < count; ++i) { if (!ast_compare_type(self->params[i], (ast_expression*)(func->expression.params[i]))) { - asterror(ast_ctx(self), "invalid type for parameter %u in function call", - (unsigned int)(i+1)); + char texp[1024]; + char tgot[1024]; + ast_type_to_string(self->params[i], tgot, sizeof(tgot)); + ast_type_to_string((ast_expression*)func->expression.params[i], texp, sizeof(texp)); + asterror(ast_ctx(self), "invalid type for parameter %u in function call: expected %s, got %s", + (unsigned int)(i+1), texp, tgot); /* we don't immediately return */ retval = false; } -- 2.39.2