Skip to content

Spread operator in a closure does not capture all arguments #12985

@pyz4

Description

@pyz4

Describe the bug

The spread operator does not capture all residual arguments when used in a closure.

How to reproduce

$ do {|a, ...b| echo $a ...$b} 1 2 3 4
╭───┬───╮
│ 0 │ 1 │
│ 1 │ 3 │
│ 2 │ 4 │
╰───┴───╯

Expected behavior

I expect the output to also include "2"

$ do {|a, ...b| echo $a ...$b} 1 2 3 4
╭───┬───╮
│ 0 │ 1 │
│ 1 │ 2 │
│ 2 │ 3 │
│ 3 │ 4 │
╰───┴───╯

Screenshots

No response

Configuration

key value
version 0.93.0
major 0
minor 93
patch 0
branch
commit_hash
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.79.0-nightly (385fa9d84 2024-04-04)
rust_channel nightly-x86_64-pc-windows-msvc
cargo_version cargo 1.79.0-nightly (0637083df 2024-04-02)
build_time 2024-05-25 21:19:07 -04:00
build_rust_channel release
allocator mimalloc
features dataframe, default, sqlite, system-clipboard, trash, which
installed_plugins polars

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