GH-1211: Improve error message for already-defined functions

This commit is contained in:
Jon Siwek 2020-10-12 16:19:19 -07:00
parent b73cc816e9
commit 8c85f2135e
3 changed files with 18 additions and 1 deletions

View file

@ -583,7 +583,7 @@ void begin_func(IDPtr id, const char* module_name,
case FUNC_FLAVOR_FUNCTION:
if ( ! id->IsRedefinable() )
id->Error("already defined");
id->Error("already defined", t.get());
break;
default:
@ -594,6 +594,10 @@ void begin_func(IDPtr id, const char* module_name,
else
id->SetType(t);
if ( IsErrorType(id->GetType()->Tag()) )
reporter->FatalError("invalid definition of '%s' (see previous errors)",
id->Name());
const auto& args = t->Params();
const auto& canon_args = id->GetType()->AsFuncType()->Params();