Fix compilation error in ActorContextDelegateSpec with Scala 2.12 (#31509)

This commit is contained in:
Patrik Nordwall 2022-08-26 16:25:57 +02:00 committed by GitHub
parent 574600c742
commit 2cbc0e63a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View file

@ -213,7 +213,8 @@ public class InteractionPatternsAskWithStatusTest extends JUnitSuite {
cookies.whenComplete(
(cookiesReply, failure) -> {
if (cookiesReply != null) System.out.println("Yay, " + cookiesReply.count + " cookies!");
if (cookiesReply != null)
System.out.println("Yay, " + cookiesReply.count + " cookies!");
else System.out.println("Boo! didn't get cookies in time. " + failure);
});
// #standalone-ask-with-status-fail-future

View file

@ -29,22 +29,22 @@ object ActorContextDelegateSpec {
case Ping =>
monitor ! ResponseFrom(PingTag, Ping)
Behaviors.same
case msg @ Pong =>
case Pong =>
monitor ! ForwardTo(PongTag)
context.delegate(pong(monitor), msg)
context.delegate(pong(monitor), Pong)
}
def pong(monitor: ActorRef[Event])(implicit context: ActorContext[PingPongCommand]): Behavior[PingPongCommand] =
Behaviors.receiveMessage[PingPongCommand] {
case msg @ Ping =>
case Ping =>
monitor ! ForwardTo(PingTag)
context.delegate(ping(monitor), msg)
context.delegate(ping(monitor), Ping)
case Pong =>
monitor ! ResponseFrom(PongTag, Pong)
Behaviors.same
case msg @ UnPingable =>
case UnPingable =>
monitor ! ForwardTo(PingTag)
context.delegate(ping(monitor), msg)
context.delegate(ping(monitor), UnPingable)
}
}