@@ -92,15 +92,9 @@ object DesugarEnums {
92
92
private def valuesDot (name : PreName )(implicit src : SourceFile ) =
93
93
Select (Ident (nme.DOLLAR_VALUES ), name.toTermName)
94
94
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
-
101
95
/** The following lists of definitions for an enum type E and known value cases e_0, ..., e_n:
102
96
*
103
- * private val $values = Array[E]( e_0,...,e_n)(ClassTag[E](classOf[E]))
97
+ * private val $values = [ e_0, ..., e_n : E]
104
98
* @annotation.threadUnsafe private lazy val $valuesReverse =
105
99
* scala.runtime.ScalaRuntime.wrapRefArray($values).map((x_0: E) => (x_0.enumLabel, x_0)).toMap
106
100
* def values = $values.clone
@@ -117,9 +111,8 @@ object DesugarEnums {
117
111
extension (tpe : NamedType ) def ofRawEnum = AppliedTypeTree (ref(tpe), rawEnumClassRef)
118
112
119
113
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 )
123
116
124
117
val privateReverseValuesDef =
125
118
val wrapped = Apply (Select (ref(defn.ScalaRuntimeModule .termRef), nme.wrapRefArray), Ident (nme.DOLLAR_VALUES ))
0 commit comments