diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index 35db9ec20f..5f634e94d4 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -3630,7 +3630,7 @@ pub fn parse_block_expression( // TODO: Finish this if let SyntaxShape::Block(Some(v)) = shape { if let Some((sig, sig_span)) = &signature { - if sig.num_positionals() != v.len() { + if sig.num_positionals() > v.len() { error = error.or_else(|| { Some(ParseError::Expected( format!( @@ -3657,20 +3657,6 @@ pub fn parse_block_expression( }); } } - } else if !v.is_empty() { - error = error.or_else(|| { - Some(ParseError::Expected( - format!( - "{} block parameter{}", - v.len(), - if v.len() > 1 { "s" } else { "" } - ), - Span { - start: span.start + 1, - end: span.start + 1, - }, - )) - }); } } diff --git a/src/tests/test_parser.rs b/src/tests/test_parser.rs index 2c392327f8..849865bf17 100644 --- a/src/tests/test_parser.rs +++ b/src/tests/test_parser.rs @@ -330,16 +330,6 @@ fn proper_missing_param() -> TestResult { #[test] fn block_arity_check1() -> TestResult { - fail_test(r#"ls | each { 1 }"#, "expected 1 block parameter") -} - -#[test] -fn block_arity_check2() -> TestResult { - fail_test(r#"ls | reduce { 1 }"#, "expected 2 block parameters") -} - -#[test] -fn block_arity_check3() -> TestResult { fail_test(r#"ls | each { |x, y| 1}"#, "expected 1 block parameter") }