Skip to content

Stop capturing a Context in ScalaPrimitives#26177

Merged
SolalPirelli merged 1 commit into
scala:mainfrom
dotty-staging:solal/primitives-context
Jun 4, 2026
Merged

Stop capturing a Context in ScalaPrimitives#26177
SolalPirelli merged 1 commit into
scala:mainfrom
dotty-staging:solal/primitives-context

Conversation

@SolalPirelli
Copy link
Copy Markdown
Contributor

Could cause trouble when parallelizing the backend, and is anyway not how the rest of the backend works.

How much have you relied on LLM-based tools in this contribution?

Not at all

How was the solution tested?

Covered by existing tests (this is a refactoring)


/** Initialize the primitive map */
private def init: ReadOnlyMap[Symbol, Int] = {
private def init(using Context): ReadOnlyMap[Symbol, Int] = atPhase(Phases.flattenPhase) {
Copy link
Copy Markdown
Contributor Author

@SolalPirelli SolalPirelli May 28, 2026

Choose a reason for hiding this comment

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

Note the necessary time travel. I think what used to happen is that since primitives was lazy, it would happen to be initialized at the "right" time for the context to be in the right phase.

@SolalPirelli SolalPirelli marked this pull request as ready for review May 29, 2026 06:48
@SolalPirelli SolalPirelli requested a review from tanishiking May 29, 2026 06:49
@SolalPirelli SolalPirelli merged commit bdd156a into scala:main Jun 4, 2026
45 checks passed
@SolalPirelli SolalPirelli deleted the solal/primitives-context branch June 4, 2026 07:35
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