ZAM fixes for compatibility with GH-3249 changes

This commit is contained in:
Vern Paxson 2023-09-01 12:20:35 -07:00
parent 80eed34985
commit e78570ad89
4 changed files with 13 additions and 3 deletions

View file

@ -894,7 +894,7 @@ bool AddToExpr::IsReduced(Reducer* c) const
if ( tag == TYPE_TABLE )
return op1->IsReduced(c) && op2->IsReduced(c);
if ( tag == TYPE_VECTOR && same_type(t, op2->GetType()) )
if ( tag == TYPE_VECTOR && IsVector(op2->GetType()->Tag()) && same_type(t, op2->GetType()) )
return op1->IsReduced(c) && op2->IsReduced(c);
return NonReduced(this);
@ -923,7 +923,8 @@ ExprPtr AddToExpr::Reduce(Reducer* c, StmtPtr& red_stmt)
red_stmt = MergeStmts(red_stmt1, red_stmt2);
if ( tag == TYPE_VECTOR && ! same_type(t, op2->GetType()) )
if ( tag == TYPE_VECTOR &&
(! IsVector(op2->GetType()->Tag()) || ! same_type(t, op2->GetType())) )
{
auto append = make_intrusive<AppendToExpr>(op1->Duplicate(), op2);
append->SetOriginal(ThisPtr());

View file

@ -402,7 +402,8 @@ eval $1.re_val->AddTo(frame[z.v1].re_val, false);
unary-op AddVecToVec
op1-read
eval $1.vector_val->AddTo(frame[z.v1].vector_val, false);
eval if ( ! $1.vector_val->AddTo(frame[z.v1].vector_val, false) )
ZAM_run_time_error(z.loc, "incompatible vector element assignment");
unary-op AddTableToTable
op1-read

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.
runtime error in <...>/vector-any-append.zeek, line 63: incompatible vector element assignment

View 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.
[0, 1, 2, 3]
[4, 0, 1, 2, 3]
[1, 2, 3, [4, 5]], 4, count, count, vector of count
[[r=r], [r=r], [s=s], [s=s]]
[a, -3]