mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Improve type inference for vector-of-enum constructor
This commit is contained in:
parent
9698d8d7cc
commit
70aa886806
5 changed files with 54 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
error in /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.vector-of-enum-mismatch/vector-of-enum-mismatch.zeek, line 7 and /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.vector-of-enum-mismatch/vector-of-enum-mismatch.zeek, line 8: incompatible enum types: 'color' and 'number' (enum and enum)
|
||||
error in /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.vector-of-enum-mismatch/vector-of-enum-mismatch.zeek, line 9: inconsistent types in list
|
1
testing/btest/Baseline/language.vector-of-enum/out
Normal file
1
testing/btest/Baseline/language.vector-of-enum/out
Normal file
|
@ -0,0 +1 @@
|
|||
vector of enum, [Red, Green, Blue]
|
9
testing/btest/language/vector-of-enum-mismatch.zeek
Normal file
9
testing/btest/language/vector-of-enum-mismatch.zeek
Normal file
|
@ -0,0 +1,9 @@
|
|||
# @TEST-EXEC-FAIL: zeek -b %INPUT >out 2>&1
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||
|
||||
# Type inference for vector constructor comprised of disparate enum types
|
||||
# should raise an error message about the types being incompatible.
|
||||
|
||||
type color: enum { Red, Green, Blue };
|
||||
type number: enum { One, Two, Three, Four};
|
||||
global v = vector(Red, Four, Blue);
|
9
testing/btest/language/vector-of-enum.zeek
Normal file
9
testing/btest/language/vector-of-enum.zeek
Normal file
|
@ -0,0 +1,9 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
# Type inference for vector constructor comprised of enums should work fine
|
||||
# (previously the internal merge_types code did not handle enums).
|
||||
|
||||
type color: enum { Red, Green, Blue };
|
||||
global v = vector(Red, Green, Blue);
|
||||
print type_name(v), v;
|
Loading…
Add table
Add a link
Reference in a new issue