From 2d07bd558b994468780b40b90fba20f1f265b9be Mon Sep 17 00:00:00 2001 From: odersky Date: Sun, 1 Oct 2023 18:23:30 +0200 Subject: [PATCH] Add @sharable annotation to global counter --- compiler/src/dotty/tools/dotc/cc/CaptureRoot.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/cc/CaptureRoot.scala b/compiler/src/dotty/tools/dotc/cc/CaptureRoot.scala index 6bab3d331bb7..6913740307ae 100644 --- a/compiler/src/dotty/tools/dotc/cc/CaptureRoot.scala +++ b/compiler/src/dotty/tools/dotc/cc/CaptureRoot.scala @@ -9,12 +9,13 @@ import printing.Showable import util.SimpleIdentitySet import Decorators.i import scala.annotation.constructorOnly +import scala.annotation.internal.sharable type CaptureRoot = TermRef | CaptureRoot.Var object CaptureRoot: - private var nextId = 0 + @sharable private var nextId = 0 case class Var(owner: Symbol, source: Symbol)(using @constructorOnly ictx: Context) extends CaptureRef, Showable: