diff options
author | Burak Emir <emir@epfl.ch> | 2007-08-21 22:44:21 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2007-08-21 22:44:21 +0000 |
commit | ea8c405c26609aaa7abd9e670ab4bf95afe0a1fa (patch) | |
tree | 635359fa23cc7a27ff23692051391e5d03e79450 /test | |
parent | e313d9651adc2b7137a1dabbd3b0351619383035 (diff) | |
download | scala-ea8c405c26609aaa7abd9e670ab4bf95afe0a1fa.tar.gz scala-ea8c405c26609aaa7abd9e670ab4bf95afe0a1fa.tar.bz2 scala-ea8c405c26609aaa7abd9e670ab4bf95afe0a1fa.zip |
unapplySeq-optimization works in combination wi...
unapplySeq-optimization works in combination with guards
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/patmatnew.scala | 22 |
1 files changed, 22 insertions, 0 deletions
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 + } + + } + } |