diff --git a/crates/nu-parser/src/lex.rs b/crates/nu-parser/src/lex.rs index a0d7a1af8..40f2baaac 100644 --- a/crates/nu-parser/src/lex.rs +++ b/crates/nu-parser/src/lex.rs @@ -191,7 +191,7 @@ pub fn lex_item( Some(ParseError::Unbalanced( "{".to_string(), "}".to_string(), - Span::new(span.end, span.end), + Span::new(span.end, span.end + 1), )), ); } diff --git a/src/tests/test_parser.rs b/src/tests/test_parser.rs index 957811cb2..1899efebf 100644 --- a/src/tests/test_parser.rs +++ b/src/tests/test_parser.rs @@ -488,6 +488,11 @@ fn unbalanced_delimiter3() -> TestResult { fail_test(r#"{"#, "Unexpected end of code") } +#[test] +fn unbalanced_delimiter4() -> TestResult { + fail_test(r#"}"#, "unbalanced { and }") +} + #[test] fn register_with_string_literal() -> TestResult { fail_test(r#"register 'nu-plugin-math'"#, "File not found")