Fix package ID collisions for remapped inputs - #4767
Draft
jakebailey wants to merge 3 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes package-ID collisions when declaration outputs remap to source files outside the package directory.
Changes:
- Omits invalid package IDs for remapped external inputs.
- Correctly handles trailing package-directory separators.
- Adds regression tests and baselines for colliding and non-colliding paths.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
internal/module/resolver.go |
Validates resolved paths before constructing package IDs. |
testdata/tests/cases/compiler/packageSelfNameSubpathExportsPackageIdCollision.ts |
Tests distinct package IDs at the filesystem root. |
testdata/tests/cases/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.ts |
Tests remapped inputs outside the package. |
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdCollision.types |
Captures inferred types. |
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdCollision.trace.json |
Captures distinct package IDs. |
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdCollision.symbols |
Captures resolved symbols. |
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdCollision.js |
Captures emitted output. |
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdCollision.errors.txt |
Captures expected diagnostics. |
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.types |
Captures corrected inferred types. |
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.trace.json |
Confirms remapped paths omit package IDs. |
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.symbols |
Captures corrected symbols. |
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.js |
Captures emitted output. |
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.errors.txt |
Confirms set resolves independently. |
Member
Author
|
I might have been bamboozled, I think this bug only happens if |
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.
Fixes #4758
See the second commit for the diff; note how the
setreference mapped togetbefore but now correctly maps toset.