Skip to content

Reset comparersInUse to zero in ContextState.reset #18915

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

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/core/Contexts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,7 @@ object Contexts {
sources.clear()
files.clear()
comparers.clear() // forces re-evaluation of top and bottom classes in TypeComparer
comparersInUse = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

For additional context, this needs to be reset because the compilation unit was suspended due to the macro dependency. We need to set it back to 0 each time we restart compilation after the suspension.


// Test that access is single threaded

Expand Down
3 changes: 3 additions & 0 deletions tests/pos-macros/i18855/invoc.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import scala.language.experimental.captureChecking
val x = run()

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

7 changes: 7 additions & 0 deletions tests/pos-macros/i18855/macro.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import scala.quoted.*
import scala.language.experimental.captureChecking

def impl()(using Quotes): Expr[Unit] = '{()}
inline def run(): Unit = ${impl()}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change


Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change