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

@ -1690,6 +1690,9 @@ bool same_type(const Type& arg_t1, const Type& arg_t2,
if ( (match_record_field_names && ! util::streq(td1->id, td2->id)) ||
! same_type(td1->type, td2->type, is_init, match_record_field_names) )
return false;
if ( ! same_attrs(td1->attrs.get(), td2->attrs.get()) )
return false;
}
return true;