summaryrefslogtreecommitdiff
path: root/src/library/scala/Function1.scala
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2009-11-09 16:13:33 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2009-11-09 16:13:33 +0000
commite981bccdb7874726af0896efdadb5e192d25c14a (patch)
tree68ec4c2c9764a935c7efd72cf00a7206b6e18166 /src/library/scala/Function1.scala
parentdf502f4ffa5ebf83e7e97a270504202e00f512ec (diff)
downloadscala-e981bccdb7874726af0896efdadb5e192d25c14a.tar.gz
scala-e981bccdb7874726af0896efdadb5e192d25c14a.tar.bz2
scala-e981bccdb7874726af0896efdadb5e192d25c14a.zip
Adds isDefinedAt to Function1. As a consequence,
code that mixes in PartialFunction now have to define isDefinedAt as override. Fixes #2225.
Diffstat (limited to 'src/library/scala/Function1.scala')
-rw-r--r--src/library/scala/Function1.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/library/scala/Function1.scala b/src/library/scala/Function1.scala
index 7cfd32304e..80fe7ad1b6 100644
--- a/src/library/scala/Function1.scala
+++ b/src/library/scala/Function1.scala
@@ -47,4 +47,10 @@ trait Function1[-T1, +R] extends AnyRef { self =>
*/
def andThen[A](g: R => A): T1 => A = { x => g(apply(x)) }
+ /** Checks if a value is contained in the functions domain.
+ *
+ * @param x the value to test
+ * @return true, iff <code>x</code> is in the domain of this function.
+ */
+ def isDefinedAt(x: T1): Boolean = true
}