-
Notifications
You must be signed in to change notification settings - Fork 659
Port tryLoadInputFileForPath
from TypeScript codebase
#1346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ports the TypeScript tryLoadInputFileForPath
logic into our Go resolver, adds two helpers for mapping output files back to source inputs, and updates a slew of compiler tests and baselines to reflect the new “self-name + outDir” behavior.
- Implement
tryLoadInputFileForPath
support for package self-names withoutDir
/declarationDir
, guessing common source directories and mapping outputs back to inputs - Add helpers
getPossibleOriginalInputExtensionForExtension
andgetOutputDirectoriesForBaseDirectory
- Introduce a new test (
subpathImportJS.ts
) and update many baseline files undertestdata/baselines
to match the new resolution behavior
Reviewed Changes
Copilot reviewed 61 out of 61 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
internal/module/resolver.go | Ported tryLoadInputFileForPath logic from TS; added helpers for extension and directory guesses |
testdata/tests/cases/compiler/subpathImportJS.ts | New test exercising package import maps and self-paths |
testdata/baselines/reference/... | Updated expected outputs/errors/symbols/types to match new resolution results |
This is pending in #1302 |
Yeah, I don't think we need this PR, given #1302 is the same? Just, a discussion about if we are keeping this logic or if there's some better thing we can do? |
Going to close this for clarity, but if you see something in my PR that your PR did better, absolutely tell me. |
I trust that you have a clear idea what you want to achieve - I merely told Copilot to port the TypeScript implementation as close as possible. |
I have to admit, I also did that (which succeeded). |
Fixes: #1345
and improves several baselines of existing tests
I don't fully grasp some of the error diffs, but the other changes at least look like an improvement to me.
Disclaimer: I burned a couple of tokens to get Claude to port this, since I don't understand enough of the codebase to make this change on my own - so please check that no nonsense slipped in.