summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-04-21 22:34:41 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-04-21 22:34:41 +0200
commit07fe50311890f4853f7155a5c1a559ac58106134 (patch)
treede3188e9f7b4c4f611d65fba9235e418976136ce /test/files/pos
parent178e9abe7b2481c010496f2d15f389fef0320e0a (diff)
parentb7f359c718717262fa447f428dbd600ddd3b29bd (diff)
downloadscala-07fe50311890f4853f7155a5c1a559ac58106134.tar.gz
scala-07fe50311890f4853f7155a5c1a559ac58106134.tar.bz2
scala-07fe50311890f4853f7155a5c1a559ac58106134.zip
Merge pull request #3635 from retronym/ticket/8329
SI-8329 Better hygiene for patmat partial functions
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/t8329.scala29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/files/pos/t8329.scala b/test/files/pos/t8329.scala
new file mode 100644
index 0000000000..fcd5e50b37
--- /dev/null
+++ b/test/files/pos/t8329.scala
@@ -0,0 +1,29 @@
+object Test {
+ def pf(pf: PartialFunction[Any, Unit]) = ()
+ def f1(pf: Function[Any, Unit]) = ()
+
+ class A1; class B1
+ def test1(x: String, x1: String, default: String) = pf {
+ case _ if (
+ x.isEmpty
+ && default.isEmpty // was binding to synthetic param
+ && x1.isEmpty // was binding to synthetic param
+ ) =>
+ x.isEmpty
+ default.isEmpty // was binding to synthetic param
+ x1.isEmpty // was binding to synthetic param
+ new A1; new B1
+ }
+
+ def test2(x: String, x1: String, default: String) = f1 {
+ case _ if (
+ x.isEmpty
+ && default.isEmpty
+ && x1.isEmpty
+ ) =>
+ x.isEmpty
+ default.isEmpty
+ x1.isEmpty
+ new A1; new B1
+ }
+}