mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/gh-1211-improve-already-defined-error' into master
* origin/topic/jsiwek/gh-1211-improve-already-defined-error: GH-1211: Improve error message for already-defined functions
This commit is contained in:
commit
5f1ee35d31
5 changed files with 23 additions and 2 deletions
4
CHANGES
4
CHANGES
|
@ -1,4 +1,8 @@
|
|||
|
||||
3.3.0-dev.426 | 2020-10-14 10:47:37 -0700
|
||||
|
||||
* GH-1211: Improve error message for already-defined functions (Jon Siwek, Corelight)
|
||||
|
||||
3.3.0-dev.422 | 2020-10-13 16:26:24 -0700
|
||||
|
||||
* GH-1208: Use Dictionary validity assertions only during CI (Jon Siwek, Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
3.3.0-dev.422
|
||||
3.3.0-dev.426
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
error in /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.function-already-defined/function-already-defined.zeek, line 4 and /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.function-already-defined/function-already-defined.zeek, line 7: already defined (foo)
|
||||
fatal error in /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.function-already-defined/function-already-defined.zeek, line 8: invalid definition of 'foo' (see previous errors)
|
11
testing/btest/language/function-already-defined.zeek
Normal file
11
testing/btest/language/function-already-defined.zeek
Normal file
|
@ -0,0 +1,11 @@
|
|||
# @TEST-EXEC-FAIL: zeek -b %INPUT >out 2>&1
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||
|
||||
function foo(a: string)
|
||||
{ print a; }
|
||||
|
||||
function foo(a: string)
|
||||
{ }
|
||||
|
||||
event zeek_init()
|
||||
{ foo("hello"); }
|
Loading…
Add table
Add a link
Reference in a new issue