mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Improve error message for clash between variable and function name
The previous error message was very cryptic and led to an abort. Fixes GH-1832
This commit is contained in:
parent
7a6501296b
commit
e1dc09e230
1 changed files with 7 additions and 1 deletions
|
@ -618,8 +618,14 @@ void begin_func(IDPtr id, const char* module_name, FunctionFlavor flavor, bool i
|
|||
std::optional<FuncType::Prototype> prototype;
|
||||
|
||||
if ( id->GetType() )
|
||||
{
|
||||
if ( id->GetType()->Tag() != TYPE_FUNC )
|
||||
{
|
||||
id->Error("Function clash with previous definition with incompatible type", t.get());
|
||||
reporter->FatalError("invalid definition of '%s' (see previous errors)", id->Name());
|
||||
}
|
||||
prototype = get_prototype(id, t);
|
||||
|
||||
}
|
||||
else if ( is_redef )
|
||||
id->Error("redef of not-previously-declared value");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue