Skip to content

fix(semantic): respect implicit arguments bindings#24392

Draft
Minghan2005 wants to merge 1 commit into
oxc-project:mainfrom
Minghan2005:codex/fix-arguments-shadow-resolution
Draft

fix(semantic): respect implicit arguments bindings#24392
Minghan2005 wants to merge 1 commit into
oxc-project:mainfrom
Minghan2005:codex/fix-arguments-shadow-resolution

Conversation

@Minghan2005

Copy link
Copy Markdown

Summary

  • stop value-space arguments references from walking past a non-arrow function's implicit arguments binding
  • preserve lexical capture through arrow functions and precedence for explicit parameters or local declarations
  • handle named function expressions whose name binding is represented in the same Oxc scope but is outside the runtime arguments environment
  • add a semantic scope snapshot covering ordinary, arrow, nested, named, and explicitly shadowed functions

Root cause

Oxc intentionally represents the implicit arguments object as an unresolved reference instead of creating a synthetic symbol. The walk-up resolver did not treat non-arrow function scopes as a boundary, so it could incorrectly attach an inner arguments reference to an outer declaration with the same name.

Validation

  • env -u NO_COLOR just ready
  • cargo test -p oxc_semantic --all-features
  • cargo clippy -p oxc_semantic --all-targets --all-features -- -D warnings
  • focused downstream tests for prefer-rest-params, no-undef, and object-shorthand

Closes #23844.

AI assistance

This change was developed with assistance from OpenAI Codex. The implementation and regression coverage were validated with the repository's full prescribed just ready workflow.

@Minghan2005
Minghan2005 force-pushed the codex/fix-arguments-shadow-resolution branch from b60463f to 394b0d6 Compare July 14, 2026 17:32

Copy link
Copy Markdown
Author

I’ve rebased this branch onto the latest main and force-pushed the updated commit. cargo test -p oxc_semantic --lib passes locally (11 tests). The new Actions workflows are waiting for maintainer approval; could you please approve them when convenient?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

semantic: arguments is incorrectly resolved when shadowed

1 participant