Skip to content

Commit 95aa46e

Browse files
committed
Allow enum datastructures to be @shared
1 parent 5bff0ce commit 95aa46e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/transform/CheckReentrant.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ class CheckReentrant extends MiniPhase {
4343

4444
def isIgnored(sym: Symbol)(implicit ctx: Context): Boolean =
4545
sym.hasAnnotation(sharableAnnot()) ||
46-
sym.hasAnnotation(unsharedAnnot())
46+
sym.hasAnnotation(unsharedAnnot()) ||
47+
sym.owner == defn.EnumValuesClass
48+
// enum values are initialized eagerly before use
49+
// in the long run, we should make them vals
4750

4851
def scanning(sym: Symbol)(op: => Unit)(implicit ctx: Context): Unit = {
4952
ctx.log(i"${" " * indent}scanning $sym")

0 commit comments

Comments
 (0)