Skip to content

Commit 0ecbcfb

Browse files
committed
Do not access enum symbol in DesugarEnums
Follow up of #19182. Using `fullName` causes the the `parallelBackend` tests to loop forever. Fixes #19285 Fixes #19281 Fixes #19278
1 parent 69cc6b1 commit 0ecbcfb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ object DesugarEnums {
126126

127127
val valuesOfBody: Tree =
128128
val defaultCase =
129-
val msg = Apply(Select(Literal(Constant(s"enum ${enumClass.fullName} has no case with name: ")), nme.PLUS), Ident(nme.nameDollar))
129+
val msg = Apply(Select(Literal(Constant(i"enum $rawEnumClassRef has no case with name: ")), nme.PLUS), Ident(nme.nameDollar))
130130
CaseDef(Ident(nme.WILDCARD), EmptyTree,
131131
Throw(New(TypeTree(defn.IllegalArgumentExceptionType), List(msg :: Nil))))
132132
val stringCases = enumValues.map(enumValue =>
@@ -143,12 +143,13 @@ object DesugarEnums {
143143
}
144144

145145
private def enumLookupMethods(constraints: EnumConstraints)(using Context): List[Tree] =
146+
val rawEnumClassRef = rawRef(enumClass.typeRef)
146147
def scaffolding: List[Tree] =
147148
if constraints.isEnumeration then enumScaffolding(constraints.enumCases.map(_._2)) else Nil
148149
def valueCtor: List[Tree] = if constraints.requiresCreator then enumValueCreator :: Nil else Nil
149150
def fromOrdinal: Tree =
150151
def throwArg(ordinal: Tree) =
151-
val msg = Apply(Select(Literal(Constant(s"enum ${enumClass.fullName} has no case with ordinal: ")), nme.PLUS), Select(ordinal, nme.toString_))
152+
val msg = Apply(Select(Literal(Constant(i"enum $rawEnumClassRef has no case with ordinal: ")), nme.PLUS), Select(ordinal, nme.toString_))
152153
Throw(New(TypeTree(defn.NoSuchElementExceptionType), List(msg :: Nil)))
153154
if !constraints.cached then
154155
fromOrdinalMeth(throwArg)

0 commit comments

Comments
 (0)