Skip to content

fix do closure with both required, options, and rest args - #13002

Merged
fdncred merged 1 commit into
nushell:mainfrom
WindSoilder:do_fix
May 30, 2024
Merged

fdncred merged 1 commit into
nushell:mainfrom
WindSoilder:do_fix

Conversation

@WindSoilder

Copy link
Copy Markdown
Contributor

Description

Fixes: #12985

val_iter has already handle required positional and optional positional arguments, it not skip them again while handling rest arguments.

User-Facing Changes

Makes do {|a, ...b| echo $a ...$b} 1 2 3 4 output the following again:

╭───┬───╮
│ 0 │ 1 │
│ 1 │ 2 │
│ 2 │ 3 │
│ 3 │ 4 │
╰───┴───╯

Tests + Formatting

Added some test cases

@WindSoilder WindSoilder added notes:fixes Noted in "Bug fixes" section deprecated:pr-commands (deprecated: too vague) This PR changes our commands in some way labels May 30, 2024
@fdncred
fdncred merged commit 40772fe into nushell:main May 30, 2024
@fdncred

fdncred commented May 30, 2024

Copy link
Copy Markdown
Contributor

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deprecated:pr-commands (deprecated: too vague) This PR changes our commands in some way notes:fixes Noted in "Bug fixes" section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spread operator in a closure does not capture all arguments

3 participants