Skip to content

Commit

Permalink
FIXUP
Browse files Browse the repository at this point in the history
  • Loading branch information
migesok committed Sep 5, 2024
1 parent e2d1f49 commit f76a420
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ object Behavior {
def empty[A]: Behavior[A] = Rcv.empty

def onMsg[A](onMsg: Signal.Msg[A] => Behavior[A]): Behavior[A] = Behavior[A] {
//workaround for Scala 3.3.0 compiler quirk:
// asInstanceOf added because of a compilation error on pattern matching,
// it complained about non-exhaustive match but suggested cases were non-existing
//
//old code: case signal: Signal.Msg[A] => onMsg(signal)
case signal: Signal.Msg[?] => onMsg(signal.asInstanceOf[Signal.Msg[A]])
case _: Signal.System => same
//@unchecked needed to work around a Scala 3.3.0 compiler quirk with pattern matching
case signal: Signal.Msg[A@unchecked] => onMsg(signal)
case _: Signal.System => same
}

def stateless[A](onMsg: Signal[A] => Unit): Behavior[A] = Behavior[A] { signal =>
Expand All @@ -30,13 +26,9 @@ object Behavior {
}

def statelessOnMsg[A](onMsg: Signal.Msg[A] => Unit): Behavior[A] = stateless[A] {
//workaround for Scala 3.3.0 compiler quirk:
// asInstanceOf added because of a compilation error on pattern matching,
// it complained about non-exhaustive match but suggested cases were non-existing
//
//old code: case signal: Signal.Msg[A] => onMsg(signal)
case signal: Signal.Msg[?] => onMsg(signal.asInstanceOf[Signal.Msg[A]])
case _ => ()
//@unchecked needed to work around a Scala 3.3.0 compiler quirk with pattern matching
case signal: Signal.Msg[A@unchecked] => onMsg(signal)
case _ => ()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@ object SafeActorRef {
def unsafe = ref.unsafe
def tell[C](msg: C, sender: Option[ActorRef])(implicit canRcv: CanRcv[C, A]) = canRcv match {
case CanRcv.Identity => ref.tell(f(msg.asInstanceOf[A]), sender)(CanRcv.identity)
//workaround for Scala 3.3.0 compiler quirk:
// asInstanceOf added because of a compilation error on pattern matching,
// it complained about non-exhaustive match but suggested cases were non-existing
//
//old code: case canRcv: CanRcv.Sys[C] => ref.tell(msg, sender)(canRcv)
case canRcv: CanRcv.Sys[?] => ref.tell(msg, sender)(canRcv.asInstanceOf[CanRcv.Sys[C]])
//@unchecked needed to work around a Scala 3.3.0 compiler quirk with pattern matching
case canRcv: CanRcv.Sys[C@unchecked] => ref.tell(msg, sender)(canRcv)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,8 @@ object AsyncBehavior {
case Some(newState) => nextHandler(newState, queue)
case None =>
val signals = queue collect {
//workaround for Scala 3.3.0 compiler quirk:
// asInstanceOf added because of a compilation error on pattern matching,
// it complained about non-exhaustive match but suggested cases were non-existing
//
//old code: case SignalAndHandler(signal: Signal.Msg[M], _) => signal
case SignalAndHandler(signal: Signal.Msg[?], _) => signal.asInstanceOf[Signal.Msg[M]]
//@unchecked needed to work around a Scala 3.3.0 compiler quirk with pattern matching
case SignalAndHandler(signal: Signal.Msg[M@unchecked], _) => signal
}
onStop(signals.toList)
Behavior.stop
Expand Down

0 comments on commit f76a420

Please sign in to comment.