Skip to content

Ensure we use the right checker in declaration diagnostics, fix lifetime #1309

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Jun 27, 2025

Propagate the request-scoped checker to declaration diagnostics. This was a TODO, and the main source of races. This involved a bunch of surgery but I think the new code makes sense?

Fixes #1160 (probably)

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

Propagate a request-scoped checker into declaration diagnostics and update EmitResolver APIs to remove the file parameter, reducing races.

  • Switched GetEmitResolver(file) APIs to GetEmitResolver() and threaded a per-file checker via newEmitHost
  • Updated NewDeclarationTransformer to pull its resolver from the host directly
  • Adjusted diagnostic and emitter logic to use context-bound hosts

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/transformers/tstransforms/importelision_test.go Updated test to call the no-arg GetEmitResolver
internal/transformers/declarations/transform.go Removed resolver parameter from constructor, fetching via host
internal/printer/emithost.go Changed EmitHost API to use no-arg GetEmitResolver
internal/compiler/program.go Rewrote declaration diagnostics to use newEmitHost with context
internal/compiler/emitter.go Updated emitter methods to drop file arg and add SourceFiles()
internal/compiler/emitHost.go Introduced newEmitHost, removed old resolver method
internal/checker/symbolaccessibility.go Cleaned up GetEmitResolver() call
internal/checker/nodebuilderimpl.go Cleaned up GetEmitResolver() calls
internal/checker/checker.go Simplified GetEmitResolver() signature
Comments suppressed due to low confidence (1)

internal/compiler/emitHost.go:34

  • The EmitHost interface removed its old GetEmitResolver(file) method but does not declare the new zero-argument GetEmitResolver() method. Add GetEmitResolver() printer.EmitResolver to the interface so emitHost satisfies it.
	IsEmitBlocked(file string) bool

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.

concurrent map read and map write in getTypeOnlyAliasDeclarationEx
1 participant