"fix the use of right hand expressions in operations"
This commit is contained in:
parent
d2121a155e
commit
50ef22308e
|
@ -63,31 +63,18 @@ fn compute_with_value(
|
||||||
op: Span,
|
op: Span,
|
||||||
right: &Value,
|
right: &Value,
|
||||||
) -> Result<Value, ShellError> {
|
) -> Result<Value, ShellError> {
|
||||||
let rhs_span = right.span();
|
|
||||||
match right {
|
match right {
|
||||||
Value::Custom { val: rhs, .. } => {
|
Value::Custom { .. } => {
|
||||||
let rhs = rhs.as_any().downcast_ref::<NuExpression>().ok_or_else(|| {
|
let rhs = NuExpression::try_from_value(plugin, right)?;
|
||||||
ShellError::TypeMismatch {
|
with_operator(
|
||||||
err_message: "Right hand side not a dataframe expression".into(),
|
(plugin, engine),
|
||||||
span: rhs_span,
|
operator,
|
||||||
}
|
left,
|
||||||
})?;
|
&rhs,
|
||||||
|
lhs_span,
|
||||||
match rhs.as_ref() {
|
right.span(),
|
||||||
polars::prelude::Expr::Literal(..) => with_operator(
|
op,
|
||||||
(plugin, engine),
|
)
|
||||||
operator,
|
|
||||||
left,
|
|
||||||
rhs,
|
|
||||||
lhs_span,
|
|
||||||
right.span(),
|
|
||||||
op,
|
|
||||||
),
|
|
||||||
_ => Err(ShellError::TypeMismatch {
|
|
||||||
err_message: "Only literal expressions or number".into(),
|
|
||||||
span: right.span(),
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let rhs = NuExpression::try_from_value(plugin, right)?;
|
let rhs = NuExpression::try_from_value(plugin, right)?;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user