Permalink
Browse files

Reverted over-zealous replacement of 'PartialFu...

Reverted over-zealous replacement of 'PartialFunction' with '=>?'.
  • Loading branch information...
1 parent b0e6451 commit 3e1241caeca9af5b05922d38bed1b0480e6da56d Antonio Cunei committed Jan 15, 2010
Showing with 78 additions and 80 deletions.
  1. +15 −15 src/actors/scala/actors/Actor.scala
  2. +4 −4 src/actors/scala/actors/Channel.scala
  3. +3 −3 src/actors/scala/actors/Future.scala
  4. +4 −4 src/actors/scala/actors/InputChannel.scala
  5. +4 −4 src/actors/scala/actors/ReactChannel.scala
  6. +1 −1 src/actors/scala/actors/Reaction.scala
  7. +3 −3 src/actors/scala/actors/Reactor.scala
  8. +1 −1 src/actors/scala/actors/Replyable.scala
  9. +4 −4 src/actors/scala/actors/ReplyableActor.scala
  10. +1 −1 src/actors/scala/actors/ReplyableReactor.scala
  11. +1 −1 src/actors/scala/actors/remote/Proxy.scala
  12. +1 −1 src/compiler/scala/tools/nsc/symtab/Definitions.scala
  13. +1 −1 src/compiler/scala/tools/nsc/transform/CleanUp.scala
  14. +2 −2 src/compiler/scala/tools/nsc/transform/UnCurry.scala
  15. +1 −1 src/library/scala/Option.scala
  16. +4 −4 src/library/scala/PartialFunction.scala
  17. +1 −1 src/library/scala/collection/Iterator.scala
  18. +2 −2 src/library/scala/collection/TraversableLike.scala
  19. +1 −1 src/library/scala/collection/TraversableProxyLike.scala
  20. +1 −1 src/library/scala/collection/interfaces/TraversableMethods.scala
  21. +3 −3 src/library/scala/concurrent/MailBox.scala
  22. +0 −2 src/library/scala/package.scala
  23. +2 −2 src/library/scala/runtime/ScalaRunTime.scala
  24. +7 −7 src/library/scala/util/control/Exception.scala
  25. +7 −7 src/library/scala/util/parsing/combinator/Parsers.scala
  26. +3 −3 src/scalap/scala/tools/scalap/scalax/rules/Rule.scala
  27. +1 −1 src/swing/scala/swing/Reactions.scala
