From: fennecdjay Date: Mon, 9 Jan 2023 23:32:57 +0000 (+0100) Subject: Improve non matching func => fptr message X-Git-Tag: nightly~207^2~14 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=ed196666879cbb0824874c3955f40b398f1594c0;p=gwion.git Improve non matching func => fptr message --- diff --git a/src/lib/closure.c b/src/lib/closure.c index bf880f0d..27fc4a12 100644 --- a/src/lib/closure.c +++ b/src/lib/closure.c @@ -70,7 +70,13 @@ static OP_CHECK(opck_func_call) { static OP_CHECK(opck_fptr_call) { Exp_Binary *bin = (Exp_Binary *)data; - return mk_call(env, exp_self(bin), bin->rhs, bin->lhs); + const Type t = mk_call(env, exp_self(bin), bin->rhs, bin->lhs); + if (t == env->gwion->type[et_error]) { + gwerr_basic("no matching argument of funptr call", "invalid call", "did you mean to use {+}:=>{0}", env->name, exp_self(bin)->pos, 0); + env->context->error = true; + return env->gwion->type[et_error]; + } + return t; } ANN Type upvalue_type(const Env env, Capture *cap) {