Repository navigation
Conversation
Commit 1810072 ("implement dynamic dispatch for % sigil") added runtime dispatch for `%($cmd)` / `%$cmd`, but the parser loop that handles trailing arguments only emitted `Argument::Positional`. It never checked for the `...` spread prefix, so `...$args` was parsed as a literal value and resolved as a file path at runtime: export def --wrapped builtin [arg1, ...args] { %($arg1) ...$args } builtin ls . # => Error: nu::shell::io::not_found # "/Users/.../nushell/...$args" does not exist The fix mirrors how spread is detected everywhere else in the parser (internal calls, external calls, list/record literals): check whether the span starts with `...` followed by `$`, `[`, or `(`, strip the three-byte prefix, parse the remainder as `List(Any)`, and push `Argument::Spread` instead of `Argument::Positional`. The IR compiler already forwards spread arguments faithfully to `run-internal`, and `call.rest()` flattens them at runtime, so no other changes are needed.
2 tasks done
Owner
|
Thanks. I've created a slightly different set of changes for this functionality in the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit 1810072 ("implement dynamic dispatch for % sigil") added runtime dispatch for
%($cmd)/%$cmd, but the parser loop that handles trailing arguments only emittedArgument::Positional. It never checked for the...spread prefix, so...$argswas parsed as a literal value and resolved as a file path at runtime:The fix mirrors how spread is detected everywhere else in the parser (internal calls, external calls, list/record literals): check whether the span starts with
...followed by$,[, or(, strip the three-byte prefix, parse the remainder asList(Any), and pushArgument::Spreadinstead ofArgument::Positional. The IR compiler already forwards spread arguments faithfully torun-internal, andcall.rest()flattens them at runtime, so no other changes are needed.