-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dotty syntax compat #28837
Dotty syntax compat #28837
Changes from all commits
6718c97
985d336
e3a9eff
00940ef
ac2397e
f9acfad
b16d3a4
86d7499
001d774
13b8acb
a0f063a
4c388be
7bfd2fe
ec61635
6511e53
269caba
96b825a
36a6e1a
c77d9b3
a108800
2249fdd
e227549
e65846f
c070cd7
e50d8ee
c72d1b7
936fc79
c5668f1
cf72f44
75cedfe
018a79d
31376b2
1febdae
0bea666
923ad89
d41317b
763c84a
69c7d1e
6597c81
7f734b6
b35153d
39aa1cc
da85d89
242c4c9
174dfdf
aecd9f1
57ed266
fbc29f6
ebb8527
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,8 @@ private[akka] final class BehaviorTestKitImpl[T](_path: ActorPath, _initialBehav | |
with akka.actor.testkit.typed.scaladsl.BehaviorTestKit[T] { | ||
|
||
// really this should be private, make so when we port out tests that need it | ||
private[akka] val context = new EffectfulActorContext[T](_path, () => currentBehavior) | ||
// need explicitly declaring type here because lampepfl/dotty#8675 | ||
private[akka] val context: EffectfulActorContext[T] = new EffectfulActorContext[T](_path, () => currentBehavior) | ||
|
||
private[akka] def as[U]: BehaviorTestKitImpl[U] = this.asInstanceOf[BehaviorTestKitImpl[U]] | ||
|
||
|
@@ -128,7 +129,7 @@ private[akka] final class BehaviorTestKitImpl[T](_path: ActorPath, _initialBehav | |
} catch handleException | ||
} | ||
|
||
override def runOne(): Unit = run(selfInbox.receiveMessage()) | ||
override def runOne(): Unit = run(selfInbox().receiveMessage()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better to remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also think that but the change will cause source backward incompatible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe break compatibility is acceptable with testkit modules? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a similar problem with |
||
|
||
override def signal(signal: Signal): Unit = { | ||
try { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,12 +69,12 @@ object BehaviorTestKitSpec { | |
context.stop(child) | ||
Behaviors.same | ||
case SpawnAdapter => | ||
context.spawnMessageAdapter { r: Reproduce => | ||
context.spawnMessageAdapter { (r: Reproduce) => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd probably use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. without parentheses will cause error: error] -- Error: /Users/thanhbv/ohze/oss/akka/akka-actor-testkit-typed/src/test/scala/akka/actor/testkit/typed/scaladsl/BehaviorTestKitSpec.scala:72:51
[error] 72 | context.spawnMessageAdapter[Reproduce] { r: Reproduce =>
[error] | ^^^^^^^^^^^^
[error] |parentheses are required around the parameter of a lambda
[error] |This construct can be rewritten automatically under -language:Scala2Compat -rewrite. |
||
SpawnAnonymous(r.times) | ||
} | ||
Behaviors.same | ||
case SpawnAdapterWithName(name) => | ||
context.spawnMessageAdapter({ r: Reproduce => | ||
context.spawnMessageAdapter({ (r: Reproduce) => | ||
SpawnAnonymous(r.times) | ||
}, name) | ||
Behaviors.same | ||
|
@@ -310,7 +310,7 @@ class BehaviorTestKitSpec extends AnyWordSpec with Matchers with LogCapturing { | |
val d = TestInbox[Done]() | ||
testkit.run(KillSession(sessionRef, d.ref)) | ||
|
||
d.receiveAll shouldBe Seq(Done) | ||
d.receiveAll() shouldBe Seq(Done) | ||
testkit.expectEffectType[Stopped] | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ object DeathWatchSpec { | |
context.become { | ||
case Terminated(`currentKid`) => | ||
testActor ! "GREEN" | ||
context unbecome | ||
context.unbecome() | ||
} | ||
} | ||
} | ||
|
@@ -83,7 +83,7 @@ trait DeathWatchSpec { this: AkkaSpec with ImplicitSender with DefaultTimeout => | |
|
||
"The Death Watch" must { | ||
def expectTerminationOf(actorRef: ActorRef) = | ||
expectMsgPF(5 seconds, actorRef + ": Stopped or Already terminated when linking") { | ||
expectMsgPF(5 seconds, actorRef.toString + ": Stopped or Already terminated when linking") { | ||
case WrappedTerminated(Terminated(`actorRef`)) => true | ||
} | ||
|
||
|
@@ -210,19 +210,19 @@ trait DeathWatchSpec { this: AkkaSpec with ImplicitSender with DefaultTimeout => | |
} | ||
|
||
"only notify when watching" in { | ||
val subject = system.actorOf(Props[EmptyActor]()) | ||
val subject = system.actorOf(Props[EmptyActor]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is related to ohze@34d57cd (not included here). And commented here: #28837 (comment) where you say:
Do you really need to remove case class Props(cls: Class[_])
object Props {
def apply[T: ClassTag](): Props = Props(implicitly[ClassTag[T]].runtimeClass)
}
val p = Props[String]()
println(p.cls)
[info] running Main
class java.lang.String There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I think I got why this is needed. It's not needed by dotty, but it will be better to remove because then users can't call it as previously The problem is that if we remove we make it source incompatible. We can be sure that there are many projects out there using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we are tackling this from the wrong side. The goal of the PR here, if I understand it correctly, is to make the code source compatible with the Dotty compiler. That said, we should not remove The day that we provide the binaries for Dotty/Scala3, a user willing to move to Dotty/Scala3 will have to add |
||
|
||
testActor | ||
.asInstanceOf[InternalActorRef] | ||
.sendSystemMessage(DeathWatchNotification(subject, existenceConfirmed = true, addressTerminated = false)) | ||
|
||
// the testActor is not watching subject and will not receive a Terminated msg | ||
expectNoMessage | ||
expectNoMessage() | ||
} | ||
|
||
"discard Terminated when unwatched between sysmsg and processing" in { | ||
val t1, t2 = TestLatch() | ||
val w = system.actorOf(Props[WUWatcher]().withDeploy(Deploy.local), "myDearWatcher") | ||
val w = system.actorOf(Props[WUWatcher].withDeploy(Deploy.local), "myDearWatcher") | ||
val p = TestProbe() | ||
w ! W(p.ref) | ||
w ! Latches(t1, t2) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this was been used locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It was been used locally but we could just uncomment the lines to run on CI