Merge remote-tracking branch 'origin/topic/awelzel/3640-void-size-expr-assign-stmt'

* origin/topic/awelzel/3640-void-size-expr-assign-stmt:
  Expr: Handle TYPE_VOID in SizeExpr and AssignExpr::Typecheck()
This commit is contained in:
Arne Welzel 2024-03-12 10:31:19 +01:00
commit 2d1588277e
11 changed files with 79 additions and 3 deletions

View 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 <...>/void-errors.zeek, line 2: identifier not defined: void

View 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 <...>/void-errors.zeek, line 1: identifier not defined: void

View 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 <...>/void-errors.zeek, line 2: return statement cannot have an expression (return (a))

View 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 <...>/void-errors.zeek, line 4: cannot take size of void (sizeofx[3.4.5.6])

View 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 <...>/void-errors.zeek, line 2: can't assign void value (y = x[3])

View file

@ -0,0 +1,4 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/void-errors.zeek, line 5: can't assign void value (z = x())
error in <...>/void-errors.zeek, line 6: value of type void illegal (print x())
error in <...>/void-errors.zeek, line 7: cannot take size of void (sizeofx())

View 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 <...>/void-errors.zeek, line 7: identifier not defined: void

View file

@ -0,0 +1,43 @@
# @TEST-DOC: Zeek does not have a script land void type, but internally it does exist (indexing a set, or a function returning no result). Regression test #3640.
#
# @TEST-EXEC-FAIL: zeek -b %INPUT >output 2>&1
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
# identifier void not defined...
global x: void = 1;
# @TEST-START-NEXT
type R: record {
x: void;
};
# @TEST-START-NEXT
function x(): void {
return "a";
};
# @TEST-START-NEXT
function x() {
return "a";
};
# @TEST-START-NEXT
global x = set(3.4.5.6, 9.8.7.6);
print |x|;
print |x[3.4.5.6]|;
# @TEST-START-NEXT
local x = set(5, 3);
local y: any = x[3];
print y;
# @TEST-START-NEXT
function x() {
print "x()";
}
global z: any = x();
print x();
print |x()|;