record spread error on duplicate

This commit is contained in:
Devyn Cairns 2024-07-09 04:45:59 -07:00
parent f8297abf62
commit 455ab41303

View File

@ -565,7 +565,13 @@ fn eval_instruction<D: DebugContext>(
.into_record()
.map_err(|_| ShellError::CannotSpreadAsRecord { span: items_span })?
{
record.insert(key, val);
if let Some(first_value) = record.insert(&key, val) {
return Err(ShellError::ColumnDefinedTwice {
col_name: key,
second_use: *span,
first_use: first_value.span(),
});
}
}
ctx.put_reg(
*src_dst,