diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index d9b9cfa2e9..2ef67d4e25 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -4176,7 +4176,7 @@ pub fn parse_closure_expression( } else { return ( garbage(span), - Some(ParseError::Expected("block".into(), span)), + Some(ParseError::Expected("closure".into(), span)), ); } if bytes.ends_with(b"}") { @@ -4248,7 +4248,7 @@ pub fn parse_closure_expression( error = error.or_else(|| { Some(ParseError::Expected( format!( - "{} block parameter{}", + "{} closure parameter{}", v.len(), if v.len() > 1 { "s" } else { "" } ), diff --git a/src/tests/test_parser.rs b/src/tests/test_parser.rs index a20ce62ad5..3fe54c42b5 100644 --- a/src/tests/test_parser.rs +++ b/src/tests/test_parser.rs @@ -349,7 +349,10 @@ fn proper_missing_param() -> TestResult { #[test] fn block_arity_check1() -> TestResult { - fail_test(r#"ls | each { |x, y, z| 1}"#, "expected 2 block parameters") + fail_test( + r#"ls | each { |x, y, z| 1}"#, + "expected 2 closure parameters", + ) } #[test]