Port lib replacement and --libReplacement#1262
Merged
jakebailey merged 7 commits intomainfrom Jun 24, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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}
sheetalkamat
approved these changes
Jun 24, 2025
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.
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.