summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actors/scala/actors/Actor.scala30
-rw-r--r--src/actors/scala/actors/Channel.scala8
-rw-r--r--src/actors/scala/actors/Future.scala6
-rw-r--r--src/actors/scala/actors/InputChannel.scala8
-rw-r--r--src/actors/scala/actors/ReactChannel.scala8
-rw-r--r--src/actors/scala/actors/Reaction.scala2
-rw-r--r--src/actors/scala/actors/Reactor.scala8
-rw-r--r--src/actors/scala/actors/Replyable.scala2
-rw-r--r--src/actors/scala/actors/ReplyableActor.scala8
-rw-r--r--src/actors/scala/actors/ReplyableReactor.scala2
-rw-r--r--src/actors/scala/actors/remote/Proxy.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala4
-rw-r--r--src/library/scala/Option.scala2
-rw-r--r--src/library/scala/PartialFunction.scala12
-rw-r--r--src/library/scala/collection/Iterator.scala2
-rw-r--r--src/library/scala/collection/TraversableLike.scala4
-rw-r--r--src/library/scala/collection/TraversableProxyLike.scala2
-rw-r--r--src/library/scala/collection/interfaces/TraversableMethods.scala2
-rw-r--r--src/library/scala/concurrent/MailBox.scala6
-rw-r--r--src/library/scala/runtime/ScalaRunTime.scala4
-rw-r--r--src/library/scala/util/control/Exception.scala14
-rw-r--r--src/library/scala/util/parsing/combinator/Parsers.scala14
-rw-r--r--src/scalap/scala/tools/scalap/scalax/rules/Rule.scala6
-rw-r--r--src/swing/scala/swing/Reactions.scala2
26 files changed, 81 insertions, 81 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala
index 625b19ebdd..fb90cb9c46 100644
--- a/src/actors/scala/actors/Actor.scala
+++ b/src/actors/scala/actors/Actor.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: PartialFunction[Any, A]): A =
+ def receive[A](f: 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: PartialFunction[Any, R]): R =
+ def receiveWithin[R](msec: Long)(f: 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: PartialFunction[Any, Unit]): Nothing =
+ def react(f: 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: PartialFunction[Any, Unit]): Nothing =
+ def reactWithin(msec: Long)(f: Any =>? Unit): Nothing =
self.reactWithin(msec)(f)
- def eventloop(f: PartialFunction[Any, Unit]): Nothing =
+ def eventloop(f: Any =>? Unit): Nothing =
rawSelf.react(new RecursiveProxyHandler(rawSelf, f))
- private class RecursiveProxyHandler(a: Reactor, f: PartialFunction[Any, Unit])
- extends PartialFunction[Any, Unit] {
+ private class RecursiveProxyHandler(a: Reactor, f: Any =>? Unit)
+ extends (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: PartialFunction[A, Unit] => Nothing):
- PartialFunction[A, B] => Responder[B] =
- (caseBlock: PartialFunction[A, B]) => new Responder[B] {
+ def respondOn[A, B](fun: A =>? Unit => Nothing):
+ A =>? B => Responder[B] =
+ (caseBlock: 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: PartialFunction[Any, R]): R = {
+ def receive[R](f: 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: PartialFunction[Any, R]): R = {
+ def receiveWithin[R](msec: Long)(f: 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: PartialFunction[Any, Unit]): Nothing = {
+ override def react(f: Any =>? Unit): Nothing = {
assert(Actor.self(scheduler) == this, "react on channel belonging to other actor")
synchronized {
if (shouldExit) exit() // links
@@ -580,7 +580,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: PartialFunction[Any, Unit]): Nothing = {
+ def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = {
assert(Actor.self(scheduler) == this, "react on channel belonging to other actor")
synchronized {
@@ -646,7 +646,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor {
}
// guarded by lock of this
- private[actors] override def scheduleActor(f: PartialFunction[Any, Unit], msg: Any) =
+ private[actors] override def scheduleActor(f: Any =>? Unit, msg: Any) =
if ((f eq null) && (continuation eq null)) {
// do nothing (timeout is handled instead)
}
diff --git a/src/actors/scala/actors/Channel.scala b/src/actors/scala/actors/Channel.scala
index 24340d22f2..1454f29214 100644
--- a/src/actors/scala/actors/Channel.scala
+++ b/src/actors/scala/actors/Channel.scala
@@ -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: PartialFunction[Msg, R]): R = {
+ def receive[R](f: 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: PartialFunction[Any, R]): R = {
+ def receiveWithin[R](msec: Long)(f: 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: PartialFunction[Msg, Unit]): Nothing = {
+ def react(f: 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: PartialFunction[Any, Unit]): Nothing = {
+ def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = {
val C = this.asInstanceOf[Channel[Any]]
val recvActor = receiver.asInstanceOf[Actor]
recvActor.reactWithin(msec) {
diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala
index ebb0489d88..1369ed6255 100644
--- a/src/actors/scala/actors/Future.scala
+++ b/src/actors/scala/actors/Future.scala
@@ -153,7 +153,7 @@ object Futures {
val partFuns = unsetFts.map((p: Pair[Int, Future[Any]]) => {
val FutCh = p._2.inputChannel
- val singleCase: PartialFunction[Any, Pair[Int, Any]] = {
+ val singleCase: 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[PartialFunction[Any, Pair[Int, Any]]]) {
- val reaction: PartialFunction[Any, Unit] = new PartialFunction[Any, Unit] {
+ def awaitWith(partFuns: Seq[Any =>? Pair[Int, Any]]) {
+ val reaction: Any =>? Unit = new (Any =>? Unit) {
def isDefinedAt(msg: Any) = msg match {
case TIMEOUT => true
case _ => partFuns exists (_ isDefinedAt msg)
diff --git a/src/actors/scala/actors/InputChannel.scala b/src/actors/scala/actors/InputChannel.scala
index 46988159fa..fb922f27b2 100644
--- a/src/actors/scala/actors/InputChannel.scala
+++ b/src/actors/scala/actors/InputChannel.scala
@@ -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: PartialFunction[Msg, R]): R
+ def receive[R](f: 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: PartialFunction[Any, R]): R
+ def receiveWithin[R](msec: Long)(f: 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: PartialFunction[Msg, Unit]): Nothing
+ def react(f: 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: PartialFunction[Any, Unit]): Nothing
+ def reactWithin(msec: Long)(f: Any =>? Unit): Nothing
/**
* Receives the next message from this <code>Channel</code>.
diff --git a/src/actors/scala/actors/ReactChannel.scala b/src/actors/scala/actors/ReactChannel.scala
index 8bbbc04f53..926805fbe7 100644
--- a/src/actors/scala/actors/ReactChannel.scala
+++ b/src/actors/scala/actors/ReactChannel.scala
@@ -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: PartialFunction[Msg, Unit]): Nothing = {
+ def react(f: 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: PartialFunction[Any, Unit]): Nothing = {
+ def reactWithin(msec: Long)(f: 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: PartialFunction[Msg, R]): R = {
+ def receive[R](f: 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: PartialFunction[Any, R]): R = {
+ def receiveWithin[R](msec: Long)(f: Any =>? R): R = {
val C = this
val recvActor = receiver.asInstanceOf[Actor]
recvActor.receiveWithin(msec) {
diff --git a/src/actors/scala/actors/Reaction.scala b/src/actors/scala/actors/Reaction.scala
index 25aea803af..a4736f9489 100644
--- a/src/actors/scala/actors/Reaction.scala
+++ b/src/actors/scala/actors/Reaction.scala
@@ -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: PartialFunction[Any, Unit], msg: Any) extends ActorTask(a, () => {
+class Reaction(a: Actor, f: Any =>? Unit, msg: Any) extends ActorTask(a, () => {
if (f == null)
a.act()
else
diff --git a/src/actors/scala/actors/Reactor.scala b/src/actors/scala/actors/Reactor.scala
index 0eff67c163..d641f54eb6 100644
--- a/src/actors/scala/actors/Reactor.scala
+++ b/src/actors/scala/actors/Reactor.scala
@@ -41,7 +41,7 @@ trait Reactor extends OutputChannel[Any] {
* message handler that react was called with.
*/
@volatile
- private[actors] var continuation: PartialFunction[Any, Unit] = null
+ private[actors] var continuation: Any =>? Unit = null
/* Whenever this Actor executes on some thread, waitingFor is
* guaranteed to be equal to waitingForNone.
@@ -61,7 +61,7 @@ trait Reactor extends OutputChannel[Any] {
*/
def act(): Unit
- protected[actors] def exceptionHandler: PartialFunction[Exception, Unit] =
+ protected[actors] def exceptionHandler: Exception =>? Unit =
Map()
protected[actors] def scheduler: IScheduler =
@@ -159,7 +159,7 @@ trait Reactor extends OutputChannel[Any] {
}
}
- protected[actors] def react(f: PartialFunction[Any, Unit]): Nothing = {
+ protected[actors] def react(f: Any =>? Unit): Nothing = {
assert(Actor.rawSelf(scheduler) == this, "react on channel belonging to other actor")
synchronized { drainSendBuffer(mailbox) }
continuation = f
@@ -172,7 +172,7 @@ trait Reactor extends OutputChannel[Any] {
*
* assume handler != null
*/
- private[actors] def scheduleActor(handler: PartialFunction[Any, Unit], msg: Any) = {
+ private[actors] def scheduleActor(handler: Any =>? Unit, msg: Any) = {
val fun = () => handler(msg)
val task = new ReactorTask(this, fun)
scheduler executeFromActor task
diff --git a/src/actors/scala/actors/Replyable.scala b/src/actors/scala/actors/Replyable.scala
index 2c7e55e06a..b1ccb3205e 100644
--- a/src/actors/scala/actors/Replyable.scala
+++ b/src/actors/scala/actors/Replyable.scala
@@ -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: PartialFunction[R, P]): () => P =
+ def !![P](msg: T, f: R =>? P): () => P =
() => f(this !? msg)
}
diff --git a/src/actors/scala/actors/ReplyableActor.scala b/src/actors/scala/actors/ReplyableActor.scala
index 2122dd854b..b562dbf855 100644
--- a/src/actors/scala/actors/ReplyableActor.scala
+++ b/src/actors/scala/actors/ReplyableActor.scala
@@ -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: PartialFunction[Any, A]): Future[A] = {
+ override def !![A](msg: Any, f: 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: PartialFunction[Any, A]): Future[A] = {
+ override def !![A](msg: Any, f: 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: PartialFunction[Any, Unit] = {
+ val handleReply: 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: PartialFunction[Any, Boolean] = {
+ val handleTimeout: Any =>? Boolean = {
case TIMEOUT =>
false
}
diff --git a/src/actors/scala/actors/ReplyableReactor.scala b/src/actors/scala/actors/ReplyableReactor.scala
index ecca50e26d..f5a2752f54 100644
--- a/src/actors/scala/actors/ReplyableReactor.scala
+++ b/src/actors/scala/actors/ReplyableReactor.scala
@@ -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: PartialFunction[Any, A]): Future[A] = {
+ override def !![A](msg: Any, f: Any =>? A): Future[A] = {
val myself = Actor.rawSelf(this.scheduler)
val ftch = new ReactChannel[A](myself)
val res = new scala.concurrent.SyncVar[A]
diff --git a/src/actors/scala/actors/remote/Proxy.scala b/src/actors/scala/actors/remote/Proxy.scala
index f9a6cd8fed..c1744a2dfc 100644
--- a/src/actors/scala/actors/remote/Proxy.scala
+++ b/src/actors/scala/actors/remote/Proxy.scala
@@ -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: PartialFunction[Any, A]): Future[A] =
+ override def !![A](msg: Any, f: Any =>? A): Future[A] =
del !! (msg, f)
def linkTo(to: AbstractActor): Unit =
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index e1cf7a5a7e..7a77095293 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -19,7 +19,7 @@ trait Definitions {
// Working around bug #2133
private object definitionHelpers {
- def cond[T](x: T)(f: PartialFunction[T, Boolean]) = (f isDefinedAt x) && f(x)
+ def cond[T](x: T)(f: T =>? Boolean) = (f isDefinedAt x) && f(x)
}
import definitionHelpers._
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
index cf217dcd23..09ed32253a 100644
--- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala
+++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
@@ -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: PartialFunction[Name, (Symbol, Tree)] = {
+ val getPrimitiveReplacementForStructuralCall: Name =>? (Symbol, Tree) = {
val testsForNumber = Map() ++ List(
nme.UNARY_+ -> "positive",
nme.UNARY_- -> "negate",
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 8c129f66d7..8ea0b69049 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -296,11 +296,11 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
* }
* new $anon()
*
- * transform a function node (x => body) of type PartialFunction[T, R] where
+ * transform a function node (x => body) of type T =>? R where
* body = expr match { case P_i if G_i => E_i }_i=1..n
* to:
*
- * class $anon() extends Object() with PartialFunction[T, R] with ScalaObject {
+ * class $anon() extends Object() with 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 {
diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala
index 8511fa78a5..6cb0fec929 100644
--- a/src/library/scala/Option.scala
+++ b/src/library/scala/Option.scala
@@ -110,7 +110,7 @@ sealed abstract class Option[+A] extends Product {
*
* @param pf the partial function.
*/
- def partialMap[B](pf: PartialFunction[A, B]): Option[B] =
+ def partialMap[B](pf: A =>? B): Option[B] =
if (!isEmpty && pf.isDefinedAt(this.get)) Some(pf(this.get)) else None
/** If the option is nonempty return it,
diff --git a/src/library/scala/PartialFunction.scala b/src/library/scala/PartialFunction.scala
index 81ca2e4e10..f62fa68565 100644
--- a/src/library/scala/PartialFunction.scala
+++ b/src/library/scala/PartialFunction.scala
@@ -38,7 +38,7 @@ trait PartialFunction[-A, +B] extends (A => B) {
* of this partial function and `that`. The resulting partial function
* takes `x` to `this(x)` where `this` is defined, and to `that(x)` where it is not.
*/
- def orElse[A1 <: A, B1 >: B](that: PartialFunction[A1, B1]) : PartialFunction[A1, B1] =
+ def orElse[A1 <: A, B1 >: B](that: A1 =>? B1) : A1 =>? B1 =
new PartialFunction[A1, B1] {
def isDefinedAt(x: A1): Boolean =
PartialFunction.this.isDefinedAt(x) || that.isDefinedAt(x)
@@ -54,7 +54,7 @@ trait PartialFunction[-A, +B] extends (A => B) {
* @return a partial function with the same domain as this partial function, which maps
* arguments `x` to `k(this(x))`.
*/
- override def andThen[C](k: B => C) : PartialFunction[A, C] = new PartialFunction[A, C] {
+ override def andThen[C](k: B => C): A =>? C = new PartialFunction[A, C] {
def isDefinedAt(x: A): Boolean = PartialFunction.this.isDefinedAt(x)
def apply(x: A): C = k(PartialFunction.this.apply(x))
}
@@ -92,18 +92,18 @@ object PartialFunction
* @param pf the partial function
* @return true, iff `x` is in the domain of `pf` and `pf(x) == true`.
*/
- def cond[T](x: T)(pf: PartialFunction[T, Boolean]): Boolean =
+ def cond[T](x: T)(pf: T =>? Boolean): Boolean =
(pf isDefinedAt x) && pf(x)
- /** Transforms a PartialFunction[T,U] `pf' into Function1[T, Option[U]] `f'
+ /** Transforms a PartialFunction[T, U] `pf' into Function1[T, Option[U]] `f'
* whose result is Some(x) if the argument is in pf's domain and None otherwise,
* and applies it to the value `x'. In effect, it is a 'match' statement
* which wraps all case results in Some(_) and adds 'case _ => None' to the end.
*
* @param x the value to test
- * @param pf the PartialFunction[T,U]
+ * @param pf the PartialFunction[T, U]
* @return `Some(pf(x))` if `pf isDefinedAt x`, `None` otherwise.
*/
- def condOpt[T,U](x: T)(pf: PartialFunction[T, U]): Option[U] =
+ def condOpt[T,U](x: T)(pf: T =>? U): Option[U] =
if (pf isDefinedAt x) Some(pf(x)) else None
}
diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala
index 54a38848dd..5f28161ed3 100644
--- a/src/library/scala/collection/Iterator.scala
+++ b/src/library/scala/collection/Iterator.scala
@@ -411,7 +411,7 @@ trait Iterator[+A] { self =>
* @return a new iterator which yields each value `x` produced by this iterator for
* which `pf` is defined the image `pf(x)`.
*/
- def partialMap[B](pf: PartialFunction[A, B]): Iterator[B] = {
+ def partialMap[B](pf: A =>? B): Iterator[B] = {
val self = buffered
new Iterator[B] {
private def skip() = while (self.hasNext && !pf.isDefinedAt(self.head)) self.next()
diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala
index 8c8f619b5e..f570c4ca9a 100644
--- a/src/library/scala/collection/TraversableLike.scala
+++ b/src/library/scala/collection/TraversableLike.scala
@@ -292,13 +292,13 @@ self =>
* `pf` to each element on which it is defined and collecting the results.
* The order of the elements is preserved.
*
- * @usecase def partialMap[B](pf: PartialFunction[A, B]): $Coll[B]
+ * @usecase def partialMap[B](pf: A =>? B): $Coll[B]
*
* @return a new $coll resulting from applying the given partial function
* `pf` to each element on which it is defined and collecting the results.
* The order of the elements is preserved.
*/
- def partialMap[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
+ def partialMap[B, That](pf: A =>? B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
for (x <- this) if (pf.isDefinedAt(x)) b += pf(x)
b.result
diff --git a/src/library/scala/collection/TraversableProxyLike.scala b/src/library/scala/collection/TraversableProxyLike.scala
index 24d6c7048d..d8e3ed2a1b 100644
--- a/src/library/scala/collection/TraversableProxyLike.scala
+++ b/src/library/scala/collection/TraversableProxyLike.scala
@@ -36,7 +36,7 @@ trait TraversableProxyLike[+A, +This <: TraversableLike[A, This] with Traversabl
override def ++[B >: A, That](that: Iterator[B])(implicit bf: CanBuildFrom[This, B, That]): That = self.++(that)(bf)
override def map[B, That](f: A => B)(implicit bf: CanBuildFrom[This, B, That]): That = self.map(f)(bf)
override def flatMap[B, That](f: A => Traversable[B])(implicit bf: CanBuildFrom[This, B, That]): That = self.flatMap(f)(bf)
- override def partialMap[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[This, B, That]): That = self.partialMap(pf)(bf)
+ override def partialMap[B, That](pf: A =>? B)(implicit bf: CanBuildFrom[This, B, That]): That = self.partialMap(pf)(bf)
override def filter(p: A => Boolean): This = self.filter(p)
override def filterNot(p: A => Boolean): This = self.filterNot(p)
override def partition(p: A => Boolean): (This, This) = self.partition(p)
diff --git a/src/library/scala/collection/interfaces/TraversableMethods.scala b/src/library/scala/collection/interfaces/TraversableMethods.scala
index 08ade7586d..4cf133d36a 100644
--- a/src/library/scala/collection/interfaces/TraversableMethods.scala
+++ b/src/library/scala/collection/interfaces/TraversableMethods.scala
@@ -24,7 +24,7 @@ trait TraversableMethods[+A, +This <: TraversableLike[A, This] with Traversable[
// maps/iteration
def flatMap[B, That](f: A => Traversable[B])(implicit bf: CanBuildFrom[This, B, That]): That
def map[B, That](f: A => B)(implicit bf: CanBuildFrom[This, B, That]): That
- def partialMap[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[This, B, That]): That
+ def partialMap[B, That](pf: A =>? B)(implicit bf: CanBuildFrom[This, B, That]): That
// new collections
def ++[B >: A, That](that: Iterator[B])(implicit bf: CanBuildFrom[This, B, That]): That
diff --git a/src/library/scala/concurrent/MailBox.scala b/src/library/scala/concurrent/MailBox.scala
index c23bbf1c80..3b00d6165d 100644
--- a/src/library/scala/concurrent/MailBox.scala
+++ b/src/library/scala/concurrent/MailBox.scala
@@ -26,7 +26,7 @@ class MailBox extends AnyRef with ListQueueCreator {
def isDefinedAt(msg: Message): Boolean
}
- private class Receiver[A](receiver: PartialFunction[Message, A]) extends PreReceiver {
+ private class Receiver[A](receiver: Message =>? A) extends PreReceiver {
def isDefinedAt(msg: Message) = receiver.isDefinedAt(msg)
@@ -85,7 +85,7 @@ class MailBox extends AnyRef with ListQueueCreator {
* Block until there is a message in the mailbox for which the processor
* <code>f</code> is defined.
*/
- def receive[A](f: PartialFunction[Message, A]): A = {
+ def receive[A](f: Message =>? A): A = {
val r = new Receiver(f)
scanSentMsgs(r)
r.receive()
@@ -95,7 +95,7 @@ class MailBox extends AnyRef with ListQueueCreator {
* Block until there is a message in the mailbox for which the processor
* <code>f</code> is defined or the timeout is over.
*/
- def receiveWithin[A](msec: Long)(f: PartialFunction[Message, A]): A = {
+ def receiveWithin[A](msec: Long)(f: Message =>? A): A = {
val r = new Receiver(f)
scanSentMsgs(r)
r.receiveWithin(msec)
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index ecc81c074e..ebce675347 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -100,7 +100,7 @@ object ScalaRunTime {
if (x == null) throw new UninitializedError else x
abstract class Try[+A] {
- def Catch[B >: A](handler: PartialFunction[Throwable, B]): B
+ def Catch[B >: A](handler: Throwable =>? B): B
def Finally(fin: => Unit): A
}
@@ -115,7 +115,7 @@ object ScalaRunTime {
def run() { result = block }
- def Catch[B >: A](handler: PartialFunction[Throwable, B]): B =
+ def Catch[B >: A](handler: Throwable =>? B): B =
if (exception == null) result
else if (handler isDefinedAt exception) handler(exception)
else throw exception
diff --git a/src/library/scala/util/control/Exception.scala b/src/library/scala/util/control/Exception.scala
index 356b11df51..67f9ec183b 100644
--- a/src/library/scala/util/control/Exception.scala
+++ b/src/library/scala/util/control/Exception.scala
@@ -23,14 +23,14 @@ object Exception
// We get lots of crashes using this, so for now we just use Class[_]
// type ExClass = Class[_ <: Throwable]
- type Catcher[+T] = PartialFunction[Throwable, T]
- type ExceptionCatcher[+T] = PartialFunction[Exception, T]
+ type Catcher[+T] = Throwable =>? T
+ type ExceptionCatcher[+T] = Exception =>? T
// due to the magic of contravariance, Throwable => T is a subtype of
// Exception => T, not the other way around. So we manually construct
// a Throwable => T and simply rethrow the non-Exceptions.
implicit def fromExceptionCatcher[T](pf: ExceptionCatcher[T]): Catcher[T] = {
- new PartialFunction[Throwable, T] {
+ new (Throwable =>? T) {
def isDefinedAt(x: Throwable) = x match {
case e: Exception if pf.isDefinedAt(e) => true
case _ => false
@@ -101,7 +101,7 @@ object Exception
/** Create a new Catch with the same isDefinedAt logic as this one,
* but with the supplied apply method replacing the current one. */
def withApply[U](f: (Throwable) => U): Catch[U] = {
- val pf2 = new PartialFunction[Throwable, U] {
+ val pf2 = new (Throwable =>? U) {
def isDefinedAt(x: Throwable) = pf isDefinedAt x
def apply(x: Throwable) = f(x)
}
@@ -139,8 +139,8 @@ object Exception
override def toString() = List("Try(<body>)", catcher.toString) mkString " "
}
- final val nothingCatcher: PartialFunction[Throwable, Nothing] =
- new PartialFunction[Throwable, Nothing] {
+ final val nothingCatcher: Throwable =>? Nothing =
+ new (Throwable =>? Nothing) {
def isDefinedAt(x: Throwable) = false
def apply(x: Throwable) = throw x
}
@@ -207,7 +207,7 @@ object Exception
classes exists (_ isAssignableFrom x.getClass)
private def pfFromExceptions(exceptions: Class[_]*) =
- new PartialFunction[Throwable, Nothing] {
+ new (Throwable =>? Nothing) {
def apply(x: Throwable) = throw x
def isDefinedAt(x: Throwable) = wouldMatch(x, exceptions)
}
diff --git a/src/library/scala/util/parsing/combinator/Parsers.scala b/src/library/scala/util/parsing/combinator/Parsers.scala
index 3aa7cc7de1..1205d2f911 100644
--- a/src/library/scala/util/parsing/combinator/Parsers.scala
+++ b/src/library/scala/util/parsing/combinator/Parsers.scala
@@ -93,7 +93,7 @@ trait Parsers {
* `f' applied to the result of this `ParseResult', packaged up as a new `ParseResult'.
* If `f' is not defined, `Failure'.
*/
- def mapPartial[U](f: PartialFunction[T, U], error: T => String): ParseResult[U]
+ def mapPartial[U](f: T =>? U, error: T => String): ParseResult[U]
def flatMapWithNext[U](f: T => Input => ParseResult[U]): ParseResult[U]
@@ -119,7 +119,7 @@ trait Parsers {
*/
case class Success[+T](result: T, override val next: Input) extends ParseResult[T] {
def map[U](f: T => U) = Success(f(result), next)
- def mapPartial[U](f: PartialFunction[T, U], error: T => String): ParseResult[U]
+ def mapPartial[U](f: T =>? U, error: T => String): ParseResult[U]
= if(f.isDefinedAt(result)) Success(f(result), next)
else Failure(error(result), next)
@@ -146,7 +146,7 @@ trait Parsers {
lastNoSuccess = this
def map[U](f: Nothing => U) = this
- def mapPartial[U](f: PartialFunction[Nothing, U], error: Nothing => String): ParseResult[U] = this
+ def mapPartial[U](f: Nothing =>? U, error: Nothing => String): ParseResult[U] = this
def flatMapWithNext[U](f: Nothing => Input => ParseResult[U]): ParseResult[U]
= this
@@ -345,7 +345,7 @@ trait Parsers {
* @return a parser that succeeds if the current parser succeeds <i>and</i> `f' is applicable
* to the result. If so, the result will be transformed by `f'.
*/
- def ^? [U](f: PartialFunction[T, U], error: T => String): Parser[U] = Parser{ in =>
+ def ^? [U](f: T =>? U, error: T => String): Parser[U] = Parser{ in =>
this(in).mapPartial(f, error)}.named(toString+"^?")
/** A parser combinator for partial function application
@@ -358,7 +358,7 @@ trait Parsers {
* @return a parser that succeeds if the current parser succeeds <i>and</i> `f' is applicable
* to the result. If so, the result will be transformed by `f'.
*/
- def ^? [U](f: PartialFunction[T, U]): Parser[U] = ^?(f, r => "Constructor function not defined at "+r)
+ def ^? [U](f: T =>? U): Parser[U] = ^?(f, r => "Constructor function not defined at "+r)
/** A parser combinator that parameterises a subsequent parser with the result of this one
@@ -495,7 +495,7 @@ trait Parsers {
* @return A parser that succeeds if `f' is applicable to the first element of the input,
* applying `f' to it to produce the result.
*/
- def accept[U](expected: String, f: PartialFunction[Elem, U]): Parser[U] = acceptMatch(expected, f)
+ def accept[U](expected: String, f: Elem =>? U): Parser[U] = acceptMatch(expected, f)
def acceptIf(p: Elem => Boolean)(err: Elem => String): Parser[Elem] = Parser { in =>
@@ -503,7 +503,7 @@ trait Parsers {
else Failure(err(in.first), in)
}
- def acceptMatch[U](expected: String, f: PartialFunction[Elem, U]): Parser[U] = Parser{ in =>
+ def acceptMatch[U](expected: String, f: Elem =>? U): Parser[U] = Parser{ in =>
if (f.isDefinedAt(in.first)) Success(f(in.first), in.rest)
else Failure(expected+" expected", in)
}
diff --git a/src/scalap/scala/tools/scalap/scalax/rules/Rule.scala b/src/scalap/scala/tools/scalap/scalax/rules/Rule.scala
index 1500b81050..f65c688aa7 100644
--- a/src/scalap/scala/tools/scalap/scalax/rules/Rule.scala
+++ b/src/scalap/scala/tools/scalap/scalax/rules/Rule.scala
@@ -56,9 +56,9 @@ trait Rule[-In, +Out, +A, +X] extends (In => Result[Out, A, X]) {
def ^^[B](fa2b : A => B) = map(fa2b)
- def ^^?[B](pf : PartialFunction[A, B]) = filter (pf.isDefinedAt(_)) ^^ pf
+ def ^^?[B](pf : A =>? B) = filter (pf.isDefinedAt(_)) ^^ pf
- def ??(pf : PartialFunction[A, Any]) = filter (pf.isDefinedAt(_))
+ def ??(pf : A =>? Any) = filter (pf.isDefinedAt(_))
def -^[B](b : B) = map { any => b }
@@ -73,7 +73,7 @@ trait Rule[-In, +Out, +A, +X] extends (In => Result[Out, A, X]) {
def >->[Out2, B, X2 >: X](fa2resultb : A => Result[Out2, B, X2]) = flatMap { a => any => fa2resultb(a) }
- def >>?[Out2, B, X2 >: X](pf : PartialFunction[A, Rule[Out, Out2, B, X2]]) = filter(pf isDefinedAt _) flatMap pf
+ def >>?[Out2, B, X2 >: X](pf : A =>? Rule[Out, Out2, B, X2]) = filter(pf isDefinedAt _) flatMap pf
def >>&[B, X2 >: X](fa2ruleb : A => Out => Result[Any, B, X2]) = flatMap { a => out => fa2ruleb(a)(out) mapOut { any => out } }
diff --git a/src/swing/scala/swing/Reactions.scala b/src/swing/scala/swing/Reactions.scala
index 14d4deb981..a2327d7b18 100644
--- a/src/swing/scala/swing/Reactions.scala
+++ b/src/swing/scala/swing/Reactions.scala
@@ -27,7 +27,7 @@ object Reactions {
}
}
- type Reaction = PartialFunction[Event, Unit]
+ type Reaction = Event =>? Unit
/**
* A Reaction implementing this trait is strongly referenced in the reaction list