* origin/topic/vern/bvu-remove:
Use static_cast instead of dynamic_cast for Val conversions
Remove GET_FIELD_AS macro, replace with template methods
Add templated As() method to Val, use in various places we were using dynamic_cast
Move ValImpl classes into detail namespace
Some review cleanup in Val.cc
Changes addressing pending issues per PR discussion
Remove BroValUnion by hoisting underlying Val subclass values into subclasses
* origin/topic/vern/lambda-copy-semantics:
Add NEWS entries for lambda/capture-list functionality
Tweak vector append/move logic of Frame::SerializeCopyFrame()
Switch FuncType capture-list storage to optional<vector<Capture>>
Fix memory leaks in lambda capture/frame management
tests added for new capture-by-reference closure semantics & errors
documentation updates
test suite updates and additions for new capture semantics & suppression of error cascades
support for transmitting of capture-semantics closures via Broker, while keeping deprecated functionality
minor simplifications in using type names, and unordered sets rather than vectors
changes to Frames to support access to captured-by-copy-semantics variables
changes to ScriptFunc's to track captures, and LambdaExpr's to check/manage them
parsing of new []-style captures, and creation of associated data structures
nit: fixed some 0/1 values that should instead be false/true
no semantic changes: factored some of the complexity of begin_func() into a pair of static functions for clarity
simple error propagation fix: don't complain about "unused" values that themselves are due to errors
no semantic changes: corrected & reflowed some comments, plus a whitespace tweak
When an option's value is a reader-incompatible table or set, Zeek now
renders the type as expressed in the script layer (e.g. "set[addr,addr]")
as opposed to the internal type tag (which'd here be "table", including
for sets).
The input framework's Manager::IsCompatibleType() already rejected
sets with multiple index types that aren't all the same (i.e. that are
not pure). Pure ones (e.g. "set[addr,addr]") slipped through and could
cause Zeek to segfault elsewhere in the config framework due to type
comparison subtleties. Note that the ASCII reader can't read such sets
anyway, so this method now rejects sets with any kind of index-type
tuple.
In the config framework, the script-level change handler has a risky
conversion from any to set[bool], which can trigger segfaults when the
underlying set's index is a type tuple. We now prevent this code path
by ensuring it only applies to sets with a single index type.
List-types as used in composite table/set indices, for example,
previously had incorrect same_type() comparisons due to flattening
of the list-type into a single type without checking whether the
number and kind of types all match.
This patch simply removes the flatten_type() call from same_type() since
it was already contradicting/preventing a subsequent full-comparison
between elements of two TYPE_LISTs.
There was also a superfluous special-case of the `in` operator's
type-checking for testing whether a record is in a table/set. It's
superfluous because the general case will already do the type-checking
from MatchesIndex() after first wrapping the record operand in a
ListExpr. The previous logic was incorrectly relying on the
flatten_type() for testing equality of a record-type against a
list-type, whereas the general case correctly normalizes to testing
equality of two list-types.
The special-cased type-checking logic for assigning a record value to a
table index during its initialization similarly needed minor
re-organization in order to maintain the same error messages as before.