From ced4ddfef6b26f5aa84960289bb08c4cb883d071 Mon Sep 17 00:00:00 2001 From: David MacIver Date: Sun, 26 Oct 2008 12:52:21 +0000 Subject: Fix to #1450. Moved test from pending. --- src/compiler/scala/tools/nsc/matching/CodeFactory.scala | 4 +--- src/compiler/scala/tools/nsc/symtab/StdNames.scala | 1 + test/files/run/matchonstream.check | 1 + test/files/run/matchonstream.scala | 3 +++ test/pending/run/matchonstream.check | 1 - test/pending/run/matchonstream.scala | 3 --- 6 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 test/files/run/matchonstream.check create mode 100644 test/files/run/matchonstream.scala delete mode 100644 test/pending/run/matchonstream.check delete mode 100644 test/pending/run/matchonstream.scala diff --git a/src/compiler/scala/tools/nsc/matching/CodeFactory.scala b/src/compiler/scala/tools/nsc/matching/CodeFactory.scala index ff8582edea..3d565b7eaa 100644 --- a/src/compiler/scala/tools/nsc/matching/CodeFactory.scala +++ b/src/compiler/scala/tools/nsc/matching/CodeFactory.scala @@ -48,7 +48,6 @@ trait CodeFactory { /** returns A for T <: Sequence[ A ] */ final def getElemType_Sequence(tpe: Type): Type = { - //System.err.println("getElemType_Sequence("+tpe.widen()+")") val tpe1 = tpe.widen.baseType(definitions.SeqClass) if (tpe1 == NoType) @@ -66,8 +65,7 @@ trait CodeFactory { /** for tree of sequence type, returns tree that drops first i elements */ final def seqDrop(sel:Tree, ix: Int) = if (ix == 0) sel else - typed { Apply(Select(Select(sel, nme.toList), nme.drop), - List(Literal(Constant(ix)))) } + typed { Select(Apply(Select(sel, nme.drop), List(Literal(Constant(ix)))), nme.toSeq) } /** for tree of sequence type, returns tree that drops first i elements */ final def seqElement(sel:Tree, ix: Int) = diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala index c230cb5ab0..f45f581d6c 100644 --- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala +++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala @@ -354,6 +354,7 @@ trait StdNames { val tag = newTermName("$tag") val tail = newTermName("tail") val toList = newTermName("toList") + val toSeq = newTermName("toSeq") val toString_ = newTermName("toString") val clone_ = newTermName("clone") val that = newTermName("that") diff --git a/test/files/run/matchonstream.check b/test/files/run/matchonstream.check new file mode 100644 index 0000000000..3dc3aa5164 --- /dev/null +++ b/test/files/run/matchonstream.check @@ -0,0 +1 @@ +It worked! diff --git a/test/files/run/matchonstream.scala b/test/files/run/matchonstream.scala new file mode 100644 index 0000000000..d38d81d9fc --- /dev/null +++ b/test/files/run/matchonstream.scala @@ -0,0 +1,3 @@ +object Test extends Application{ + Stream.from(1) match { case Stream(1, 2, x @_*) => println("It worked!") } +} diff --git a/test/pending/run/matchonstream.check b/test/pending/run/matchonstream.check deleted file mode 100644 index 3dc3aa5164..0000000000 --- a/test/pending/run/matchonstream.check +++ /dev/null @@ -1 +0,0 @@ -It worked! diff --git a/test/pending/run/matchonstream.scala b/test/pending/run/matchonstream.scala deleted file mode 100644 index d38d81d9fc..0000000000 --- a/test/pending/run/matchonstream.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends Application{ - Stream.from(1) match { case Stream(1, 2, x @_*) => println("It worked!") } -} -- cgit v1.2.3