@@ -104,7 +104,7 @@ object DesugarEnums {
104
104
105
105
/** The following lists of definitions for an enum type E and known value cases e_0, ..., e_n:
106
106
*
107
- * private val $values = Array[E](this.e_0,...,this.e_n)(ClassTag[E](classOf[E])): @unchecked
107
+ * private val $values = Array[E](this.e_0,...,this.e_n)(ClassTag[E](classOf[E]))
108
108
* def values = $values.clone
109
109
* def valueOf($name: String) = $name match {
110
110
* case "e_0" => this.e_0
@@ -118,15 +118,7 @@ object DesugarEnums {
118
118
extension (tpe : NamedType ) def ofRawEnum = AppliedTypeTree (ref(tpe), rawEnumClassRef)
119
119
120
120
val privateValuesDef =
121
- val uncheckedValues =
122
- // Here we use an unchecked annotation to silence warnings from the init checker. Without it, we get a warning
123
- // that simple enum cases are promoting this from warm to initialised. This is because we are populating the
124
- // array by selecting enum values from `this`, a value under construction.
125
- // Singleton enum values always construct a new anonymous class, which will not be checked by the init-checker,
126
- // so this warning will always persist even if the implementation of the anonymous class is safe.
127
- // TODO: remove @unchecked after https://github.com/lampepfl/dotty-feature-requests/issues/135 is resolved.
128
- Annotated (ArrayLiteral (enumValues, rawEnumClassRef), New (ref(defn.UncheckedAnnot .typeRef), Nil ))
129
- ValDef (nme.DOLLAR_VALUES , TypeTree (), uncheckedValues)
121
+ ValDef (nme.DOLLAR_VALUES , TypeTree (), ArrayLiteral (enumValues, rawEnumClassRef))
130
122
.withFlags(Private | Synthetic )
131
123
132
124
val valuesDef =
0 commit comments