Sitelet https://github.com/microsoft/typescript-go/pull/763
Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

Return empty diags for files with skipped checking - #763

Merged
Jake Bailey (jakebailey) merged 1 commit into
mainfrom
jabaile/semantic-diags-unchecked
Apr 7, 2025
Merged

Jake Bailey (jakebailey) merged 1 commit into
mainfrom
jabaile/semantic-diags-unchecked

Conversation

@jakebailey

Copy link
Copy Markdown
Member

This mirrors getBindAndCheckDiagnosticsForFileNoCache, which looks like:

    function getBindAndCheckDiagnosticsForFileNoCache(
        sourceFile: SourceFile,
        cancellationToken: CancellationToken | undefined,
        nodesToCheck?: Node[],
    ): readonly Diagnostic[] {
        return runWithCancellationToken(() => {
            if (skipTypeChecking(sourceFile, options, program)) {
                return emptyArray;
            }

            const typeChecker = getTypeChecker();

Notably I am not doing this in getBindDiagnosticsForFile since that isn't actually called by anyone except tsgo for timing.

This fixes the baseline checks that were commented out in #762.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 13 changed files in this pull request and generated no comments.

Files not reviewed (10)
  • testdata/baselines/reference/submodule/compiler/intersectionsOfLargeUnions2.errors.txt: Language not supported
  • testdata/baselines/reference/submodule/compiler/intersectionsOfLargeUnions2.errors.txt.diff: Language not supported
  • testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithComputedPropertyName.errors.txt: Language not supported
  • testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithComputedPropertyName.errors.txt.diff: Language not supported
  • testdata/baselines/reference/submodule/conformance/plainJSRedeclare3.errors.txt: Language not supported
  • testdata/baselines/reference/submodule/conformance/plainJSReservedStrict.errors.txt: Language not supported
  • testdata/baselines/reference/submodule/conformance/ts-expect-error-nocheck-js.errors.txt: Language not supported
  • testdata/baselines/reference/submoduleAccepted/conformance/plainJSRedeclare3.errors.txt.diff: Language not supported
  • testdata/baselines/reference/submoduleAccepted/conformance/plainJSReservedStrict.errors.txt.diff: Language not supported
  • testdata/baselines/reference/submoduleAccepted/conformance/ts-expect-error-nocheck-js.errors.txt.diff: Language not supported
Comments suppressed due to low confidence (1)

internal/checker/utilities.go:1783

  • Ensure that replacing tspath.IsDeclarationFileName(sourceFile.FileName()) with sourceFile.IsDeclarationFile provides the same behavior in all scenarios. It is important that this change does not inadvertently affect the logic for identifying declaration files.
func SkipTypeChecking(sourceFile *ast.SourceFile, options *core.CompilerOptions) bool {

}

func (p *Program) getBindDiagnosticsForFile(sourceFile *ast.SourceFile) []*ast.Diagnostic {
// TODO: restore this; tsgo's main depends on this function binding all files for timing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When and why would we restore this? Seems odd for skipLibChecks to affect binding.

@jakebailey Jake Bailey (jakebailey) Apr 7, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have one function that gets both bind and check diagnostics (getBindAndCheckDiagnosticsForFileNoCache), and it's silenced by this same function in Strada. Why? I have no idea, but that's how it was. It's just that they are split apart in Corsa for timing reasons at the moment.

Merged via the queue into main with commit 704f06c Apr 7, 2025
@jakebailey
Jake Bailey (jakebailey) deleted the jabaile/semantic-diags-unchecked branch April 7, 2025 20:31
Aman Karmani (tmm1) added a commit to tmm1/typescript-go that referenced this pull request Apr 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants