Skip to content

Keep computed-name reconstruction out of symbol tracking - #64208

Merged
Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
jakebailey:fix-declaration-emit-visibility
Sep 17, 2026
Merged

Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
jakebailey:fix-declaration-emit-visibility

Conversation

@jakebailey

Copy link
Copy Markdown
Member

This should be the actual fix for the problem I tried to fix in #63986.

The first commit has a test which shows the bad behavior consistently, the second fixes it.

Record declaration emit retaining an otherwise unused namespace after
serializing a computed property from another file. The referenced type
is stripped, so the namespace should not survive in declaration output.
Computed property references are already checked in the destination
scope. Reconstructing their source spelling must not track a second
reference in the source scope, which could paint declarations visible
for another file's emitter.

Separate expression construction from reference tracking and use the
untracked path when reconstructing computed names. Update the regression
baseline so the otherwise unused namespace is no longer emitted.
Copilot AI balanced review requested due to automatic review settings September 9, 2026 00:11
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 9, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 9, 2026

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.

🟢 Approval recommended

The tracking change is narrowly scoped and the regression baselines verify the corrected declaration visibility behavior.

Pull request overview

Prevents computed-name reconstruction from incorrectly marking source-scope declarations as visible during declaration emit.

Changes:

  • Separates symbol tracking from expression reconstruction.
  • Adds a regression test for cross-file computed names with stripInternal.
  • Adds expected diagnostic, emit, type, and symbol baselines.
File summaries
File Description
tsc/internal/checker/nodebuilderimpl.go Uses untracked reconstruction for computed property names.
tsc/testdata/tests/cases/compiler/declarationEmitComputedPropertyNameSymbolStripInternal.ts Adds the regression scenario.
tsc/testdata/baselines/reference/compiler/declarationEmitComputedPropertyNameSymbolStripInternal.js Records declaration output.
tsc/testdata/baselines/reference/compiler/declarationEmitComputedPropertyNameSymbolStripInternal.errors.txt Records the expected diagnostic.
tsc/testdata/baselines/reference/compiler/declarationEmitComputedPropertyNameSymbolStripInternal.symbols Records symbol information.
tsc/testdata/baselines/reference/compiler/declarationEmitComputedPropertyNameSymbolStripInternal.types Records inferred types.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@weswigham Wesley Wigham (weswigham) left a comment

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.

You know, I think I've actually been working around downstream issues caused by that painting in other bug fixes for a very long time, and just assumed that potential cross-file visibility painting was how it be, for reasons. Excellent root cause to fix.

@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Sep 17, 2026
@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Sep 17, 2026
Merged via the queue into microsoft:main with commit 3d76cf2 Sep 17, 2026
26 checks passed
@jakebailey
Jake Bailey (jakebailey) deleted the fix-declaration-emit-visibility branch September 17, 2026 23:15
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants