@@ -20,7 +20,7 @@ package scala
2020 * {{{
2121 * val f: PartialFunction[Int, Any] = { case _ => 1/0 }
2222 * }}}
23- *
23+ *
2424 * It is the responsibility of the caller to call `isDefinedAt` before
2525 * calling `apply`, because if `isDefinedAt` is false, it is not guaranteed
2626 * `apply` will throw an exception to indicate an error condition. If an
@@ -161,7 +161,8 @@ trait PartialFunction[-A, +B] extends (A => B) { self =>
161161object PartialFunction {
162162 /** Composite function produced by `PartialFunction#orElse` method
163163 */
164- private class OrElse [- A , + B ] (f1 : PartialFunction [A , B ], f2 : PartialFunction [A , B ]) extends scala.runtime.AbstractPartialFunction [A , B ] {
164+ private class OrElse [- A , + B ] (f1 : PartialFunction [A , B ], f2 : PartialFunction [A , B ])
165+ extends scala.runtime.AbstractPartialFunction [A , B ] with Serializable {
165166 def isDefinedAt (x : A ) = f1.isDefinedAt(x) || f2.isDefinedAt(x)
166167
167168 override def apply (x : A ): B = f1.applyOrElse(x, f2)
@@ -180,7 +181,7 @@ object PartialFunction {
180181
181182 /** Composite function produced by `PartialFunction#andThen` method
182183 */
183- private class AndThen [- A , B , + C ] (pf : PartialFunction [A , B ], k : B => C ) extends PartialFunction [A , C ] {
184+ private class AndThen [- A , B , + C ] (pf : PartialFunction [A , B ], k : B => C ) extends PartialFunction [A , C ] with Serializable {
184185 def isDefinedAt (x : A ) = pf.isDefinedAt(x)
185186
186187 def apply (x : A ): C = k(pf(x))
@@ -217,15 +218,15 @@ object PartialFunction {
217218 private def fallbackOccurred [B ](x : B ) = (fallback_pf eq x.asInstanceOf [AnyRef ])
218219
219220 private class Lifted [- A , + B ] (val pf : PartialFunction [A , B ])
220- extends scala.runtime.AbstractFunction1 [A , Option [B ]] {
221+ extends scala.runtime.AbstractFunction1 [A , Option [B ]] with Serializable {
221222
222223 def apply (x : A ): Option [B ] = {
223224 val z = pf.applyOrElse(x, checkFallback[B ])
224225 if (! fallbackOccurred(z)) Some (z) else None
225226 }
226227 }
227228
228- private class Unlifted [A , B ] (f : A => Option [B ]) extends scala.runtime.AbstractPartialFunction [A , B ] {
229+ private class Unlifted [A , B ] (f : A => Option [B ]) extends scala.runtime.AbstractPartialFunction [A , B ] with Serializable {
229230 def isDefinedAt (x : A ): Boolean = f(x).isDefined
230231
231232 override def applyOrElse [A1 <: A , B1 >: B ](x : A1 , default : A1 => B1 ): B1 = {
@@ -248,7 +249,7 @@ object PartialFunction {
248249
249250 private [this ] val constFalse : Any => Boolean = { _ => false }
250251
251- private [this ] val empty_pf : PartialFunction [Any , Nothing ] = new PartialFunction [Any , Nothing ] {
252+ private [this ] val empty_pf : PartialFunction [Any , Nothing ] = new PartialFunction [Any , Nothing ] with Serializable {
252253 def isDefinedAt (x : Any ) = false
253254 def apply (x : Any ) = throw new MatchError (x)
254255 override def orElse [A1 , B1 ](that : PartialFunction [A1 , B1 ]) = that
0 commit comments