Skip to content

parser panicked with index out of bounds #8385

@ahkrr

Description

@ahkrr

Describe the bug

I created a function with a signature that would lead to the parser panicking when I tried to type out specific ways of calling the function.
thread 'main' panicked at 'index out of bounds: the len is 2 but the index is 3', crates/nu-parser/src/parser.rs:752:28

How to reproduce

  1. def nuu [ one: list two: list three: list four: list five: list six: list ] { }
  2. nuu [] [] [] [] [] [] # trying to type out this call would lead to a panic!
  3. nuu 0 0 0 0 # trying to type out this call would lead to a panic!
  4. nuu 00 00 00 00 00 # trying to type out this call would lead to a panic!

Expected behavior

I expected nu to not panci!

Screenshots

No response

Configuration

key value
version 0.76.0
branch
commit_hash bc38a6a
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.66.1 (90743e729 2023-01-10)
rust_channel 1.66.1-x86_64-unknown-linux-gnu
cargo_version cargo 1.66.1 (ad779e08b 2023-01-10)
pkg_version 0.76.0
build_time 2023-02-21 21:13:21 +00:00
build_rust_channel release
features database, default, trash, which, zip
installed_plugins

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions