Skip to content

[codex] cover dynamic import local candidates#4281

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-dynamic-import-local-candidates
Jun 4, 2026
Merged

[codex] cover dynamic import local candidates#4281
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-dynamic-import-local-candidates

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Summary

Part of #1674.

This adds end-to-end Node parity coverage for dynamic import() specifiers stored in never-reassigned local let bindings with finite literal candidate sets.

  • covers let specifier = flag ? "./a" : "./b"; await import(specifier) inside a function
  • covers a transitive template-literal case where a never-reassigned local candidate feeds another local specifier
  • adds two tiny fixture target modules so both dispatch branches are executed at runtime

The resolver support is already present on current main; this PR locks the behavior in the parity suite.

Non-goals

  • no compiler/runtime behavior changes
  • no template-glob/context-module wildcard expansion coverage in this cut
  • no function-parameter type narrowing or later-assignment reaching-definition analysis

Validation

  • npm exec --yes --package=node@26 -- node --experimental-strip-types test-parity/node-suite/module/loader/dynamic-import-local-candidates.ts
  • CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=/tmp/perry-dynamic-import-build cargo build --release -p perry -p perry-runtime -p perry-stdlib
  • PERRY_NO_AUTO_OPTIMIZE=1 /tmp/perry-dynamic-import-build/release/perry test-parity/node-suite/module/loader/dynamic-import-local-candidates.ts -o /tmp/perry_dynamic_import_local && /tmp/perry_dynamic_import_local
  • PERRY_NO_AUTO_OPTIMIZE=1 CARGO_TARGET_DIR=/tmp/perry-dynamic-import-build npm exec --yes --package=node@26 -- bash -lc './run_parity_tests.sh --suite node-suite --module module --filter dynamic-import-local-candidates'
  • PERRY_NO_AUTO_OPTIMIZE=1 CARGO_TARGET_DIR=/tmp/perry-dynamic-import-build npm exec --yes --package=node@26 -- bash -lc './run_parity_tests.sh --suite node-suite --module module --filter dynamic-import'
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/check_file_size.sh

@proggeramlug proggeramlug marked this pull request as ready for review June 4, 2026 10:01
@proggeramlug proggeramlug merged commit c160dc1 into PerryTS:main Jun 4, 2026
11 checks passed
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.

2 participants