mirror of
https://github.com/nushell/nushell.git
synced 2025-02-16 10:32:29 +01:00
# Description Makes `LazyRecord`s have the same error message as regular `Records` for `Value::follow_cell_path`. Fixes #11750.
This commit is contained in:
parent
9fa2b77611
commit
857c522808
@ -976,7 +976,7 @@ impl Value {
|
||||
}
|
||||
// Records (and tables) are the only built-in which support column names,
|
||||
// so only use this message for them.
|
||||
Value::Record { .. } => {
|
||||
Value::Record { .. } | Value::LazyRecord { .. } => {
|
||||
return Err(ShellError::TypeMismatch {
|
||||
err_message:"Can't access record values with a row index. Try specifying a column name instead".into(),
|
||||
span: *origin_span,
|
||||
@ -1202,9 +1202,8 @@ impl Value {
|
||||
}
|
||||
Value::LazyRecord { val, .. } => {
|
||||
// convert to Record first.
|
||||
let mut record = val.collect()?;
|
||||
record.upsert_data_at_cell_path(cell_path, new_val)?;
|
||||
*self = record;
|
||||
*self = val.collect()?;
|
||||
self.upsert_data_at_cell_path(cell_path, new_val)?;
|
||||
}
|
||||
Value::Error { error, .. } => return Err(*error.clone()),
|
||||
v => {
|
||||
@ -1319,9 +1318,8 @@ impl Value {
|
||||
}
|
||||
Value::LazyRecord { val, .. } => {
|
||||
// convert to Record first.
|
||||
let mut record = val.collect()?;
|
||||
record.update_data_at_cell_path(cell_path, new_val)?;
|
||||
*self = record;
|
||||
*self = val.collect()?;
|
||||
self.update_data_at_cell_path(cell_path, new_val)?;
|
||||
}
|
||||
Value::Error { error, .. } => return Err(*error.clone()),
|
||||
v => {
|
||||
@ -1409,10 +1407,8 @@ impl Value {
|
||||
}
|
||||
Value::LazyRecord { val, .. } => {
|
||||
// convert to Record first.
|
||||
let mut record = val.collect()?;
|
||||
record.remove_data_at_cell_path(cell_path)?;
|
||||
*self = record;
|
||||
Ok(())
|
||||
*self = val.collect()?;
|
||||
self.remove_data_at_cell_path(cell_path)
|
||||
}
|
||||
v => Err(ShellError::CantFindColumn {
|
||||
col_name: col_name.clone(),
|
||||
@ -1495,10 +1491,8 @@ impl Value {
|
||||
}
|
||||
Value::LazyRecord { val, .. } => {
|
||||
// convert to Record first.
|
||||
let mut record = val.collect()?;
|
||||
record.remove_data_at_cell_path(cell_path)?;
|
||||
*self = record;
|
||||
Ok(())
|
||||
*self = val.collect()?;
|
||||
self.remove_data_at_cell_path(cell_path)
|
||||
}
|
||||
v => Err(ShellError::CantFindColumn {
|
||||
col_name: col_name.clone(),
|
||||
@ -1624,9 +1618,8 @@ impl Value {
|
||||
}
|
||||
Value::LazyRecord { val, .. } => {
|
||||
// convert to Record first.
|
||||
let mut record = val.collect()?;
|
||||
record.insert_data_at_cell_path(cell_path, new_val, v_span)?;
|
||||
*self = record;
|
||||
*self = val.collect()?;
|
||||
self.insert_data_at_cell_path(cell_path, new_val, v_span)?;
|
||||
}
|
||||
other => {
|
||||
return Err(ShellError::UnsupportedInput {
|
||||
|
Loading…
Reference in New Issue
Block a user