mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 03:58:20 +00:00
GH-1273: Change SizeExpr to yield "any" type when operating on "any"
This commit is contained in:
parent
721b232d94
commit
d4528162d1
4 changed files with 31 additions and 1 deletions
2
testing/btest/Baseline/language.sizeof-any/error
Normal file
2
testing/btest/Baseline/language.sizeof-any/error
Normal file
|
@ -0,0 +1,2 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
error in ./lacks-type-cast.zeek, line 3: requires arithmetic operands (1 + aa)
|
6
testing/btest/Baseline/language.sizeof-any/output
Normal file
6
testing/btest/Baseline/language.sizeof-any/output
Normal file
|
@ -0,0 +1,6 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
13.0, time
|
||||
13.0, double
|
||||
13.0, double
|
||||
14.0
|
||||
14.0
|
20
testing/btest/language/sizeof-any.zeek
Normal file
20
testing/btest/language/sizeof-any.zeek
Normal file
|
@ -0,0 +1,20 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >output 2>&1
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# @TEST-EXEC-FAIL: zeek -b lacks-type-cast.zeek >error 2>&1
|
||||
# @TEST-EXEC: btest-diff error
|
||||
|
||||
local a: any = double_to_time(13.0);
|
||||
local aa = |a|;
|
||||
local aaa = |a as time|;
|
||||
print a, type_name(a);
|
||||
print aa, type_name(aa);
|
||||
print aaa, type_name(aaa);
|
||||
print 1 + (aa as double);
|
||||
print 1 + aaa;
|
||||
|
||||
@TEST-START-FILE lacks-type-cast.zeek
|
||||
local a: any = double_to_time(13.0);
|
||||
local aa = |a|;
|
||||
print 1 + aa;
|
||||
@TEST-END-FILE
|
Loading…
Add table
Add a link
Reference in a new issue