diff options
author | buraq <buraq@epfl.ch> | 2005-02-18 18:33:15 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2005-02-18 18:33:15 +0000 |
commit | 951667d5ee2a7c2e0467854bea1156470651c752 (patch) | |
tree | 44c45d25deca770bb0f9385ff30dd23f14ab411b /test/files/run | |
parent | 4d7916df7537797af0ac42e1cd41c34589aff4f8 (diff) | |
download | scala-951667d5ee2a7c2e0467854bea1156470651c752.tar.gz scala-951667d5ee2a7c2e0467854bea1156470651c752.tar.bz2 scala-951667d5ee2a7c2e0467854bea1156470651c752.zip |
new test case for sequence convention in patter...
new test case for sequence convention in pattern matching
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/regularpatmat.check | 1 | ||||
-rw-r--r-- | test/files/run/regularpatmat.scala | 28 |
2 files changed, 28 insertions, 1 deletions
diff --git a/test/files/run/regularpatmat.check b/test/files/run/regularpatmat.check index cc902ea473..ad48fcaf98 100644 --- a/test/files/run/regularpatmat.check +++ b/test/files/run/regularpatmat.check @@ -118,3 +118,4 @@ passed ok passed ok passed ok passed ok +testBugSequenceApply hello hello
\ No newline at end of file diff --git a/test/files/run/regularpatmat.scala b/test/files/run/regularpatmat.scala index b5c345cf2d..8d4bb00b6e 100644 --- a/test/files/run/regularpatmat.scala +++ b/test/files/run/regularpatmat.scala @@ -20,7 +20,7 @@ object Test { testBO.main( args ); testMZ.main; //testNN.main; - () + testBugSequenceApply.main; } } @@ -716,3 +716,29 @@ object testNO { // this does not need to be run, only compiled } + +/** see comments in scala.tools.scalac.transformer.matching.PatternMatcher::isSeqApply 2005-02-17 + */ +object testBugSequenceApply { + + val x = List(1,2,3); + + case class ThreeBars extends Seq[Int] { + override def length = 3; + def elements = x.elements; + def apply(i:Int) = x.apply(i); + } + + // this works + def main:Unit = { + Console.print("testBugSequenceApply "); + val z: Seq[Int] = new ThreeBars(); + Console.print(z.match { + case Seq(1,2,3) => "hello" // but ThreeBars is a case class... + }); + + Console.print(ThreeBars().match { + case Seq(1,2,3) => " hello" // but ThreeBars is a case class... + }); + } +} |