mirror of
https://github.com/nushell/nushell.git
synced 2024-11-08 01:24:38 +01:00
Add support for single value row conditions (#5072)
This commit is contained in:
parent
62901573d0
commit
6649da3f5d
@ -3993,7 +3993,7 @@ pub fn parse_math_expression(
|
||||
let mut last_prec = 1000000;
|
||||
|
||||
let mut error = None;
|
||||
let (lhs, err) = parse_value(
|
||||
let (mut lhs, err) = parse_value(
|
||||
working_set,
|
||||
spans[0],
|
||||
&SyntaxShape::Any,
|
||||
@ -4002,6 +4002,13 @@ pub fn parse_math_expression(
|
||||
error = error.or(err);
|
||||
idx += 1;
|
||||
|
||||
if idx >= spans.len() {
|
||||
// We already found the one part of our expression, so let's expand
|
||||
if let Some(row_var_id) = lhs_row_var_id {
|
||||
expand_to_cell_path(working_set, &mut lhs, row_var_id, expand_aliases_denylist);
|
||||
}
|
||||
}
|
||||
|
||||
expr_stack.push(lhs);
|
||||
|
||||
while idx < spans.len() {
|
||||
|
@ -367,3 +367,11 @@ fn proper_rest_types() -> TestResult {
|
||||
"not verbose!",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn single_value_row_condition() -> TestResult {
|
||||
run_test(
|
||||
r#"[[a, b]; [true, false], [true, true]] | where a | length"#,
|
||||
"2",
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user