diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index 6f4b1e1b81..4ef6b1f2b1 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -4950,9 +4950,9 @@ pub fn parse_value( } else { let shapes = [ SyntaxShape::Binary, + SyntaxShape::Range, SyntaxShape::Filesize, SyntaxShape::Duration, - SyntaxShape::Range, SyntaxShape::DateTime, SyntaxShape::Int, SyntaxShape::Number, diff --git a/tests/repl/test_parser.rs b/tests/repl/test_parser.rs index 988b34f18d..47529c69f0 100644 --- a/tests/repl/test_parser.rs +++ b/tests/repl/test_parser.rs @@ -94,6 +94,16 @@ fn range_iteration2() -> TestResult { run_test("4..1 | each { |y| $y + 100 } | get 3", "101") } +#[test] +fn range_ends_with_duration_suffix_variable_name() -> TestResult { + run_test("let runs = 10; 1..$runs | math sum", "55") +} + +#[test] +fn range_ends_with_filesize_suffix_variable_name() -> TestResult { + run_test("let sizekb = 10; 1..$sizekb | math sum", "55") +} + #[test] fn simple_value_iteration() -> TestResult { run_test("4 | each { |it| $it + 10 }", "14")