fix: #810 — path.posix.* and path.win32.join sub-namespace dispatch#817
Merged
Conversation
`path.posix.<method>(...)` and `path.win32.<method>(...)` previously fell through to the receiver-less dispatch and returned `undefined`, because the sub-namespace shape `<root>.<sub>.<method>(args)` was on the strict-API exclusion list of the generic `mod.X.Y()` arm but had no replacement lowering arm. Adds: - HIR `Expr::PathWin32Join(a, b)` and runtime `js_path_win32_join` that joins with `\` separators and normalizes drive letters / mixed `/`+`\` segments per Node's win32 semantics. - HIR lowering for `path.posix.<method>(args)` — routes to the existing POSIX `Expr::Path*` variants (the runtime functions are already POSIX-shaped, so this is a direct shape rewrite for join, dirname, basename, extname, resolve, isAbsolute, relative, normalize, parse, format, toNamespacedPath, matchesGlob). - HIR lowering for `path.win32.join(args)` — routes to the new `Expr::PathWin32Join`. Other `path.win32.*` methods are intentionally left unwired here; falling them through to the POSIX runtime would silently mis-handle drive letters and `\` segments. Track those in a follow-up. `test_parity_path.ts` now passes byte-for-byte against `node --experimental-strip-types`.
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.
Summary
path.posix.<method>(...)andpath.win32.<method>(...)returnedundefinedbecause the sub-namespace shape was excluded from the genericmod.X.Y()arm with no replacement lowering.path.posix.*to the existing POSIXExpr::Path*variants (direct shape rewrite — runtime is already POSIX) and routespath.win32.jointo a newExpr::PathWin32Joinbacked by a dedicatedjs_path_win32_joinruntime function that joins with\and normalizes drive letters / mixed separators.test_parity_path.tsis now a full byte-for-byte PASS againstnode --experimental-strip-types.Scope notes
path.win32.*methods are intentionally left unwired — falling them through to the POSIX runtime would silently mis-handle drive letters and\segments. Track those in a follow-up if needed.Test plan
test-files/test_parity_path.tsdiff vs Node is empty.cargo test --release -p perry-hir -p perry-codegenpasses.Closes #810.