summaryrefslogtreecommitdiff
path: root/test/files/run/emptypf.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-08-28 00:13:17 +0000
committerPaul Phillips <paulp@improving.org>2011-08-28 00:13:17 +0000
commit6f881202be35c7d08ca73054594618cef19d8938 (patch)
tree144718e5f3b81247db3c3bbc197a397250079fe0 /test/files/run/emptypf.scala
parentcaaf4296681e4fa040d691169c6665d7b5eac9d2 (diff)
downloadscala-6f881202be35c7d08ca73054594618cef19d8938.tar.gz
scala-6f881202be35c7d08ca73054594618cef19d8938.tar.bz2
scala-6f881202be35c7d08ca73054594618cef19d8938.zip
Gave partial function an empty member.
Diffstat (limited to 'test/files/run/emptypf.scala')
-rw-r--r--test/files/run/emptypf.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/files/run/emptypf.scala b/test/files/run/emptypf.scala
new file mode 100644
index 0000000000..eb3e3e6380
--- /dev/null
+++ b/test/files/run/emptypf.scala
@@ -0,0 +1,14 @@
+object Test {
+ val f: PartialFunction[String, Int] = {
+ PartialFunction.empty[String, Int] orElse {
+ case "abc" => 100
+ case s => s.length
+ }
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(f("abc"))
+ println(f("def"))
+ println(PartialFunction.empty[String, Int] isDefinedAt "abc")
+ }
+}