From ea8c405c26609aaa7abd9e670ab4bf95afe0a1fa Mon Sep 17 00:00:00 2001 From: Burak Emir Date: Tue, 21 Aug 2007 22:44:21 +0000 Subject: unapplySeq-optimization works in combination wi... unapplySeq-optimization works in combination with guards --- test/files/run/patmatnew.scala | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/files') diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala index 14e349b847..36e52315a6 100644 --- a/test/files/run/patmatnew.scala +++ b/test/files/run/patmatnew.scala @@ -27,6 +27,7 @@ object Test extends TestConsoleMain { new TestSimpleIntSwitch, new SimpleUnapply, SeqUnapply, + applyFromJcl, new Test717, new TestGuards, TestEqualsPatternOpt, @@ -65,6 +66,16 @@ object Test extends TestConsoleMain { } } + object applyFromJcl extends TestCase("applyFromJcl") { + override def runTest { + val p = (1,2) + Some(2) match { + case Some(p._2) => ; + case _ => assert(false) ; + } + } + } + class TestSimpleIntSwitch extends TestCase("SimpleIntSwitch") { override def runTest() = { assertEquals("s1", 1, 1 match { @@ -416,5 +427,16 @@ object Test extends TestConsoleMain { println((new Buffer).jp.isDefinedAt(42)) } + object lk { // compile only + val z:PartialFunction[Any,Any] = { + case x::xs if xs.forall { y => y.hashCode() > 0 } => 1 + } + + val s:PartialFunction[Any,Any] = { + case List(x) if List(x).forall { g => g.hashCode() > 0 } => 1 + } + + } + } -- cgit v1.2.3