mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 02:58:20 +00:00
Improve error for invalid use of types as values (addresses #923).
This scripting error can now generate an error message at parse-time instead of run-time and also includes location information.
This commit is contained in:
parent
ea6b62f586
commit
2f0c698ed5
4 changed files with 21 additions and 2 deletions
1
testing/btest/Baseline/language.type-type-error/.stderr
Normal file
1
testing/btest/Baseline/language.type-type-error/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
error in /home/jsiwek/bro/testing/btest/.tmp/language.type-type-error/type-type-error.bro, line 13: not a record (r$a)
|
14
testing/btest/language/type-type-error.bro
Normal file
14
testing/btest/language/type-type-error.bro
Normal file
|
@ -0,0 +1,14 @@
|
|||
# @TEST-EXEC-FAIL: bro -b %INPUT
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
|
||||
|
||||
type r: record {
|
||||
a: string;
|
||||
};
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
# This should generate a parse error indicating that the type identifier
|
||||
# is incorrectly used in an expression expecting a real value and not
|
||||
# a value of type TypeType.
|
||||
print r$a;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue