summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-rw-r--r--test/files/continuations-neg/trycatch2.scala6
-rw-r--r--test/files/jvm/actmig-PinS.check19
-rw-r--r--test/files/jvm/actmig-PinS.scala112
-rw-r--r--test/files/jvm/actmig-PinS_1.check19
-rw-r--r--test/files/jvm/actmig-PinS_1.scala135
-rw-r--r--test/files/jvm/actmig-PinS_2.check19
-rw-r--r--test/files/jvm/actmig-PinS_2.scala155
-rw-r--r--test/files/jvm/actmig-PinS_3.check19
-rw-r--r--test/files/jvm/actmig-PinS_3.scala161
-rw-r--r--test/files/jvm/actmig-hierarchy.check2
-rw-r--r--test/files/jvm/actmig-hierarchy_1.check2
-rw-r--r--test/files/jvm/actmig-instantiation.check8
-rw-r--r--test/files/jvm/actmig-loop-react.check15
-rw-r--r--test/files/jvm/actmig-loop-react.scala188
-rw-r--r--test/files/jvm/actmig-public-methods.check6
-rw-r--r--test/files/jvm/actmig-public-methods_1.check6
-rw-r--r--test/files/jvm/actmig-public-methods_1.scala88
-rw-r--r--test/files/jvm/actmig-react-receive.check16
-rw-r--r--test/files/jvm/actmig-react-receive.scala111
-rw-r--r--test/files/lib/scalacheck.jar.desired.sha12
-rw-r--r--test/files/neg/catch-all.check10
-rw-r--r--test/files/neg/catch-all.flags1
-rw-r--r--test/files/neg/catch-all.scala19
-rw-r--r--test/files/neg/t2442.check9
-rw-r--r--test/files/neg/t2442.flags1
-rw-r--r--test/files/neg/t2442/MyEnum.java3
-rw-r--r--test/files/neg/t2442/MySecondEnum.java6
-rw-r--r--test/files/neg/t2442/t2442.scala15
-rw-r--r--test/files/neg/t4541.check4
-rw-r--r--test/files/neg/t4541b.check4
-rw-r--r--test/files/neg/t4842.check7
-rw-r--r--test/files/neg/t4842.scala7
-rw-r--r--test/files/neg/t4989.check7
-rw-r--r--test/files/neg/t4989.scala68
-rw-r--r--test/files/neg/t5148.check2
-rw-r--r--test/files/neg/t5148.scala4
-rw-r--r--test/files/neg/t5429.check20
-rw-r--r--test/files/neg/t5617.check8
-rw-r--r--test/files/neg/t5617.scala14
-rw-r--r--test/files/neg/t5761.check16
-rw-r--r--test/files/neg/t5761.scala16
-rw-r--r--test/files/pos/rangepos-anonapply.flags1
-rw-r--r--test/files/pos/rangepos-anonapply.scala9
-rw-r--r--test/files/pos/spec-params-new.scala2
-rw-r--r--test/files/pos/t4842.scala26
-rw-r--r--test/files/pos/t5899.flags1
-rw-r--r--test/files/pos/t5899.scala19
-rw-r--r--test/files/pos/t5968.flags1
-rw-r--r--test/files/pos/t5968.scala8
-rw-r--r--test/files/run/t4809.scala34
-rw-r--r--test/files/run/t4935.check1
-rw-r--r--test/files/run/t4935.flags1
-rw-r--r--test/files/run/t4935.scala9
-rw-r--r--test/files/run/t5284.check1
-rw-r--r--test/files/run/t5284.scala25
-rw-r--r--test/files/run/t5284b.check1
-rw-r--r--test/files/run/t5284b.scala28
-rw-r--r--test/files/run/t5284c.check1
-rw-r--r--test/files/run/t5284c.scala30
-rw-r--r--test/files/run/t5914.check1
-rw-r--r--test/files/run/t5914.scala23
-rw-r--r--test/files/run/t5966.check3
-rw-r--r--test/files/run/t5966.scala9
-rw-r--r--test/files/scalacheck/CheckEither.scala1
64 files changed, 1550 insertions, 15 deletions
diff --git a/test/files/continuations-neg/trycatch2.scala b/test/files/continuations-neg/trycatch2.scala
index d61419169b..d329a3b530 100644
--- a/test/files/continuations-neg/trycatch2.scala
+++ b/test/files/continuations-neg/trycatch2.scala
@@ -12,7 +12,7 @@ object Test {
fatal[Int]
cpsIntStringInt
} catch {
- case ex =>
+ case ex: Throwable =>
cpsIntStringInt
}
@@ -20,7 +20,7 @@ object Test {
fatal[Int]
cpsIntStringInt
} catch {
- case ex =>
+ case ex: Throwable =>
cpsIntStringInt
}
@@ -30,4 +30,4 @@ object Test {
println(reset { foo2; "3" })
}
-} \ No newline at end of file
+}
diff --git a/test/files/jvm/actmig-PinS.check b/test/files/jvm/actmig-PinS.check
new file mode 100644
index 0000000000..bdbdf8a692
--- /dev/null
+++ b/test/files/jvm/actmig-PinS.check
@@ -0,0 +1,19 @@
+I'm acting!
+I'm acting!
+I'm acting!
+I'm acting!
+I'm acting!
+Post stop
+To be or not to be.
+To be or not to be.
+To be or not to be.
+To be or not to be.
+To be or not to be.
+That is the question.
+That is the question.
+That is the question.
+That is the question.
+That is the question.
+received message: hi there
+received message: 15
+Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS.scala b/test/files/jvm/actmig-PinS.scala
new file mode 100644
index 0000000000..39f8f04b3b
--- /dev/null
+++ b/test/files/jvm/actmig-PinS.scala
@@ -0,0 +1,112 @@
+import scala.actors._
+import scala.concurrent.util.duration._
+import scala.concurrent.{ Promise, Await }
+
+import scala.actors.Actor._
+
+/* PinS, Listing 32.1: A simple actor
+ */
+object SillyActor extends Actor {
+ def act() {
+ for (i <- 1 to 5)
+ println("I'm acting!")
+
+ println("Post stop")
+ }
+}
+
+object SeriousActor extends Actor {
+ def act() {
+ for (i <- 1 to 5)
+ println("To be or not to be.")
+ }
+}
+
+/* PinS, Listing 32.3: An actor that calls react
+ */
+object NameResolver extends Actor {
+ import java.net.{InetAddress, UnknownHostException}
+
+ def act() {
+ react {
+ case (name: String, actor: Actor) =>
+ actor ! getIp(name)
+ act()
+ case "EXIT" =>
+ println("Name resolver exiting.")
+ // quit
+ case msg =>
+ println("Unhandled message: " + msg)
+ act()
+ }
+ }
+
+ def getIp(name: String): Option[InetAddress] = {
+ try {
+ Some(InetAddress.getByName(name))
+ } catch {
+ case _: UnknownHostException => None
+ }
+ }
+
+}
+
+object Test extends App {
+ /* PinS, Listing 32.2: An actor that calls receive
+ */
+ def makeEchoActor(): Actor = actor {
+ while (true) {
+ receive {
+ case 'stop =>
+ exit()
+ case msg =>
+ println("received message: " + msg)
+ }
+ }
+ }
+
+ /* PinS, page 696
+ */
+ def makeIntActor(): Actor = actor {
+ receive {
+ case x: Int => // I only want Ints
+ println("Got an Int: " + x)
+ }
+ }
+
+ actor {
+ self.trapExit = true
+ self.link(SillyActor)
+ SillyActor.start()
+ react {
+ case Exit(SillyActor, _) =>
+ self.link(SeriousActor)
+ SeriousActor.start()
+ react {
+ case Exit(SeriousActor, _) =>
+ val seriousPromise2 = Promise[Boolean]
+ // PinS, page 694
+ val seriousActor2 = actor {
+ for (i <- 1 to 5)
+ println("That is the question.")
+ seriousPromise2.success(true)
+ }
+
+ Await.ready(seriousPromise2.future, 5 seconds)
+ val echoActor = makeEchoActor()
+ self.link(echoActor)
+ echoActor ! "hi there"
+ echoActor ! 15
+ echoActor ! 'stop
+ react {
+ case Exit(_, _) =>
+ val intActor = makeIntActor()
+ intActor ! "hello"
+ intActor ! math.Pi
+ // only the following send leads to output
+ intActor ! 12
+ }
+ }
+ }
+ }
+}
diff --git a/test/files/jvm/actmig-PinS_1.check b/test/files/jvm/actmig-PinS_1.check
new file mode 100644
index 0000000000..bdbdf8a692
--- /dev/null
+++ b/test/files/jvm/actmig-PinS_1.check
@@ -0,0 +1,19 @@
+I'm acting!
+I'm acting!
+I'm acting!
+I'm acting!
+I'm acting!
+Post stop
+To be or not to be.
+To be or not to be.
+To be or not to be.
+To be or not to be.
+To be or not to be.
+That is the question.
+That is the question.
+That is the question.
+That is the question.
+That is the question.
+received message: hi there
+received message: 15
+Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS_1.scala b/test/files/jvm/actmig-PinS_1.scala
new file mode 100644
index 0000000000..1fb50567b9
--- /dev/null
+++ b/test/files/jvm/actmig-PinS_1.scala
@@ -0,0 +1,135 @@
+import scala.actors._
+import scala.concurrent.util.duration._
+import scala.concurrent.{ Promise, Await }
+
+object SillyActor {
+ val startPromise = Promise[Boolean]()
+ val ref = MigrationSystem.actorOf(Props(() => new SillyActor, "akka.actor.default-stash-dispatcher"))
+}
+
+/* PinS, Listing 32.1: A simple actor
+ */
+class SillyActor extends Actor {
+
+ def act() {
+ Await.ready(SillyActor.startPromise.future, 5 seconds)
+ for (i <- 1 to 5)
+ println("I'm acting!")
+
+ println("Post stop")
+ }
+}
+
+object SeriousActor {
+ val startPromise = Promise[Boolean]()
+ val ref = MigrationSystem.actorOf(Props(() => new SeriousActor, "akka.actor.default-stash-dispatcher"))
+}
+
+class SeriousActor extends Actor {
+ def act() {
+ // used to make this test deterministic
+ Await.ready(SeriousActor.startPromise.future, 5 seconds)
+ for (i <- 1 to 5)
+ println("To be or not to be.")
+ }
+}
+
+/* PinS, Listing 32.3: An actor that calls react
+ */
+object NameResolver extends Actor {
+ import java.net.{ InetAddress, UnknownHostException }
+
+ def act() {
+ react {
+ case (name: String, actor: Actor) =>
+ actor ! getIp(name)
+ act()
+ case "EXIT" =>
+ println("Name resolver exiting.")
+ // quit
+ case msg =>
+ println("Unhandled message: " + msg)
+ act()
+ }
+ }
+
+ def getIp(name: String): Option[InetAddress] = {
+ try {
+ Some(InetAddress.getByName(name))
+ } catch {
+ case _: UnknownHostException => None
+ }
+ }
+
+}
+
+object Test extends App {
+
+ /* PinS, Listing 32.2: An actor that calls receive
+ */
+ def makeEchoActor(): ActorRef = MigrationSystem.actorOf(Props(() => new Actor {
+ def act() {
+ while (true) {
+ receive {
+ case 'stop =>
+ exit()
+ case msg =>
+ println("received message: " + msg)
+ }
+ }
+ }
+ }, "akka.actor.default-stash-dispatcher"))
+
+ /* PinS, page 696
+ */
+ def makeIntActor(): ActorRef = MigrationSystem.actorOf(Props(() => new Actor {
+ def act() {
+ receive {
+ case x: Int => // I only want Ints
+ println("Got an Int: " + x)
+ }
+ }
+ }, "akka.actor.default-stash-dispatcher"))
+
+ MigrationSystem.actorOf(Props(() => new Actor {
+ def act() {
+ trapExit = true
+ link(SillyActor.ref)
+ SillyActor.startPromise.success(true)
+ react {
+ case Exit(_: SillyActor, _) =>
+ link(SeriousActor.ref)
+ SeriousActor.startPromise.success(true)
+ react {
+ case Exit(_: SeriousActor, _) =>
+ val seriousPromise2 = Promise[Boolean]()
+ // PinS, page 694
+ val seriousActor2 = MigrationSystem.actorOf(Props(() =>
+ new Actor {
+ def act() {
+ for (i <- 1 to 5)
+ println("That is the question.")
+ seriousPromise2.success(true)
+ }
+ }
+ , "akka.actor.default-stash-dispatcher"))
+
+ Await.ready(seriousPromise2.future, 5 seconds)
+ val echoActor = makeEchoActor()
+ link(echoActor)
+ echoActor ! "hi there"
+ echoActor ! 15
+ echoActor ! 'stop
+ react {
+ case Exit(_, _) =>
+ val intActor = makeIntActor()
+ intActor ! "hello"
+ intActor ! math.Pi
+ // only the following send leads to output
+ intActor ! 12
+ }
+ }
+ }
+ }
+ }, "akka.actor.default-stash-dispatcher"))
+}
diff --git a/test/files/jvm/actmig-PinS_2.check b/test/files/jvm/actmig-PinS_2.check
new file mode 100644
index 0000000000..bdbdf8a692
--- /dev/null
+++ b/test/files/jvm/actmig-PinS_2.check
@@ -0,0 +1,19 @@
+I'm acting!
+I'm acting!
+I'm acting!
+I'm acting!
+I'm acting!
+Post stop
+To be or not to be.
+To be or not to be.
+To be or not to be.
+To be or not to be.
+To be or not to be.
+That is the question.
+That is the question.
+That is the question.
+That is the question.
+That is the question.
+received message: hi there
+received message: 15
+Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS_2.scala b/test/files/jvm/actmig-PinS_2.scala
new file mode 100644
index 0000000000..46277efd43
--- /dev/null
+++ b/test/files/jvm/actmig-PinS_2.scala
@@ -0,0 +1,155 @@
+import scala.actors.{ MigrationSystem, StashingActor, ActorRef, Props, Exit }
+import scala.concurrent.util.duration._
+import scala.concurrent.{ Promise, Await }
+
+object SillyActor {
+ val startPromise = Promise[Boolean]()
+ val ref = MigrationSystem.actorOf(Props(() => new SillyActor, "default-stash-dispatcher"))
+}
+
+/* PinS, Listing 32.1: A simple actor
+ */
+class SillyActor extends StashingActor {
+
+ def receive = { case _ => println("Nop") }
+
+ override def act() {
+ Await.ready(SillyActor.startPromise.future, 5 seconds)
+ for (i <- 1 to 5)
+ println("I'm acting!")
+
+ println("Post stop")
+ }
+}
+
+object SeriousActor {
+ val startPromise = Promise[Boolean]()
+ val ref = MigrationSystem.actorOf(Props(() => new SeriousActor, "default-stash-dispatcher"))
+}
+
+class SeriousActor extends StashingActor {
+ def receive = { case _ => println("Nop") }
+ override def act() {
+ Await.ready(SeriousActor.startPromise.future, 5 seconds)
+ for (i <- 1 to 5)
+ println("To be or not to be.")
+ }
+}
+
+/* PinS, Listing 32.3: An actor that calls react
+ */
+object NameResolver {
+ val ref = MigrationSystem.actorOf(Props(() => new NameResolver, "default-stash-dispatcher"))
+}
+
+class NameResolver extends StashingActor {
+ import java.net.{ InetAddress, UnknownHostException }
+
+ def receive = { case _ => println("Nop") }
+
+ override def act() {
+ react {
+ case (name: String, actor: ActorRef) =>
+ actor ! getIp(name)
+ act()
+ case "EXIT" =>
+ println("Name resolver exiting.")
+ // quit
+ case msg =>
+ println("Unhandled message: " + msg)
+ act()
+ }
+ }
+
+ def getIp(name: String): Option[InetAddress] = {
+ try {
+ Some(InetAddress.getByName(name))
+ } catch {
+ case _: UnknownHostException => None
+ }
+ }
+
+}
+
+object Test extends App {
+
+ /* PinS, Listing 32.2: An actor that calls receive
+ */
+ def makeEchoActor(): ActorRef = MigrationSystem.actorOf(Props(() =>
+ new StashingActor {
+ def receive = { case _ => println("Nop") }
+
+ override def act() {
+ loop {
+ react {
+ case 'stop =>
+ exit()
+ case msg =>
+ println("received message: " + msg)
+ }
+ }
+ }
+ }, "default-stash-dispatcher"))
+
+ /* PinS, page 696
+ */
+ def makeIntActor(): ActorRef = MigrationSystem.actorOf(Props(() =>new StashingActor {
+
+ def receive = { case _ => println("Nop") }
+
+ override def act() {
+ react {
+ case x: Int => // I only want Ints
+ println("Got an Int: " + x)
+ }
+ }
+ }, "default-stash-dispatcher"))
+
+ MigrationSystem.actorOf(Props(() => new StashingActor {
+
+ def receive = { case _ => println("Nop") }
+
+ override def act() {
+ trapExit = true
+ link(SillyActor.ref)
+ SillyActor.startPromise.success(true)
+ react {
+ case Exit(_: SillyActor, _) =>
+ link(SeriousActor.ref)
+ SeriousActor.startPromise.success(true)
+ react {
+ case Exit(_: SeriousActor, _) =>
+ val seriousPromise2 = Promise[Boolean]()
+ // PinS, page 694
+ val seriousActor2 = MigrationSystem.actorOf(Props(() =>{
+ new StashingActor {
+
+ def receive = { case _ => println("Nop") }
+
+ override def act() {
+ for (i <- 1 to 5)
+ println("That is the question.")
+ seriousPromise2.success(true)
+ }
+ }
+ }, "default-stash-dispatcher"))
+
+ Await.ready(seriousPromise2.future, 5 seconds)
+ val echoActor = makeEchoActor()
+ link(echoActor)
+ echoActor ! "hi there"
+ echoActor ! 15
+ echoActor ! 'stop
+ react {
+ case Exit(_, _) =>
+ val intActor = makeIntActor()
+ intActor ! "hello"
+ intActor ! math.Pi
+ // only the following send leads to output
+ intActor ! 12
+ }
+ }
+ }
+ }
+ }, "default-stash-dispatcher"))
+}
diff --git a/test/files/jvm/actmig-PinS_3.check b/test/files/jvm/actmig-PinS_3.check
new file mode 100644
index 0000000000..bdbdf8a692
--- /dev/null
+++ b/test/files/jvm/actmig-PinS_3.check
@@ -0,0 +1,19 @@
+I'm acting!
+I'm acting!
+I'm acting!
+I'm acting!
+I'm acting!
+Post stop
+To be or not to be.
+To be or not to be.
+To be or not to be.
+To be or not to be.
+To be or not to be.
+That is the question.
+That is the question.
+That is the question.
+That is the question.
+That is the question.
+received message: hi there
+received message: 15
+Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS_3.scala b/test/files/jvm/actmig-PinS_3.scala
new file mode 100644
index 0000000000..321e99b1c2
--- /dev/null
+++ b/test/files/jvm/actmig-PinS_3.scala
@@ -0,0 +1,161 @@
+import scala.actors.{ MigrationSystem, StashingActor, ActorRef, Terminated, Props }
+import scala.concurrent.util.duration._
+import scala.concurrent.{ Promise, Await }
+
+
+object SillyActor {
+ val startPromise = Promise[Boolean]()
+ val ref = MigrationSystem.actorOf(Props(() => new SillyActor, "default-stash-dispatcher"))
+}
+
+/* PinS, Listing 32.1: A simple actor
+ */
+class SillyActor extends StashingActor {
+ def receive = { case _ => println("Why are you not dead"); context.stop(self) }
+
+ override def preStart() {
+ Await.ready(SillyActor.startPromise.future, 5 seconds)
+ for (i <- 1 to 5)
+ println("I'm acting!")
+ context.stop(self)
+ }
+
+ override def postStop() {
+ println("Post stop")
+ }
+}
+
+object SeriousActor {
+ val startPromise = Promise[Boolean]()
+ val ref = MigrationSystem.actorOf(Props(() => new SeriousActor, "default-stash-dispatcher"))
+}
+
+class SeriousActor extends StashingActor {
+ def receive = { case _ => println("Nop") }
+ override def preStart() {
+ Await.ready(SeriousActor.startPromise.future, 5 seconds)
+ for (i <- 1 to 5)
+ println("To be or not to be.")
+ context.stop(self)
+ }
+}
+
+/* PinS, Listing 32.3: An actor that calls react
+ */
+object NameResolver {
+ val ref = MigrationSystem.actorOf(Props(() => new NameResolver, "default-stash-dispatcher"))
+}
+
+class NameResolver extends StashingActor {
+ import java.net.{ InetAddress, UnknownHostException }
+
+ def receive = {
+ case (name: String, actor: ActorRef) =>
+ actor ! getIp(name)
+ case "EXIT" =>
+ println("Name resolver exiting.")
+ context.stop(self) // quit
+ case msg =>
+ println("Unhandled message: " + msg)
+ }
+
+ def getIp(name: String): Option[InetAddress] = {
+ try {
+ Some(InetAddress.getByName(name))
+ } catch {
+ case _: UnknownHostException => None
+ }
+ }
+
+}
+
+object Test extends App {
+
+ /* PinS, Listing 32.2: An actor that calls receive
+ */
+ def makeEchoActor(): ActorRef = MigrationSystem.actorOf(Props(() => new StashingActor {
+
+ def receive = { // how to handle receive
+ case 'stop =>
+ context.stop(self)
+ case msg =>
+ println("received message: " + msg)
+ }
+ }, "default-stash-dispatcher"))
+
+ /* PinS, page 696
+ */
+ def makeIntActor(): ActorRef = MigrationSystem.actorOf(Props(() => new StashingActor {
+
+ def receive = {
+ case x: Int => // I only want Ints
+ unstashAll()
+ println("Got an Int: " + x)
+ context.stop(self)
+ case _ => stash()
+ }
+ }, "default-stash-dispatcher"))
+
+ MigrationSystem.actorOf(Props(() => new StashingActor {
+ val silly = SillyActor.ref
+
+ override def preStart() {
+ context.watch(SillyActor.ref)
+ SillyActor.startPromise.success(true)
+ }
+
+ def receive = {
+ case Terminated(`silly`) =>
+ unstashAll()
+ val serious = SeriousActor.ref
+ context.watch(SeriousActor.ref)
+ SeriousActor.startPromise.success(true)
+ context.become {
+ case Terminated(`serious`) =>
+ val seriousPromise2 = Promise[Boolean]()
+ // PinS, page 694
+ val seriousActor2 = MigrationSystem.actorOf(Props(() => {
+ new StashingActor {
+
+ def receive = { case _ => context.stop(self) }
+
+ override def preStart() = {
+ for (i <- 1 to 5)
+ println("That is the question.")
+ seriousPromise2.success(true)
+ context.stop(self)
+ }
+ }
+ }, "default-stash-dispatcher"))
+
+ Await.ready(seriousPromise2.future, 5 seconds)
+ val echoActor = makeEchoActor()
+ context.watch(echoActor)
+ echoActor ! "hi there"
+ echoActor ! 15
+ echoActor ! 'stop
+ context.become {
+ case Terminated(_) =>
+ unstashAll()
+ val intActor = makeIntActor()
+ intActor ! "hello"
+ intActor ! math.Pi
+ // only the following send leads to output
+ intActor ! 12
+ context.unbecome()
+ context.unbecome()
+ context.stop(self)
+ case m =>
+ println("Stash 1 " + m)
+ stash(m)
+ }
+ case m =>
+ println("Stash 2 " + m)
+ stash(m)
+ }
+ case m =>
+ println("Stash 3 " + m)
+ stash(m)
+ }
+ }, "default-stash-dispatcher"))
+} \ No newline at end of file
diff --git a/test/files/jvm/actmig-hierarchy.check b/test/files/jvm/actmig-hierarchy.check
new file mode 100644
index 0000000000..317e9677c3
--- /dev/null
+++ b/test/files/jvm/actmig-hierarchy.check
@@ -0,0 +1,2 @@
+hello
+hello
diff --git a/test/files/jvm/actmig-hierarchy_1.check b/test/files/jvm/actmig-hierarchy_1.check
new file mode 100644
index 0000000000..317e9677c3
--- /dev/null
+++ b/test/files/jvm/actmig-hierarchy_1.check
@@ -0,0 +1,2 @@
+hello
+hello
diff --git a/test/files/jvm/actmig-instantiation.check b/test/files/jvm/actmig-instantiation.check
new file mode 100644
index 0000000000..4c13d5c0a1
--- /dev/null
+++ b/test/files/jvm/actmig-instantiation.check
@@ -0,0 +1,8 @@
+OK error: java.lang.RuntimeException: In order to create StashingActor one must use actorOf.
+OK error: java.lang.RuntimeException: Only one actor can be created per actorOf call.
+0
+100
+200
+300
+400
+500
diff --git a/test/files/jvm/actmig-loop-react.check b/test/files/jvm/actmig-loop-react.check
new file mode 100644
index 0000000000..54cbe942c0
--- /dev/null
+++ b/test/files/jvm/actmig-loop-react.check
@@ -0,0 +1,15 @@
+do task
+do task
+do task
+do task
+working
+scala got exception
+working
+akka got exception
+do task 1
+do string I am a String
+do task 42
+after react
+do task 1
+do string I am a String
+do task 42
diff --git a/test/files/jvm/actmig-loop-react.scala b/test/files/jvm/actmig-loop-react.scala
new file mode 100644
index 0000000000..d714b26594
--- /dev/null
+++ b/test/files/jvm/actmig-loop-react.scala
@@ -0,0 +1,188 @@
+import scala.actors.MigrationSystem._
+import scala.actors.Actor._
+import scala.actors.{ Actor, StashingActor, ActorRef, Props, MigrationSystem, PoisonPill }
+import java.util.concurrent.{ TimeUnit, CountDownLatch }
+import scala.collection.mutable.ArrayBuffer
+import scala.concurrent.util.duration._
+import scala.concurrent.{ Promise, Await }
+
+
+object Test {
+ val finishedLWCR, finishedTNR, finishedEH = Promise[Boolean]
+ val finishedLWCR1, finishedTNR1, finishedEH1 = Promise[Boolean]
+
+ def testLoopWithConditionReact() = {
+ // Snippet showing composition of receives
+ // Loop with Condition Snippet - before
+ val myActor = actor {
+ var c = true
+ loopWhile(c) {
+ react {
+ case x: Int =>
+ // do task
+ println("do task")
+ if (x == 42) {
+ c = false
+ finishedLWCR1.success(true)
+ }
+ }
+ }
+ }
+
+ myActor.start()
+ myActor ! 1
+ myActor ! 42
+
+ Await.ready(finishedLWCR1.future, 5 seconds)
+
+ // Loop with Condition Snippet - migrated
+ val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
+
+ def receive = {
+ case x: Int =>
+ // do task
+ println("do task")
+ if (x == 42) {
+ finishedLWCR.success(true)
+ context.stop(self)
+ }
+ }
+ }, "default-stashing-dispatcher"))
+ myAkkaActor ! 1
+ myAkkaActor ! 42
+ }
+
+ def testNestedReact() = {
+ // Snippet showing composition of receives
+ // Loop with Condition Snippet - before
+ val myActor = actor {
+ var c = true
+ loopWhile(c) {
+ react {
+ case x: Int =>
+ // do task
+ println("do task " + x)
+ if (x == 42) {
+ c = false
+ finishedTNR1.success(true)
+ } else
+ react {
+ case y: String =>
+ println("do string " + y)
+ }
+ println("after react")
+ }
+ }
+ }
+ myActor.start()
+
+ myActor ! 1
+ myActor ! "I am a String"
+ myActor ! 42
+
+ Await.ready(finishedTNR1.future, 5 seconds)
+
+ // Loop with Condition Snippet - migrated
+ val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
+
+ def receive = {
+ case x: Int =>
+ // do task
+ println("do task " + x)
+ if (x == 42) {
+ finishedTNR.success(true)
+ context.stop(self)
+ } else
+ context.become(({
+ case y: String =>
+ println("do string " + y)
+ }: Receive).andThen(x => {
+ unstashAll()
+ context.unbecome()
+ }).orElse { case x => stash() })
+ }
+ }, "default-stashing-dispatcher"))
+
+ myAkkaActor ! 1
+ myAkkaActor ! "I am a String"
+ myAkkaActor ! 42
+
+ }
+
+ def exceptionHandling() = {
+ // Stashing actor with act and exception handler
+ val myActor = MigrationSystem.actorOf(Props(() => new StashingActor {
+
+ def receive = { case _ => println("Dummy method.") }
+ override def act() = {
+ loop {
+ react {
+ case "fail" =>
+ throw new Exception("failed")
+ case "work" =>
+ println("working")
+ case "die" =>
+ finishedEH1.success(true)
+ exit()
+ }
+ }
+ }
+
+ override def exceptionHandler = {
+ case x: Exception => println("scala got exception")
+ }
+
+ }, "default-stashing-dispatcher"))
+
+ myActor ! "work"
+ myActor ! "fail"
+ myActor ! "die"
+
+ Await.ready(finishedEH1.future, 5 seconds)
+ // Stashing actor in Akka style
+ val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
+ def receive = PFCatch({
+ case "fail" =>
+ throw new Exception("failed")
+ case "work" =>
+ println("working")
+ case "die" =>
+ finishedEH.success(true)
+ context.stop(self)
+ }, { case x: Exception => println("akka got exception") })
+ }, "default-stashing-dispatcher"))
+
+ myAkkaActor ! "work"
+ myAkkaActor ! "fail"
+ myAkkaActor ! "die"
+ }
+
+ def main(args: Array[String]) = {
+ testLoopWithConditionReact()
+ Await.ready(finishedLWCR.future, 5 seconds)
+ exceptionHandling()
+ Await.ready(finishedEH.future, 5 seconds)
+ testNestedReact()
+ Await.ready(finishedTNR.future, 5 seconds)
+ }
+
+}
+
+// As per Jim Mcbeath's blog (http://jim-mcbeath.blogspot.com/2008/07/actor-exceptions.html)
+class PFCatch(f: PartialFunction[Any, Unit], handler: PartialFunction[Exception, Unit])
+ extends PartialFunction[Any, Unit] {
+
+ def apply(x: Any) = {
+ try {
+ f(x)
+ } catch {
+ case e: Exception if handler.isDefinedAt(e) => handler(e)
+ }
+ }
+
+ def isDefinedAt(x: Any) = f.isDefinedAt(x)
+}
+
+object PFCatch {
+ def apply(f: PartialFunction[Any, Unit], handler: PartialFunction[Exception, Unit]) = new PFCatch(f, handler)
+}
diff --git a/test/files/jvm/actmig-public-methods.check b/test/files/jvm/actmig-public-methods.check
new file mode 100644
index 0000000000..bb6530c926
--- /dev/null
+++ b/test/files/jvm/actmig-public-methods.check
@@ -0,0 +1,6 @@
+None
+Some(bang qmark after 1)
+bang
+bang qmark after 0
+bang qmark in future after 0
+typed bang qmark in future after 0
diff --git a/test/files/jvm/actmig-public-methods_1.check b/test/files/jvm/actmig-public-methods_1.check
new file mode 100644
index 0000000000..bb6530c926
--- /dev/null
+++ b/test/files/jvm/actmig-public-methods_1.check
@@ -0,0 +1,6 @@
+None
+Some(bang qmark after 1)
+bang
+bang qmark after 0
+bang qmark in future after 0
+typed bang qmark in future after 0
diff --git a/test/files/jvm/actmig-public-methods_1.scala b/test/files/jvm/actmig-public-methods_1.scala
new file mode 100644
index 0000000000..7e5bc24210
--- /dev/null
+++ b/test/files/jvm/actmig-public-methods_1.scala
@@ -0,0 +1,88 @@
+import scala.collection.mutable.ArrayBuffer
+import scala.actors.Actor._
+import scala.actors._
+import scala.util._
+import java.util.concurrent.{ TimeUnit, CountDownLatch }
+import scala.concurrent.util.Duration
+import scala.actors.pattern._
+
+object Test {
+ val NUMBER_OF_TESTS = 6
+
+ // used for sorting non-deterministic output
+ val buff = ArrayBuffer[String]()
+ val latch = new CountDownLatch(NUMBER_OF_TESTS)
+ val toStop = ArrayBuffer[ActorRef]()
+
+ def append(v: String) = synchronized {
+ buff += v
+ }
+
+ def main(args: Array[String]) = {
+
+ val respActor = MigrationSystem.actorOf(Props(() => actor {
+ loop {
+ react {
+ case (x: String, time: Long) =>
+ Thread.sleep(time)
+ reply(x + " after " + time)
+ case str: String =>
+ append(str)
+ latch.countDown()
+ case x =>
+ exit()
+ }
+ }
+ }, "akka.actor.default-stash-dispatcher"))
+
+ toStop += respActor
+
+ respActor ! "bang"
+
+ implicit val timeout = Timeout(Duration(500, TimeUnit.MILLISECONDS))
+ val msg = ("bang qmark", 0L)
+ val res1 = respActor.?(msg)(Timeout(Duration.Inf))
+ append(res1().toString)
+ latch.countDown()
+
+ val msg1 = ("bang qmark", 1L)
+ val res2 = respActor.?(msg1)(Timeout(Duration(500, TimeUnit.MILLISECONDS)))
+ append((res2() match {
+ case x: AskTimeoutException => None
+ case v => Some(v)
+ }).toString)
+ latch.countDown()
+
+ // this one should time out
+ val msg11 = ("bang qmark", 500L)
+ val res21 = respActor.?(msg11)(Timeout(Duration(1, TimeUnit.MILLISECONDS)))
+ append((res21() match {
+ case x: AskTimeoutException => None
+ case v => Some(v)
+ }).toString)
+ latch.countDown()
+
+ val msg2 = ("bang qmark in future", 0L)
+ val fut1 = respActor.?(msg2)(Duration.Inf)
+ append(fut1().toString())
+ latch.countDown()
+
+ val handler: PartialFunction[Any, String] = {
+ case x: String => x.toString
+ }
+
+ val msg3 = ("typed bang qmark in future", 0L)
+ val fut2 = (respActor.?(msg3)(Duration.Inf))
+ append(Futures.future { handler.apply(fut2()) }().toString)
+ latch.countDown()
+
+ // output
+ latch.await(200, TimeUnit.MILLISECONDS)
+ if (latch.getCount() > 0) {
+ println("Error: Tasks have not finished!!!")
+ }
+
+ buff.sorted.foreach(println)
+ toStop.foreach(_ ! PoisonPill)
+ }
+}
diff --git a/test/files/jvm/actmig-react-receive.check b/test/files/jvm/actmig-react-receive.check
new file mode 100644
index 0000000000..cc2a426e68
--- /dev/null
+++ b/test/files/jvm/actmig-react-receive.check
@@ -0,0 +1,16 @@
+do before
+do task
+do after
+do before
+do task
+do after
+do before
+do task
+do in between
+do string
+do after
+do before
+do task
+do in between
+do string
+do after
diff --git a/test/files/jvm/actmig-react-receive.scala b/test/files/jvm/actmig-react-receive.scala
new file mode 100644
index 0000000000..8464a2af79
--- /dev/null
+++ b/test/files/jvm/actmig-react-receive.scala
@@ -0,0 +1,111 @@
+import scala.actors.MigrationSystem._
+import scala.actors.Actor._
+import scala.actors.{ Actor, StashingActor, ActorRef, Props, MigrationSystem, PoisonPill }
+import java.util.concurrent.{ TimeUnit, CountDownLatch }
+import scala.collection.mutable.ArrayBuffer
+import scala.concurrent.util.duration._
+import scala.concurrent.{ Promise, Await }
+
+object Test {
+ val finishedRS, finishedRS1, finishedRSC, finishedRSC1 = Promise[Boolean]
+ def testComposition() = {
+ // Snippet showing composition of receives
+ // React Snippet - before
+ val myActor = actor {
+ // do before
+ println("do before")
+ receive {
+ case x: Int =>
+ // do task
+ println("do task")
+ }
+ println("do in between")
+ receive {
+ case x: String =>
+ // do string now
+ println("do string")
+ }
+ println("do after")
+ finishedRSC1.success(true)
+ }
+ myActor.start()
+ myActor ! 1
+ myActor ! "1"
+ Await.ready(finishedRSC1.future, 5 seconds)
+
+ // React Snippet - migrated
+ val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
+ override def preStart() = {
+ println("do before")
+ }
+
+ def receive = ({
+ case x: Int =>
+ // do task
+ println("do task")
+ }: Receive) andThen { v =>
+ context.become {
+ case x: String =>
+ //do string
+ println("do string")
+ context.stop(self)
+ }
+ println("do in between")
+ }
+
+ override def postStop() = {
+ println("do after")
+ finishedRSC.success(true)
+ }
+
+ }, "default-stashing-dispatcher"))
+ myAkkaActor ! 1
+ myAkkaActor ! "1"
+ Await.ready(finishedRSC.future, 5 seconds)
+ }
+
+ def main(args: Array[String]) = {
+ // React Snippet - before
+ val myActor = actor {
+ // do before
+ println("do before")
+ receive {
+ case x: Int =>
+ // do task
+ println("do task")
+ }
+ println("do after")
+ finishedRS1.success(true)
+ }
+ myActor.start()
+ myActor ! 1
+
+ Await.ready(finishedRS1.future, 5 seconds)
+
+ // React Snippet - migrated
+ val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
+ override def preStart() = {
+ println("do before")
+ }
+
+ def receive = {
+ case x: Int =>
+ // do task
+ println("do task")
+ context.stop(self)
+ }
+
+ override def postStop() = {
+ println("do after")
+ finishedRS.success(true)
+ }
+
+ }, "default-stashing-dispatcher"))
+ myAkkaActor ! 1
+
+ Await.ready(finishedRS.future, 5 seconds)
+ // Starting composition test
+ testComposition()
+
+ }
+}
diff --git a/test/files/lib/scalacheck.jar.desired.sha1 b/test/files/lib/scalacheck.jar.desired.sha1
index 2be7479415..e6ed543d73 100644
--- a/test/files/lib/scalacheck.jar.desired.sha1
+++ b/test/files/lib/scalacheck.jar.desired.sha1
@@ -1 +1 @@
-f8cd51e0f78e30b3ac444b741b0b2249ac8248bb ?scalacheck.jar
+b6f4dbb29f0c2ec1eba682414f60d52fea84f703 ?scalacheck.jar
diff --git a/test/files/neg/catch-all.check b/test/files/neg/catch-all.check
new file mode 100644
index 0000000000..ab3d28777d
--- /dev/null
+++ b/test/files/neg/catch-all.check
@@ -0,0 +1,10 @@
+catch-all.scala:2: error: This catches all Throwables. If this is really intended, use `case _ : Throwable` to clear this warning.
+ try { "warn" } catch { case _ => }
+ ^
+catch-all.scala:4: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning.
+ try { "warn" } catch { case x => }
+ ^
+catch-all.scala:6: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning.
+ try { "warn" } catch { case _: RuntimeException => ; case x => }
+ ^
+three errors found
diff --git a/test/files/neg/catch-all.flags b/test/files/neg/catch-all.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/catch-all.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/catch-all.scala b/test/files/neg/catch-all.scala
new file mode 100644
index 0000000000..35a6d7af91
--- /dev/null
+++ b/test/files/neg/catch-all.scala
@@ -0,0 +1,19 @@
+object CatchAll {
+ try { "warn" } catch { case _ => }
+
+ try { "warn" } catch { case x => }
+
+ try { "warn" } catch { case _: RuntimeException => ; case x => }
+
+ try { "okay" } catch { case _: Throwable => }
+
+ try { "okay" } catch { case _: Exception => }
+
+ try { "okay" } catch { case okay: Throwable => }
+
+ try { "okay" } catch { case okay: Exception => }
+
+ try { "okay" } catch { case _ if "".isEmpty => }
+
+ "okay" match { case _ => "" }
+}
diff --git a/test/files/neg/t2442.check b/test/files/neg/t2442.check
new file mode 100644
index 0000000000..714816fd62
--- /dev/null
+++ b/test/files/neg/t2442.check
@@ -0,0 +1,9 @@
+t2442.scala:4: error: match may not be exhaustive.
+It would fail on the following input: THREE
+ def f(e: MyEnum) = e match {
+ ^
+t2442.scala:11: error: match may not be exhaustive.
+It would fail on the following input: BLUE
+ def g(e: MySecondEnum) = e match {
+ ^
+two errors found
diff --git a/test/files/neg/t2442.flags b/test/files/neg/t2442.flags
new file mode 100644
index 0000000000..32cf036c3d
--- /dev/null
+++ b/test/files/neg/t2442.flags
@@ -0,0 +1 @@
+-Xexperimental -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t2442/MyEnum.java b/test/files/neg/t2442/MyEnum.java
new file mode 100644
index 0000000000..3ffbbb31b8
--- /dev/null
+++ b/test/files/neg/t2442/MyEnum.java
@@ -0,0 +1,3 @@
+public enum MyEnum {
+ ONE, TWO, THREE;
+} \ No newline at end of file
diff --git a/test/files/neg/t2442/MySecondEnum.java b/test/files/neg/t2442/MySecondEnum.java
new file mode 100644
index 0000000000..0f841286de
--- /dev/null
+++ b/test/files/neg/t2442/MySecondEnum.java
@@ -0,0 +1,6 @@
+public enum MySecondEnum {
+ RED(1), BLUE(2) { public void foo() {} };
+ MySecondEnum(int i) {}
+
+ public void foo() {}
+} \ No newline at end of file
diff --git a/test/files/neg/t2442/t2442.scala b/test/files/neg/t2442/t2442.scala
new file mode 100644
index 0000000000..b0a0f3cd41
--- /dev/null
+++ b/test/files/neg/t2442/t2442.scala
@@ -0,0 +1,15 @@
+class Test {
+ import MyEnum._
+
+ def f(e: MyEnum) = e match {
+ case ONE => println("one")
+ case TWO => println("two")
+ // missing case --> exhaustivity warning!
+ }
+
+ import MySecondEnum._
+ def g(e: MySecondEnum) = e match {
+ case RED => println("red")
+ // missing case --> exhaustivity warning!
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/t4541.check b/test/files/neg/t4541.check
index c01226685f..7bd8ff78f9 100644
--- a/test/files/neg/t4541.check
+++ b/test/files/neg/t4541.check
@@ -1,7 +1,7 @@
-t4541.scala:11: error: scala.reflect.internal.Types$TypeError: variable data in class Sparse cannot be accessed in Sparse[Int]
+t4541.scala:11: error: variable data in class Sparse cannot be accessed in Sparse[Int]
Access to protected method data not permitted because
prefix type Sparse[Int] does not conform to
class Sparse$mcI$sp where the access take place
that.data
^
-one error found \ No newline at end of file
+one error found
diff --git a/test/files/neg/t4541b.check b/test/files/neg/t4541b.check
index 54d9c3d1ee..8a52fd97f4 100644
--- a/test/files/neg/t4541b.check
+++ b/test/files/neg/t4541b.check
@@ -1,7 +1,7 @@
-t4541b.scala:13: error: scala.reflect.internal.Types$TypeError: variable data in class SparseArray cannot be accessed in SparseArray[Int]
+t4541b.scala:13: error: variable data in class SparseArray cannot be accessed in SparseArray[Int]
Access to protected method data not permitted because
prefix type SparseArray[Int] does not conform to
class SparseArray$mcI$sp where the access take place
use(that.data.clone)
^
-one error found \ No newline at end of file
+one error found
diff --git a/test/files/neg/t4842.check b/test/files/neg/t4842.check
new file mode 100644
index 0000000000..b53bbdbd15
--- /dev/null
+++ b/test/files/neg/t4842.check
@@ -0,0 +1,7 @@
+t4842.scala:2: error: self constructor arguments cannot reference unconstructed `this`
+ def this(x: Int) = this(new { println(Foo.this)}) // error
+ ^
+t4842.scala:6: error: self constructor arguments cannot reference unconstructed `this`
+ def this() = { this(???)(new { println(TypeArg.this.x) } ); println("next") } // error
+ ^
+two errors found
diff --git a/test/files/neg/t4842.scala b/test/files/neg/t4842.scala
new file mode 100644
index 0000000000..c6244efda7
--- /dev/null
+++ b/test/files/neg/t4842.scala
@@ -0,0 +1,7 @@
+class Foo (x: AnyRef) {
+ def this(x: Int) = this(new { println(Foo.this)}) // error
+}
+
+class TypeArg[X](val x: X)(a: AnyRef) {
+ def this() = { this(???)(new { println(TypeArg.this.x) } ); println("next") } // error
+}
diff --git a/test/files/neg/t4989.check b/test/files/neg/t4989.check
new file mode 100644
index 0000000000..814507fc3f
--- /dev/null
+++ b/test/files/neg/t4989.check
@@ -0,0 +1,7 @@
+t4989.scala:14: error: method print in class A cannot be directly accessed from class C because class B redeclares it as abstract
+ override def print(): String = super.print() // should be an error
+ ^
+t4989.scala:18: error: method print in class A cannot be directly accessed from trait T because class B redeclares it as abstract
+ override def print(): String = super.print() // should be an error
+ ^
+two errors found
diff --git a/test/files/neg/t4989.scala b/test/files/neg/t4989.scala
new file mode 100644
index 0000000000..e7ff80ed74
--- /dev/null
+++ b/test/files/neg/t4989.scala
@@ -0,0 +1,68 @@
+abstract class A0 {
+ def print(): String
+}
+
+class A extends A0 {
+ def print(): String = "A"
+}
+
+abstract class B extends A {
+ def print() : String
+}
+
+class C extends B {
+ override def print(): String = super.print() // should be an error
+}
+
+trait T extends B {
+ override def print(): String = super.print() // should be an error
+}
+
+class D extends A {
+ override def print(): String = super.print() // okay
+}
+
+
+// it's okay do this when trait are in the mix, as the
+// suitable super accessor methods are used.
+object ConcreteMethodAndIntermediaryAreTraits {
+ trait T1 {
+ def print(): String = ""
+ }
+
+ trait T2 extends T1 {
+ def print(): String
+ }
+
+ class C3 extends T2 {
+ def print(): String = super.print() // okay
+ }
+}
+
+object IntermediaryIsTrait {
+ class T1 {
+ def print(): String = ""
+ }
+
+ trait T2 extends T1 {
+ def print(): String
+ }
+
+ class C3 extends T2 {
+ override def print(): String = super.print() // okay
+ }
+}
+
+object ConcreteMethodIsTrait {
+ trait T1 {
+ def print(): String = ""
+ }
+
+ abstract class T2 extends T1 {
+ def print(): String
+ }
+
+ class C3 extends T2 {
+ override def print(): String = super.print() // okay
+ }
+}
diff --git a/test/files/neg/t5148.check b/test/files/neg/t5148.check
new file mode 100644
index 0000000000..96eb1fd364
--- /dev/null
+++ b/test/files/neg/t5148.check
@@ -0,0 +1,2 @@
+error: bad reference while unpickling Imports.class: term memberHandlers not found in scala.tools.nsc.interpreter.IMain
+one error found
diff --git a/test/files/neg/t5148.scala b/test/files/neg/t5148.scala
new file mode 100644
index 0000000000..fca64e57df
--- /dev/null
+++ b/test/files/neg/t5148.scala
@@ -0,0 +1,4 @@
+package scala.tools.nsc
+package interpreter
+
+class IMain extends Imports
diff --git a/test/files/neg/t5429.check b/test/files/neg/t5429.check
index 1b89c59587..4350696bc8 100644
--- a/test/files/neg/t5429.check
+++ b/test/files/neg/t5429.check
@@ -46,14 +46,18 @@ t5429.scala:38: error: overriding method emptyArg in class A of type ()Int;
object emptyArg has incompatible type
override object emptyArg // fail
^
-t5429.scala:39: error: object oneArg overrides nothing
+t5429.scala:39: error: object oneArg overrides nothing.
+Note: the super classes of class C contain the following, non final members named oneArg:
+def oneArg(x: String): Int
override object oneArg // fail
^
t5429.scala:43: error: overriding lazy value lazyvalue in class A0 of type Any;
object lazyvalue must be declared lazy to override a concrete lazy value
override object lazyvalue // !!! this fails, but should succeed (lazy over lazy)
^
-t5429.scala:46: error: object oneArg overrides nothing
+t5429.scala:46: error: object oneArg overrides nothing.
+Note: the super classes of class C0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
override object oneArg // fail
^
t5429.scala:50: error: overriding value value in class A of type Int;
@@ -76,7 +80,9 @@ t5429.scala:58: error: overriding lazy value lazyvalue in class A0 of type Any;
value lazyvalue must be declared lazy to override a concrete lazy value
override val lazyvalue = 0 // fail (non-lazy)
^
-t5429.scala:61: error: value oneArg overrides nothing
+t5429.scala:61: error: value oneArg overrides nothing.
+Note: the super classes of class D0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
override val oneArg = 15 // fail
^
t5429.scala:65: error: overriding value value in class A of type Int;
@@ -103,7 +109,9 @@ t5429.scala:73: error: overriding lazy value lazyvalue in class A0 of type Any;
method lazyvalue needs to be a stable, immutable value
override def lazyvalue = 2 // fail
^
-t5429.scala:76: error: method oneArg overrides nothing
+t5429.scala:76: error: method oneArg overrides nothing.
+Note: the super classes of class E0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
override def oneArg = 15 // fail
^
t5429.scala:80: error: overriding value value in class A of type Int;
@@ -126,7 +134,9 @@ t5429.scala:87: error: overriding value value in class A0 of type Any;
lazy value value cannot override a concrete non-lazy value
override lazy val value = 0 // fail (strict over lazy)
^
-t5429.scala:91: error: value oneArg overrides nothing
+t5429.scala:91: error: value oneArg overrides nothing.
+Note: the super classes of class F0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
override lazy val oneArg = 15 // fail
^
34 errors found
diff --git a/test/files/neg/t5617.check b/test/files/neg/t5617.check
new file mode 100644
index 0000000000..79cc3a1e32
--- /dev/null
+++ b/test/files/neg/t5617.check
@@ -0,0 +1,8 @@
+t5617.scala:12: error: method foo overrides nothing.
+Note: the super classes of trait C contain the following, non final members named foo:
+def foo(u: Unit): Int
+def foo(x: Boolean): Int
+def foo(i: Int)(b: String): Int
+ override def foo(s: String): Int
+ ^
+one error found
diff --git a/test/files/neg/t5617.scala b/test/files/neg/t5617.scala
new file mode 100644
index 0000000000..41541b5e90
--- /dev/null
+++ b/test/files/neg/t5617.scala
@@ -0,0 +1,14 @@
+trait A {
+ def foo(i: Int)(b: String): Int
+ def foo(u: Unit): Int // not reported
+ def foo(x: Float): Int // not reported
+}
+trait B[X] extends A {
+ def foo(x: X): Int
+ def foo(u: Unit): Int
+ final def foo(x: Float): Int = 0 // not reported
+}
+trait C extends B[Boolean] {
+ override def foo(s: String): Int
+ val foo = 0 // not reported
+}
diff --git a/test/files/neg/t5761.check b/test/files/neg/t5761.check
new file mode 100644
index 0000000000..89d766fe34
--- /dev/null
+++ b/test/files/neg/t5761.check
@@ -0,0 +1,16 @@
+t5761.scala:4: error: not enough arguments for constructor D: (x: Int)D[Int].
+Unspecified value parameter x.
+ println(new D[Int]{}) // crash
+ ^
+t5761.scala:8: error: not enough arguments for constructor D: (x: Int)D[Int].
+Unspecified value parameter x.
+ println(new D[Int]()) // no crash
+ ^
+t5761.scala:9: error: not enough arguments for constructor D: (x: Int)D[Int].
+Unspecified value parameter x.
+ println(new D[Int]{}) // crash
+ ^
+t5761.scala:13: error: not found: type Tread
+ new Tread("sth") { }.run()
+ ^
+four errors found
diff --git a/test/files/neg/t5761.scala b/test/files/neg/t5761.scala
new file mode 100644
index 0000000000..040c4eb75a
--- /dev/null
+++ b/test/files/neg/t5761.scala
@@ -0,0 +1,16 @@
+class D[-A](x: A) { }
+
+object Test1 {
+ println(new D[Int]{}) // crash
+}
+
+object Test2 {
+ println(new D[Int]()) // no crash
+ println(new D[Int]{}) // crash
+}
+
+object Test3 {
+ new Tread("sth") { }.run()
+}
+
+
diff --git a/test/files/pos/rangepos-anonapply.flags b/test/files/pos/rangepos-anonapply.flags
new file mode 100644
index 0000000000..281f0a10cd
--- /dev/null
+++ b/test/files/pos/rangepos-anonapply.flags
@@ -0,0 +1 @@
+-Yrangepos
diff --git a/test/files/pos/rangepos-anonapply.scala b/test/files/pos/rangepos-anonapply.scala
new file mode 100644
index 0000000000..2f3e4ad6cd
--- /dev/null
+++ b/test/files/pos/rangepos-anonapply.scala
@@ -0,0 +1,9 @@
+class Test {
+ trait PropTraverser {
+ def apply(x: Int): Unit = {}
+ }
+
+ def gather(x: Int) {
+ (new PropTraverser {})(x)
+ }
+}
diff --git a/test/files/pos/spec-params-new.scala b/test/files/pos/spec-params-new.scala
index 661e686f0e..959ce1591c 100644
--- a/test/files/pos/spec-params-new.scala
+++ b/test/files/pos/spec-params-new.scala
@@ -31,4 +31,4 @@ class Foo[@specialized A: ClassTag] {
val xs = new Array[A](1)
xs(0) = x
}
-} \ No newline at end of file
+}
diff --git a/test/files/pos/t4842.scala b/test/files/pos/t4842.scala
new file mode 100644
index 0000000000..17ff684833
--- /dev/null
+++ b/test/files/pos/t4842.scala
@@ -0,0 +1,26 @@
+class Foo (x: AnyRef) {
+ def this() = {
+ this(new { } ) // okay
+ }
+}
+
+
+class Blerg (x: AnyRef) {
+ def this() = {
+ this(new { class Bar { println(Bar.this); new { println(Bar.this) } }; new Bar } ) // okay
+ }
+}
+
+
+class Outer {
+ class Inner (x: AnyRef) {
+ def this() = {
+ this(new { class Bar { println(Bar.this); new { println(Bar.this) } }; new Bar } ) // okay
+ }
+
+ def this(x: Boolean) = {
+ this(new { println(Outer.this) } ) // okay
+ }
+ }
+}
+
diff --git a/test/files/pos/t5899.flags b/test/files/pos/t5899.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t5899.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t5899.scala b/test/files/pos/t5899.scala
new file mode 100644
index 0000000000..b16f1f84fe
--- /dev/null
+++ b/test/files/pos/t5899.scala
@@ -0,0 +1,19 @@
+import scala.tools.nsc._
+
+trait Foo {
+ val global: Global
+ import global.{Name, Symbol, nme}
+
+ case class Bippy(name: Name)
+
+ def f(x: Bippy, sym: Symbol): Int = {
+ // no warning (!) for
+ // val Stable = sym.name.toTermName
+
+ val Stable = sym.name
+ Bippy(Stable) match {
+ case Bippy(nme.WILDCARD) => 1
+ case Bippy(Stable) => 2 // should not be considered unreachable
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/t5968.flags b/test/files/pos/t5968.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t5968.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t5968.scala b/test/files/pos/t5968.scala
new file mode 100644
index 0000000000..0093f84fc0
--- /dev/null
+++ b/test/files/pos/t5968.scala
@@ -0,0 +1,8 @@
+object X {
+ def f(e: Either[Int, X.type]) = e match {
+ case Left(i) => i
+ case Right(X) => 0
+ // SI-5986 spurious exhaustivity warning here
+ }
+}
+
diff --git a/test/files/run/t4809.scala b/test/files/run/t4809.scala
new file mode 100644
index 0000000000..b30d80562f
--- /dev/null
+++ b/test/files/run/t4809.scala
@@ -0,0 +1,34 @@
+
+
+import scala.util.control.Breaks._
+
+
+
+object Test {
+
+ def main(args: Array[String]) {
+ val x = tryBreakable {
+ break
+ 2
+ } catchBreak {
+ 3
+ }
+ assert(x == 3, x)
+
+ val y = tryBreakable {
+ 2
+ } catchBreak {
+ 3
+ }
+ assert(y == 2, y)
+
+ val z = tryBreakable {
+ break
+ 1.0
+ } catchBreak {
+ 2
+ }
+ assert(z == 2.0, z)
+ }
+
+}
diff --git a/test/files/run/t4935.check b/test/files/run/t4935.check
new file mode 100644
index 0000000000..ef0493b275
--- /dev/null
+++ b/test/files/run/t4935.check
@@ -0,0 +1 @@
+hello
diff --git a/test/files/run/t4935.flags b/test/files/run/t4935.flags
new file mode 100644
index 0000000000..ac14fe5dbd
--- /dev/null
+++ b/test/files/run/t4935.flags
@@ -0,0 +1 @@
+-optimize
diff --git a/test/files/run/t4935.scala b/test/files/run/t4935.scala
new file mode 100644
index 0000000000..18631e2041
--- /dev/null
+++ b/test/files/run/t4935.scala
@@ -0,0 +1,9 @@
+object Test extends App {
+ for (i <- 0 to 1) {
+ val a = Foo
+ }
+}
+
+object Foo {
+ println("hello")
+}
diff --git a/test/files/run/t5284.check b/test/files/run/t5284.check
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/test/files/run/t5284.check
@@ -0,0 +1 @@
+2
diff --git a/test/files/run/t5284.scala b/test/files/run/t5284.scala
new file mode 100644
index 0000000000..ba0845fb8e
--- /dev/null
+++ b/test/files/run/t5284.scala
@@ -0,0 +1,25 @@
+
+
+
+
+
+/** Here we have a situation where a normalized method parameter `W`
+ * is used in a position which accepts an instance of type `T` - we know we can
+ * safely cast `T` to `W` whenever type bounds on `W` hold.
+ */
+object Test {
+ def main(args: Array[String]) {
+ val a = Blarg(Array(1, 2, 3))
+ println(a.m((x: Int) => x + 1))
+ }
+}
+
+
+object Blarg {
+ def apply[T: Manifest](a: Array[T]) = new Blarg(a)
+}
+
+
+class Blarg[@specialized(Int) T: Manifest](val a: Array[T]) {
+ def m[@specialized(Int) W >: T, @specialized(Int) S](f: W => S) = f(a(0))
+}
diff --git a/test/files/run/t5284b.check b/test/files/run/t5284b.check
new file mode 100644
index 0000000000..98d9bcb75a
--- /dev/null
+++ b/test/files/run/t5284b.check
@@ -0,0 +1 @@
+17
diff --git a/test/files/run/t5284b.scala b/test/files/run/t5284b.scala
new file mode 100644
index 0000000000..a9282a895f
--- /dev/null
+++ b/test/files/run/t5284b.scala
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+/** Here we have a situation where a normalized method parameter `W`
+ * is used in a position which expects a type `T` - we know we can
+ * safely cast `W` to `T` whenever typebounds of `W` hold.
+ */
+object Test {
+ def main(args: Array[String]) {
+ val foo = Foo.createUnspecialized[Int]
+ println(foo.bar(17))
+ }
+}
+
+
+object Foo {
+ def createUnspecialized[T] = new Foo[T]
+}
+
+
+class Foo[@specialized(Int) T] {
+ val id: T => T = x => x
+
+ def bar[@specialized(Int) W <: T, @specialized(Int) S](w: W) = id(w)
+}
diff --git a/test/files/run/t5284c.check b/test/files/run/t5284c.check
new file mode 100644
index 0000000000..00750edc07
--- /dev/null
+++ b/test/files/run/t5284c.check
@@ -0,0 +1 @@
+3
diff --git a/test/files/run/t5284c.scala b/test/files/run/t5284c.scala
new file mode 100644
index 0000000000..383b84c2cc
--- /dev/null
+++ b/test/files/run/t5284c.scala
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+/** Here we have a compound type `List[W]` used in
+ * a position where `List[T]` is expected. The cast
+ * emitted in the normalized `bar` is safe because the
+ * normalized `bar` can only be called if the type
+ * bounds hold.
+ */
+object Test {
+ def main(args: Array[String]) {
+ val foo = Foo.createUnspecialized[Int]
+ println(foo.bar(List(1, 2, 3)))
+ }
+}
+
+
+object Foo {
+ def createUnspecialized[T] = new Foo[T]
+}
+
+
+class Foo[@specialized(Int) T] {
+ val len: List[T] => Int = xs => xs.length
+
+ def bar[@specialized(Int) W <: T](ws: List[W]) = len(ws)
+}
diff --git a/test/files/run/t5914.check b/test/files/run/t5914.check
new file mode 100644
index 0000000000..818e321255
--- /dev/null
+++ b/test/files/run/t5914.check
@@ -0,0 +1 @@
+correct
diff --git a/test/files/run/t5914.scala b/test/files/run/t5914.scala
new file mode 100644
index 0000000000..45d8815738
--- /dev/null
+++ b/test/files/run/t5914.scala
@@ -0,0 +1,23 @@
+import scala.reflect.ClassTag
+
+trait Trees {
+ class Tree
+ implicit val ttTag: ClassTag[TypeTree]
+ type TypeTree <: Tree
+ val TypeTree: TypeTreeExtractor
+ abstract class TypeTreeExtractor {
+ def unapply(t: TypeTree): Option[String]
+ }
+ def test(tree: Tree) =
+ tree match {
+ case TypeTree(_) => println("lolwut")
+ case null => println("correct")
+ }
+}
+
+object Test extends App with Trees {
+ val ttTag = implicitly[ClassTag[TypeTree]]
+ case class TypeTree(meh: String) extends Tree
+ object TypeTree extends TypeTreeExtractor
+ test(null) // should not crash
+} \ No newline at end of file
diff --git a/test/files/run/t5966.check b/test/files/run/t5966.check
new file mode 100644
index 0000000000..bfe8358a77
--- /dev/null
+++ b/test/files/run/t5966.check
@@ -0,0 +1,3 @@
+(o()_)("") = List()
+(o("a1")_)("") = WrappedArray(a1)
+(o("a1", "a2")_)("") = WrappedArray(a1, a2)
diff --git a/test/files/run/t5966.scala b/test/files/run/t5966.scala
new file mode 100644
index 0000000000..bbe1a6e874
--- /dev/null
+++ b/test/files/run/t5966.scala
@@ -0,0 +1,9 @@
+object o { def apply(i: AnyRef*)(j: String) = i }
+
+object Test {
+ def main(args: Array[String]) {
+ println("(o()_)(\"\") = " + (o()_)(""))
+ println("(o(\"a1\")_)(\"\") = " + (o("a1")_)(""))
+ println("(o(\"a1\", \"a2\")_)(\"\") = " + (o("a1", "a2")_)(""))
+ }
+}
diff --git a/test/files/scalacheck/CheckEither.scala b/test/files/scalacheck/CheckEither.scala
index 0145d3321f..4e8480d72e 100644
--- a/test/files/scalacheck/CheckEither.scala
+++ b/test/files/scalacheck/CheckEither.scala
@@ -3,7 +3,6 @@ import org.scalacheck.Arbitrary.{arbitrary, arbThrowable}
import org.scalacheck.Gen.oneOf
import org.scalacheck.util.StdRand
import org.scalacheck.Prop._
-import org.scalacheck.ConsoleReporter.{testReport, propReport}
import org.scalacheck.Test.{Params, check}
import org.scalacheck.ConsoleReporter.testStatsEx
import Function.tupled