@@ -160,7 +160,7 @@ object Actor {
* @param f a partial function specifying patterns and actions
* @return the result of processing the received message
*/
- def receive[A](f: Any =>? A): A =
+ def receive[A](f: PartialFunction[Any, A]): A =
self.receive(f)
/**
@@ -175,7 +175,7 @@ object Actor {
* @param f a partial function specifying patterns and actions
* @return the result of processing the received message
*/
- def receiveWithin[R](msec: Long)(f: Any =>? R): R =
+ def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R =
self.receiveWithin(msec)(f)
/**
@@ -188,7 +188,7 @@ object Actor {
* @param f a partial function specifying patterns and actions
* @return this function never returns
*/
- def react(f: Any =>? Unit): Nothing =
+ def react(f: PartialFunction[Any, Unit]): Nothing =
rawSelf.react(f)
/**
@@ -202,14 +202,14 @@ object Actor {
* @param f a partial function specifying patterns and actions
* @return this function never returns
*/
- def reactWithin(msec: Long)(f: Any =>? Unit): Nothing =
+ def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing =
self.reactWithin(msec)(f)
- def eventloop(f: Any =>? Unit): Nothing =
+ def eventloop(f: PartialFunction[Any, Unit]): Nothing =
rawSelf.react(new RecursiveProxyHandler(rawSelf, f))
- private class RecursiveProxyHandler(a: Reactor, f: Any =>? Unit)
- extends (Any =>? Unit) {
+ private class RecursiveProxyHandler(a: Reactor, f: PartialFunction[Any, Unit])
+ extends PartialFunction[Any, Unit] {
def isDefinedAt(m: Any): Boolean =
true // events are immediately removed from the mailbox
def apply(m: Any) {
@@ -261,9 +261,9 @@ object Actor {
* }
* </pre>
*/
- def respondOn[A, B](fun: A =>? Unit => Nothing):
- A =>? B => Responder[B] =
- (caseBlock: A =>? B) => new Responder[B] {
+ def respondOn[A, B](fun: PartialFunction[A, Unit] => Nothing):
+ PartialFunction[A, B] => Responder[B] =
+ (caseBlock: PartialFunction[A, B]) => new Responder[B] {
def respond(k: B => Unit) = fun(caseBlock andThen k)
}
@@ -428,7 +428,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor {
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receive[R](f: Any =>? R): R = {
+ def receive[R](f: PartialFunction[Any, R]): R = {
assert(Actor.self(scheduler) == this, "receive from channel belonging to other actor")
synchronized {
@@ -479,7 +479,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor {
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receiveWithin[R](msec: Long)(f: Any =>? R): R = {
+ def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = {
assert(Actor.self(scheduler) == this, "receive from channel belonging to other actor")
synchronized {
@@ -559,7 +559,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor {
*
* @param f a partial function with message patterns and actions
*/
- override def react(f: Any =>? Unit): Nothing = {
+ override def react(f: PartialFunction[Any, Unit]): Nothing = {
assert(Actor.self(scheduler) == this, "react on channel belonging to other actor")
synchronized {
if (shouldExit) exit() // links
@@ -579,7 +579,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor {
* @param msec the time span before timeout
* @param f a partial function with message patterns and actions
*/
- def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = {
+ def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = {
assert(Actor.self(scheduler) == this, "react on channel belonging to other actor")
synchronized {
@@ -645,7 +645,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor {
// guarded by lock of this
// never throws SuspendActorException
- private[actors] override def scheduleActor(f: Any =>? Any, msg: Any) =
+ private[actors] override def scheduleActor(f: PartialFunction[Any, Any], msg: Any) =
if (f eq null) {
// do nothing (timeout is handled instead)
}
@@ -76,7 +76,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receive[R](f: Msg =>? R): R = {
+ def receive[R](f: PartialFunction[Msg, R]): R = {
val C = this.asInstanceOf[Channel[Any]]
val recvActor = receiver.asInstanceOf[Actor]
recvActor.receive {
@@ -99,7 +99,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receiveWithin[R](msec: Long)(f: Any =>? R): R = {
+ def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = {
val C = this.asInstanceOf[Channel[Any]]
val recvActor = receiver.asInstanceOf[Actor]
recvActor.receiveWithin(msec) {
@@ -116,7 +116,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha
*
* @param f a partial function with message patterns and actions
*/
- def react(f: Msg =>? Unit): Nothing = {
+ def react(f: PartialFunction[Msg, Unit]): Nothing = {
val C = this.asInstanceOf[Channel[Any]]
receiver.react {
case C ! msg if (f.isDefinedAt(msg.asInstanceOf[Msg])) => f(msg.asInstanceOf[Msg])
@@ -133,7 +133,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha
* @param msec the time span before timeout
* @param f a partial function with message patterns and actions
*/
- def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = {
+ def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = {
val C = this.asInstanceOf[Channel[Any]]
val recvActor = receiver.asInstanceOf[Actor]
recvActor.reactWithin(msec) {
@@ -153,7 +153,7 @@ object Futures {
val partFuns = unsetFts.map((p: Pair[Int, Future[Any]]) => {
val FutCh = p._2.inputChannel
- val singleCase: Any =>? Pair[Int, Any] = {
+ val singleCase: PartialFunction[Any, Pair[Int, Any]] = {
case FutCh ! any => Pair(p._1, any)
}
singleCase
@@ -165,8 +165,8 @@ object Futures {
}
Actor.timer.schedule(timerTask, timeout)
- def awaitWith(partFuns: Seq[Any =>? Pair[Int, Any]]) {
- val reaction: Any =>? Unit = new (Any =>? Unit) {
+ def awaitWith(partFuns: Seq[PartialFunction[Any, Pair[Int, Any]]]) {
+ val reaction: PartialFunction[Any, Unit] = new PartialFunction[Any, Unit] {
def isDefinedAt(msg: Any) = msg match {
case TIMEOUT => true
case _ => partFuns exists (_ isDefinedAt msg)
@@ -25,7 +25,7 @@ trait InputChannel[+Msg] {
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receive[R](f: Msg =>? R): R
+ def receive[R](f: PartialFunction[Msg, R]): R
/**
* Receives a message from this <code>InputChannel</code> within
@@ -35,7 +35,7 @@ trait InputChannel[+Msg] {
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receiveWithin[R](msec: Long)(f: Any =>? R): R
+ def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R
/**
* Receives a message from this <code>InputChannel</code>.
@@ -45,7 +45,7 @@ trait InputChannel[+Msg] {
*
* @param f a partial function with message patterns and actions
*/
- def react(f: Msg =>? Unit): Nothing
+ def react(f: PartialFunction[Msg, Unit]): Nothing
/**
* Receives a message from this <code>InputChannel</code> within
@@ -57,7 +57,7 @@ trait InputChannel[+Msg] {
* @param msec the time span before timeout
* @param f a partial function with message patterns and actions
*/
- def reactWithin(msec: Long)(f: Any =>? Unit): Nothing
+ def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing
/**
* Receives the next message from this <code>Channel</code>.
@@ -55,7 +55,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[
*
* @param f a partial function with message patterns and actions
*/
- def react(f: Msg =>? Unit): Nothing = {
+ def react(f: PartialFunction[Msg, Unit]): Nothing = {
val C = this
receiver.react {
case SendToReactor(C, msg) if (f.isDefinedAt(msg.asInstanceOf[Msg])) =>
@@ -73,7 +73,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[
* @param msec the time span before timeout
* @param f a partial function with message patterns and actions
*/
- def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = {
+ def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = {
val C = this
val recvActor = receiver.asInstanceOf[Actor]
recvActor.reactWithin(msec) {
@@ -89,7 +89,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receive[R](f: Msg =>? R): R = {
+ def receive[R](f: PartialFunction[Msg, R]): R = {
val C = this
val recvActor = receiver.asInstanceOf[Actor]
recvActor.receive {
@@ -106,7 +106,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receiveWithin[R](msec: Long)(f: Any =>? R): R = {
+ def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = {
val C = this
val recvActor = receiver.asInstanceOf[Actor]
recvActor.receiveWithin(msec) {
@@ -26,7 +26,7 @@ private[actors] class KillActorException extends Throwable with ControlException
* @deprecated("this class is going to be removed in a future release")
* @author Philipp Haller
*/
-class Reaction(a: Actor, f: Any =>? Any, msg: Any) extends ActorTask(a, () => {
+class Reaction(a: Actor, f: PartialFunction[Any, Any], msg: Any) extends ActorTask(a, () => {
if (f == null)
a.act()
else
@@ -60,7 +60,7 @@ trait Reactor extends OutputChannel[Any] {
*/
def act(): Unit
- protected[actors] def exceptionHandler: Exception =>? Unit =
+ protected[actors] def exceptionHandler: PartialFunction[Exception, Unit] =
Map()
protected[actors] def scheduler: IScheduler =
@@ -166,7 +166,7 @@ trait Reactor extends OutputChannel[Any] {
}
}
- protected[actors] def react(f: Any =>? Unit): Nothing = {
+ protected[actors] def react(f: PartialFunction[Any, Unit]): Nothing = {
assert(Actor.rawSelf(scheduler) == this, "react on channel belonging to other actor")
synchronized { drainSendBuffer(mailbox) }
searchMailbox(mailbox, f, false)
@@ -180,7 +180,7 @@ trait Reactor extends OutputChannel[Any] {
*
* never throws SuspendActorException
*/
- private[actors] def scheduleActor(handler: Any =>? Any, msg: Any) = {
+ private[actors] def scheduleActor(handler: PartialFunction[Any, Any], msg: Any) = {
val fun = () => handler(msg)
val task = new ReactorTask(this, fun)
scheduler executeFromActor task
@@ -59,7 +59,7 @@ trait Replyable[-T, +R] {
* @param f the function to be applied to the response
* @return the future
*/
- def !![P](msg: T, f: R =>? P): () => P =
+ def !![P](msg: T, f: PartialFunction[R, P]): () => P =
() => f(this !? msg)
}
@@ -62,7 +62,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor {
* <code>f</code>. This also allows to recover a more
* precise type for the reply value.
*/
- override def !![A](msg: Any, f: Any =>? A): Future[A] = {
+ override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = {
val ftch = new Channel[A](Actor.self(thiz.scheduler))
thiz.send(msg, new OutputChannel[Any] {
def !(msg: Any) =
@@ -108,7 +108,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor {
Futures.fromInputChannel(someChan)
}
// should never be invoked; return dummy value
- override def !![A](msg: Any, f: Any =>? A): Future[A] = {
+ override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = {
val someChan = new Channel[A](Actor.self(thiz.scheduler))
Futures.fromInputChannel(someChan)
}
@@ -117,7 +117,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor {
thiz.send(msg, linkedChannel)
new Future[Any](ftch) {
var exitReason: Option[Any] = None
- val handleReply: Any =>? Unit = {
+ val handleReply: PartialFunction[Any, Unit] = {
case Exit(from, reason) =>
exitReason = Some(reason)
case any =>
@@ -145,7 +145,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor {
def isSet = (fvalue match {
case None =>
- val handleTimeout: Any =>? Boolean = {
+ val handleTimeout: PartialFunction[Any, Boolean] = {
case TIMEOUT =>
false
}
@@ -70,7 +70,7 @@ private[actors] trait ReplyableReactor extends Replyable[Any, Any] {
* <code>f</code>. This also allows to recover a more
* precise type for the reply value.
*/
- override def !![A](msg: Any, f: Any =>? A): Future[A] = {
+ override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = {
val myself = Actor.rawSelf(this.scheduler)
val ftch = new ReactChannel[A](myself)
val res = new scala.concurrent.SyncVar[A]
@@ -69,7 +69,7 @@ private[remote] class Proxy(node: Node, name: Symbol, @transient var kernel: Net
override def !!(msg: Any): Future[Any] =
del !! msg
- override def !![A](msg: Any, f: Any =>? A): Future[A] =
+ override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] =
del !! (msg, f)
def linkTo(to: AbstractActor): Unit =
@@ -19,7 +19,7 @@ trait Definitions {
// Working around bug #2133
private object definitionHelpers {
- def cond[T](x: T)(f: T =>? Boolean) = (f isDefinedAt x) && f(x)
+ def cond[T](x: T)(f: PartialFunction[T, Boolean]) = (f isDefinedAt x) && f(x)
}
import definitionHelpers._
@@ -280,7 +280,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
val testForBoolean: Tree = (qual IS_OBJ BoxedBooleanClass.tpe)
val testForNumberOrBoolean = testForNumber OR testForBoolean
- val getPrimitiveReplacementForStructuralCall: Name =>? (Symbol, Tree) = {
+ val getPrimitiveReplacementForStructuralCall: PartialFunction[Name, (Symbol, Tree)] = {
val testsForNumber = Map() ++ List(
nme.UNARY_+ -> "positive",
nme.UNARY_- -> "negate",
@@ -296,11 +296,11 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
* }
* new $anon()
*
- * transform a function node (x => body) of type T =>? R where
+ * transform a function node (x => body) of type PartialFunction[T, R] where
* body = expr match { case P_i if G_i => E_i }_i=1..n
* to:
*
- * class $anon() extends Object() with T =>? R with ScalaObject {
+ * class $anon() extends Object() with PartialFunction[T, R] with ScalaObject {
* def apply(x: T): R = (expr: @unchecked) match {
* { case P_i if G_i => E_i }_i=1..n
* def isDefinedAt(x: T): boolean = (x: @unchecked) match {
@@ -110,7 +110,7 @@ sealed abstract class Option[+A] extends Product {
*
* @param pf the partial function.
*/
- def partialMap[B](pf: A =>? B): Option[B] =
+ def partialMap[B](pf: PartialFunction[A, B]): Option[B] =
if (!isEmpty && pf.isDefinedAt(this.get)) Some(pf(this.get)) else None
/** If the option is nonempty return it,
Oops, something went wrong.

0 comments on commit 3e1241c

Please sign in to comment.