Improve error message of index assignment expression failures

This commit is contained in:
Jon Siwek 2018-11-02 16:38:55 -05:00
parent 802b4f876e
commit a7ba44089b
3 changed files with 62 additions and 2 deletions

View file

@ -0,0 +1 @@
internal error in /Users/jon/projects/bro/bro/scripts/base/utils/queue.bro, line 152: vector index assignment failed for invalid type 'myrec', value: [a=T, b=hi, c=<uninitialized>] (Queue::ret[Queue::j])

View file

@ -0,0 +1,31 @@
# @TEST-EXEC-FAIL: bro -b %INPUT >out 2>&1
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
@load base/utils/queue
global q: Queue::Queue = Queue::init();
type myrec: record {
a: bool &default=T;
b: string &default="hi";
c: string &optional;
};
function foo(mr: myrec)
{
print mr$a;
print mr$c;
print mr$b;
}
event bro_init()
{
Queue::put(q, "hello");
Queue::put(q, "goodbye");
Queue::put(q, "test");
Queue::put(q, myrec());
local rval: vector of string = vector();
Queue::get_vector(q, rval);
print rval;
}