diff options
author | Max Bileschi <mbileschi@twitter.com> | 2014-06-27 11:44:55 -0400 |
---|---|---|
committer | Antoine Gourlay <antoine@gourlay.fr> | 2014-08-11 17:54:36 +0200 |
commit | 165d21e93c3f7c8b88b29d0a590fab571ba2d534 (patch) | |
tree | 0af39fb37671cfc00a5cacc39a523281645777d1 /src | |
parent | 70d8aaacae0f3620dcce3a981978695eb6e9488a (diff) | |
download | scala-165d21e93c3f7c8b88b29d0a590fab571ba2d534.tar.gz scala-165d21e93c3f7c8b88b29d0a590fab571ba2d534.tar.bz2 scala-165d21e93c3f7c8b88b29d0a590fab571ba2d534.zip |
[backport] Revised comment to appeal to lchoran's and som-snytts comments
(cherry picked from commit 71bc2e5f4c49463a754a6f23e3abd2d27467fca4)
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/PartialFunction.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/library/scala/PartialFunction.scala b/src/library/scala/PartialFunction.scala index 012a85d06e..6f63ceb94b 100644 --- a/src/library/scala/PartialFunction.scala +++ b/src/library/scala/PartialFunction.scala @@ -21,11 +21,10 @@ package scala * val f: PartialFunction[Int, Any] = { case _ => 1/0 } * }}} * - * It is the responsibility of the caller of `apply` to check for membership - * in the domain by calling `isDefinedAt`, to ensure sanity of return values. - * A notable exception to this rule is `PartialFunction`s created with curly - * braces and case statements; In this case, a [[scala.MatchError]] is - * thrown if `isDefinedAt` (i.e. pattern matching) fails. + * It is the responsibility of the caller to call `isDefinedAt` before + * before calling `apply`, because if `isDefinedAt` is false, an exception + * may or may not be thrown. In the case that an exception is not thrown, + * an insane value may be returned. * * The main distinction between `PartialFunction` and [[scala.Function1]] is * that the user of a `PartialFunction` may choose to do something different |