Skip to content

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

Merged
merged 7 commits into from
Jun 24, 2025
Merged

Conversation

jakebailey
Copy link
Member

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.

@Copilot Copilot AI review requested due to automatic review settings June 22, 2025 03:14
Copy link
Contributor

@Copilot Copilot AI left a 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}

@jakebailey jakebailey enabled auto-merge June 24, 2025 04:41
@jakebailey jakebailey requested a review from sheetalkamat June 24, 2025 16:47
@jakebailey jakebailey added this pull request to the merge queue Jun 24, 2025
Merged via the queue into main with commit 80aad85 Jun 24, 2025
22 checks passed
@jakebailey jakebailey deleted the jabaile/lib-replacement branch June 24, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants