Skip to content

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

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

fix do closure with both required, options, and rest args#13002
fdncred merged 1 commit intonushell: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 Include the release notes summary in the "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
Copy link
Copy Markdown
Contributor

fdncred commented May 30, 2024

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 Include the release notes summary in the "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