diff options
author | triggerNZ <tin.pavlinic@gmail.com> | 2015-11-24 10:01:51 +1100 |
---|---|---|
committer | triggerNZ <tin.pavlinic@gmail.com> | 2015-11-24 10:01:51 +1100 |
commit | 22addc63096986b16d38dcd796d843eb6678fc01 (patch) | |
tree | 5f53b0943e5b1b12b85a23d951eb1d64cfb7fe8f | |
parent | a24fe19bccb7ae18342bcfc1087bf66b5422a7b3 (diff) | |
download | scala-22addc63096986b16d38dcd796d843eb6678fc01.tar.gz scala-22addc63096986b16d38dcd796d843eb6678fc01.tar.bz2 scala-22addc63096986b16d38dcd796d843eb6678fc01.zip |
SI-9363 - Add empty serializable
-rw-r--r-- | src/library/scala/PartialFunction.scala | 2 | ||||
-rw-r--r-- | test/junit/scala/PartialFunctionSerializationTest.scala | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/library/scala/PartialFunction.scala b/src/library/scala/PartialFunction.scala index 4d3f117cff..c1a413d516 100644 --- a/src/library/scala/PartialFunction.scala +++ b/src/library/scala/PartialFunction.scala @@ -249,7 +249,7 @@ object PartialFunction { private[this] val constFalse: Any => Boolean = { _ => false} - private[this] val empty_pf: PartialFunction[Any, Nothing] = new PartialFunction[Any, Nothing] { + private[this] val empty_pf: PartialFunction[Any, Nothing] = new PartialFunction[Any, Nothing] with Serializable { def isDefinedAt(x: Any) = false def apply(x: Any) = throw new MatchError(x) override def orElse[A1, B1](that: PartialFunction[A1, B1]) = that diff --git a/test/junit/scala/PartialFunctionSerializationTest.scala b/test/junit/scala/PartialFunctionSerializationTest.scala index d4f20f0019..d525b045cd 100644 --- a/test/junit/scala/PartialFunctionSerializationTest.scala +++ b/test/junit/scala/PartialFunctionSerializationTest.scala @@ -31,4 +31,6 @@ class PartialFunctionSerializationTest { @Test def canSerializeUnlifted = assertSerializable(Function.unlift((x: Int) => Some(x))) @Test def canSerializeAndThen = assertSerializable(pf1.andThen((x: Int) => x)) + + @Test def canSerializeEmpty = assertSerializable(PartialFunction.empty) } |