Files
nushell/toolkit
Darren Schroeder f11c5f84ed disallow keywords from being shadowed (#18662)
<!--
Thanks for contributing to Nushell!

Before submitting, please read the contributing guide:
https://github.com/nushell/nushell/blob/main/CONTRIBUTING.md

This template helps reviewers understand your changes and allows us to
generate high-quality release notes.
-->

## Description
This PR disallows keywords from being shadowed such as `def def [] {}`.
I'm calling this a breaking change because we had to change `toolkit
run` to `toolkit dev` because `run` is now a keyword.

<!--
Explain what this PR does and why.

This section is intentionally flexible:
- Describe the problem
- Explain your approach
- Include technical details if relevant

Good examples:
- "In this PR, I fixed..."
- "In this PR, I added support for..."
- "This change improves X by..."

Write as much or as little as needed for reviewers to understand your
changes.
-->

## User-facing changes (Release notes)
Trying to shadow a keyword will produce an error now.
```nushell
❯ def def [] {}
Error: nu::parser::name_is_keyword

  × Can't use parser keyword `def` as command name.
   ╭─[repl_entry #1:1:5]
 1 │ def def [] {}
   ·     ─┬─
   ·      ╰── 'def' is a parser keyword
   ╰────
  help: Parser keywords cannot be shadowed (including via module exports and `use *`). Choose a different command name so language
        constructs keep working.
```
<!--
This section is used (mostly as-is) for https://www.nushell.sh/blog/

Describe how Nushell behavior changes from a user's perspective.
Do NOT describe internal Rust changes here.

Write in a release note style, for example:
- "Added support for..."
- "Fixed an issue where..."
- "Nushell now supports..."
- "Improved performance of..."

If your changes do NOT affect users (internal refactors, cleanup, etc.),
just write:
- "n/a"
- "nan"
- or similar

This tells us the change should not appear in the changelog.

Tips:
- Focus on observable behavior
- Include examples if helpful
- Keep it concise

You can:
- Write a short paragraph (will appear as a bullet point), OR
- Use headings (###) if your change needs more structure

Avoid writing things like:
- "In this PR, I refactored..."
- "This updates internal code..."

You may leave this blank until the PR is ready.
-->

## Additional notes
<!--
Optional.

Examples:
- fixes #123
- closes #456
- related #789

Anything else reviewers should know.
Remove this section if not needed.
-->
2026-07-19 19:05:06 -05:00
..