diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index d464c63cee..5acd74976c 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -1761,7 +1761,11 @@ pub fn parse_numberlike_expr( SyntaxShape::CellPath => parse_simple_cell_path(working_set, span, expand_aliases_denylist), SyntaxShape::String => ( garbage(span), - Some(ParseError::Expected("string".into(), span)), + Some(ParseError::Mismatch( + "string".into(), + "number-like value (hint: use quotes or backticks)".into(), + span, + )), ), SyntaxShape::Any => { if bytes == b"0b" { diff --git a/tests/parsing/mod.rs b/tests/parsing/mod.rs index d66ab04916..ad5fc0dc1c 100644 --- a/tests/parsing/mod.rs +++ b/tests/parsing/mod.rs @@ -226,3 +226,13 @@ fn parse_export_env_missing_block() { assert!(actual.err.contains("missing block")); } + +#[test] +fn numberlike_command_name() { + let actual = nu!(cwd: "tests/parsing/samples", + r#" + def 7zup [] {} + "#); + + assert!(actual.err.contains("backticks")); +}