Unify type comparisions for records.

For records, same_type(r1, r2) would not check if the fields'
attributes match as well. That seems like an oversight, and some
callers of same_type() did indeed add that check on their end. This
commit moves the check into same_type() itself. That generally doesn't
seem make any differences except for a couple of places validating
code, which we update a bit. That in turn leans to slightly different
(better?) error messages for a couple of test cases.
This commit is contained in:
Robin Sommer 2020-10-04 16:42:44 +00:00
parent a2577891e0
commit d782c60f19
5 changed files with 45 additions and 52 deletions

View file

@ -504,6 +504,11 @@ public:
ValPtr InitVal(const zeek::Type* t, ValPtr aggr) const override;
bool IsPure() const override;
void SetOp2(ExprPtr e)
{
op2 = e;
}
protected:
bool TypeCheck(const AttributesPtr& attrs = nullptr);
bool TypeCheckArithmetics(TypeTag bt1, TypeTag bt2);