Skip to content

Omitting a space in custom command declaration causes misleading error #8934

@cmidkiff87

Description

@cmidkiff87

Describe the bug

Omitting a space between the function identifier and [ causes a Missing required positional argument error

# test.nu

def test_1[] {
  echo "generates error"
}

def test_2 [] {
  echo "runs fine"
}

How to reproduce

type def test[] { echo "" } into the REPL

Expected behavior

Either the error should make sense given the context, or the tokenizer should accept this syntax

Screenshots

image

Configuration

key value
version 0.78.0
branch makepkg
commit_hash 2ec2028
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.68.2 (9eb3afe9e 2023-03-27) (Arch Linux rust 1:1.68.2-1)
cargo_version cargo 1.68.2
build_time 2023-04-05 02:09:35 +00:00
build_rust_channel release
features default, zip
installed_plugins

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:error-unhelpfulThe error message you observe is not helpful to identify the problemA:parserIssues related to parsing

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions