-
Notifications
You must be signed in to change notification settings - Fork 652
Port lib replacement and --libReplacement #1262
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 library replacement behavior and introduces the new --libReplacement flag, updating baseline outputs and error messages accordingly. Key changes include updates to baseline diffs for type outputs and error messages, removal of redundant library processing code in compiler program initialization, and new caching logic for resolving library file paths.
Reviewed Changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.
File | Description |
---|---|
testdata/baselines/reference/submodule/compiler/*.diff | Updated baseline outputs to reflect the new lib replacement behavior |
internal/compiler/program.go | Removed explicit lib processing block in favor of simplified processedFiles call |
internal/compiler/parsetask.go | Removed redundant subtask addition to prevent use of an undefined variable |
internal/compiler/fileloader.go | Added caching for library file paths and new helper functions for library name resolution |
Comments suppressed due to low confidence (2)
internal/compiler/parsetask.go:80
- The removed subtask addition was using the variable 'name' outside the conditional block, which could lead to undefined behavior. The current fix appears correct; please ensure that its removal is intentional and well-tested.
if name, ok := tsoptions.GetLibFileName(lib.FileName); ok {
internal/compiler/program.go:175
- [nitpick] The removal of the explicit library processing block in the Program constructor simplifies initialization, but please verify that the updated processedFiles call fully covers all scenarios for lib resolution.
p := &Program{opts: opts}
Ports lib replacement itself along with microsoft/TypeScript#60829.
The default in this PR is libReplacement=false, unlike Strada, per the deprecation plan. But, easy to flip back if we think it's a problem.