zeek/testing/btest/language/invalid-optional-attr.zeek
Evan Typanski 4e5a56c5e0 Only allow &optional in records
There was some confusing behavior with &optional and locals, so this
should get rid of that by making it an error. However, there is a case
where function parameters are still allowed to have &optional - this is
because there are checks for &default in parameters as well.
2025-08-14 11:38:19 -04:00

12 lines
282 B
Text

# @TEST-EXEC-FAIL: zeek -b %INPUT >out 2>&1
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
# Invalid on globals
global a: int &optional;
# TODO: Invalid on parameters
function f(a: int &optional)
{
# Invalid in locals
local b: int &optional;
}