Skip to content

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

Closed

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

Activity

  1. added
    A:parser
    A:error-unhelpful
    on Apr 19, 2023
  2. added a commit that references this issue on May 12, 2023
    a3bf2bf
  3. added this to the v0.80.0 milestone on May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:error-unhelpfulA:parser

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions