From ed196666879cbb0824874c3955f40b398f1594c0 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Tue, 10 Jan 2023 00:32:57 +0100 Subject: [PATCH] Improve non matching func => fptr message --- src/lib/closure.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) { -- 2.43.0