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:
Jon Siwek 2012-12-18 14:31:39 -06:00
parent ea6b62f586
commit 2f0c698ed5
4 changed files with 21 additions and 2 deletions

View 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)

View 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;
}