@@ -92,15 +92,9 @@ object DesugarEnums {
9292 private def valuesDot (name : PreName )(implicit src : SourceFile ) =
9393 Select (Ident (nme.DOLLAR_VALUES ), name.toTermName)
9494
95- private def ArrayLiteral (values : List [Tree ], tpt : Tree )(using Context ): Tree =
96- val clazzOf = TypeApply (ref(defn.Predef_classOf .termRef), tpt :: Nil )
97- val ctag = Apply (TypeApply (ref(defn.ClassTagModule_apply .termRef), tpt :: Nil ), clazzOf :: Nil )
98- val apply = Select (ref(defn.ArrayModule .termRef), nme.apply)
99- Apply (Apply (TypeApply (apply, tpt :: Nil ), values), ctag :: Nil )
100-
10195 /** The following lists of definitions for an enum type E and known value cases e_0, ..., e_n:
10296 *
103- * private val $values = Array[E]( e_0,...,e_n)(ClassTag[E](classOf[E]))
97+ * private val $values = [ e_0, ..., e_n : E]
10498 * @annotation.threadUnsafe private lazy val $valuesReverse =
10599 * scala.runtime.ScalaRuntime.wrapRefArray($values).map((x_0: E) => (x_0.enumLabel, x_0)).toMap
106100 * def values = $values.clone
@@ -117,9 +111,8 @@ object DesugarEnums {
117111 extension (tpe : NamedType ) def ofRawEnum = AppliedTypeTree (ref(tpe), rawEnumClassRef)
118112
119113 val privateValuesDef =
120- ValDef (nme.DOLLAR_VALUES , TypeTree (),
121- ArrayLiteral (enumCases.map((_, name) => Ident (name)), rawEnumClassRef))
122- .withFlags(Private | Synthetic )
114+ ValDef (nme.DOLLAR_VALUES , TypeTree (), JavaSeqLiteral (enumCases.map((_, name) => Ident (name)), rawEnumClassRef))
115+ .withFlags(Private | Synthetic )
123116
124117 val privateReverseValuesDef =
125118 val wrapped = Apply (Select (ref(defn.ScalaRuntimeModule .termRef), nme.wrapRefArray), Ident (nme.DOLLAR_VALUES ))
0 commit comments