Skip to content

Commit

Permalink
add explicit Any type parameter to methods of the PartialFunctionOps
Browse files Browse the repository at this point in the history
  • Loading branch information
halotukozak committed Oct 1, 2024
1 parent e9b4d63 commit 3219229
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -511,17 +511,17 @@ object SharedExtensionsUtils extends SharedExtensions {
*/
def unless(pre: PartialFunction[A, B]): PartialFunction[A, B] = pre orElse pf

def applyNOpt(a: A): NOpt[B] = pf.applyOrElse(a, NoValueMarkerFunc) match {
def applyNOpt(a: A): NOpt[B] = pf.applyOrElse[A, Any](a, NoValueMarkerFunc) match {
case NoValueMarker => NOpt.Empty
case rawValue => NOpt.some(rawValue.asInstanceOf[B])
}

def applyOpt(a: A): Opt[B] = pf.applyOrElse(a, NoValueMarkerFunc) match {
def applyOpt(a: A): Opt[B] = pf.applyOrElse[A, Any](a, NoValueMarkerFunc) match {
case NoValueMarker => Opt.Empty
case rawValue => Opt(rawValue.asInstanceOf[B])
}

def fold[C](a: A)(forEmpty: A => C, forNonEmpty: B => C): C = pf.applyOrElse(a, NoValueMarkerFunc) match {
def fold[C](a: A)(forEmpty: A => C, forNonEmpty: B => C): C = pf.applyOrElse[A, Any](a, NoValueMarkerFunc) match {
case NoValueMarker => forEmpty(a)
case rawValue => forNonEmpty(rawValue.asInstanceOf[B])
}
Expand Down

0 comments on commit 3219229

Please sign in to comment.