diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index 7b3b335589..859d464197 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -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() { diff --git a/src/tests/test_parser.rs b/src/tests/test_parser.rs index c457236f32..e98c61e1fd 100644 --- a/src/tests/test_parser.rs +++ b/src/tests/test_parser.rs @@ -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", + ) +}