mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 04:58:21 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/record-coerce-orphans'
* origin/topic/jsiwek/record-coerce-orphans: Add an error for record coercions that would orphan a field. Closes #936.
This commit is contained in:
commit
f6c8995fd2
8 changed files with 36 additions and 13 deletions
|
@ -3921,8 +3921,11 @@ RecordCoerceExpr::RecordCoerceExpr(Expr* op, RecordType* r)
|
|||
{
|
||||
int t_i = t_r->FieldOffset(sub_r->FieldName(i));
|
||||
if ( t_i < 0 )
|
||||
// Orphane field in rhs, that's ok.
|
||||
continue;
|
||||
{
|
||||
ExprError(fmt("orphaned field \"%s\" in record coercion",
|
||||
sub_r->FieldName(i)));
|
||||
break;
|
||||
}
|
||||
|
||||
BroType* sub_t_i = sub_r->FieldType(i);
|
||||
BroType* sup_t_i = t_r->FieldType(t_i);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue