Skip to content

Commit

Permalink
Add @unchecked to avoid warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Dec 1, 2023
1 parent a89cf08 commit fa0ef36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/conversions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ object Unapply:
text =>
import scala.reflect.Selectable.reflectiveSelectable
mirror match
case mirror: { def valueOf(name: String): EnumType } =>
case mirror: { def valueOf(name: String): EnumType } @unchecked =>
try Some(mirror.valueOf(text.s)) catch case error: Exception => None

given fromOrdinal[EnumType <: reflect.Enum](using mirror: Mirror.SumOf[EnumType]): Unapply[Int, EnumType] =
ordinal =>
import scala.reflect.Selectable.reflectiveSelectable
mirror match
case mirror: { def fromOrdinal(ordinal: Int): EnumType } =>
case mirror: { def fromOrdinal(ordinal: Int): EnumType } @unchecked =>
try Some(mirror.fromOrdinal(ordinal)) catch case error: Exception => None

trait Unapply[-ValueType, +ResultType]:
Expand Down

0 comments on commit fa0ef36

Please sign in to comment.