From 96224a7d8f940773dbd3c6d00fd90be0d51e24ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Wed, 30 Dec 2020 22:57:08 +0100 Subject: [PATCH] :art: Improve operator definition --- src/parse/check.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/parse/check.c b/src/parse/check.c index f4985edc..8c62044e 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1202,7 +1202,10 @@ ANN static m_bool check_func_overload(const Env env, const Func_Def fdef) { const Func f1 = get_overload(env, fdef, i); for(m_uint j = i + 1; f1 && j <= v->from->offset; ++j) { const Func f2 = get_overload(env, fdef, j); - if(f2 && compat_func(f1->def, f2->def) > 0) + if(f2 && compat_func(f1->def, f2->def) > 0 && + fbflag(f1->def->base, fbflag_op) == fbflag(f2->def->base, fbflag_op) && + fbflag(f1->def->base, fbflag_unary) == fbflag(f2->def->base, fbflag_unary) && + fbflag(f1->def->base, fbflag_postfix) == fbflag(f2->def->base, fbflag_postfix)) ERR_B(f2->def->base->td->pos, _("global function '%s' already defined" " for those arguments"), s_name(fdef->base->xid)) } -- 2.43.0