-
Notifications
You must be signed in to change notification settings - Fork 715
Handle processing diagnostics similar to Strada #1628
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 changes how processing diagnostics (like /// <reference ...>
directives) are handled to match the behavior of Strada (the TypeScript compiler). Instead of including all processing diagnostics in GetProgramDiagnostics
, it now only includes global processing diagnostics, while file-specific processing diagnostics are handled through getSemanticDiagnosticsForFile
. This ensures that skipLibCheck: true
properly filters out processing diagnostics from library files.
Key Changes:
- Modified
GetProgramDiagnostics
to only include global processing diagnostics - Updated
getSemanticDiagnosticsForFile
to include file-specific processing diagnostics - Added a test case to verify that processing diagnostics in library files are properly skipped when
skipLibCheck: true
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
File | Description |
---|---|
testdata/tests/cases/compiler/processingDiagnosticSkipLibCheck.ts | New test case demonstrating that processing diagnostics in library files should be skipped when skipLibCheck: true |
internal/compiler/program.go | Modified diagnostic collection to separate global and file-specific processing diagnostics |
testdata/baselines/reference/* | Updated baselines showing improved diagnostic behavior with file-specific error reporting |
internal/execute/tsctests/tscbuild_test.go | Updated test comment reflecting corrected behavior |
"../../animals/dog.ts", | ||
"../../animals/index.ts", | ||
"../../core/utilities.ts" | ||
[ |
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.
As far as I could tell, these new errors are correct and show up in the Strada baselines for these tests.
return SortAndDeduplicateDiagnostics(slices.Concat(p.programDiagnostics, p.includeProcessor.getDiagnostics(p).GetDiagnostics())) | ||
return SortAndDeduplicateDiagnostics(slices.Concat( | ||
p.programDiagnostics, | ||
p.includeProcessor.getDiagnostics(p).GetGlobalDiagnostics())) |
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.
p.includeProcessor.getDiagnostics(p).GetGlobalDiagnostics())) | |
p.includeProcessor.getDiagnostics(p).GetGlobalDiagnostics(), | |
)) |
Nit (sorry)
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.
LGTM, feel free to not do the formatting nit 😄
In Corsa,
GetProgramDiagnostics
was including all diagnostics of theincludeProcessor
, which includes/// <reference ...>
diagnostics and resolution diagnostics. Because we did that, an error e.g. in a bad/// <reference type="non-existent"/>
in a lib file would be included in the output of a command line execution even if the project hadskipLibCheck: true
.This PR changes this so that
GetProgramDiagnostics
now only includes globalincludeProcessor
diagnostics.This is basically what Strada did (see
program.getCombinedDiagnostics
there).The file-specific
includeProcessor
diagnostics are now obtained viagetSemanticDiagnosticsForFile
. This is also what Strada did.The result is that in
getSemanticDiagnosticsForFile
, we have a chance to check if that file should be skipped perskipLibCheck
, and we'll also handle// @ts-ignore
correctly as well for these diagnostics.