From 455525a099c748fd1fb96a1575bdc9160c3054ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sat, 3 Apr 2021 01:47:29 +0200 Subject: [PATCH] :art: Improve missing impl error --- src/parse/check.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/parse/check.c b/src/parse/check.c index 6133d0dd..841dbb35 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1368,10 +1368,22 @@ ANN static m_bool cdef_parent(const Env env, const Class_Def cdef) { ANN m_bool check_abstract(const Env env, const Class_Def cdef) { if(!cdef->base.type->nspc->info->vtable.ptr) return GW_OK; + bool err = false; for(m_uint i = 0; i < vector_size(&cdef->base.type->nspc->info->vtable); ++i) { Func f = (Func)vector_at(&cdef->base.type->nspc->info->vtable, i); - if(GET_FLAG(f->def->base, abstract)) - ERR_B(cdef->pos, _("'%s' must be declared 'abstract'"), s_name(cdef->base.xid)) + if(GET_FLAG(f->def->base, abstract)) { + if(!err) { + err = true; + gwerr_basic( + _("missing function definition"), + _("must be declared 'abstract'"), + _("provide an implementation for the following:"), + env->name, cdef->pos, 0); + } + struct ValueFrom_ *from = f->value_ref->from; + gwerr_secondary("implementation missing", from->filename, from->loc); + env->context->error = true; + } } return GW_OK; } -- 2.43.0