summaryrefslogtreecommitdiff
path: root/test/files/run/t6288.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-12-11 12:26:52 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-12-11 12:26:52 +0100
commit79a43d78b27232be005755eb206fd9e4ce9a0625 (patch)
tree0f23ceceadf53e22441e333fe1733b6e91ad7476 /test/files/run/t6288.scala
parent0acb8a30c379f268e8a3e1340504530493a1a1dc (diff)
downloadscala-79a43d78b27232be005755eb206fd9e4ce9a0625.tar.gz
scala-79a43d78b27232be005755eb206fd9e4ce9a0625.tar.bz2
scala-79a43d78b27232be005755eb206fd9e4ce9a0625.zip
SI-6288 Position argument of unapply
`atPos(pos) { ... }` doesn't descend into children of already positioned trees, we need to manually set the position of `CODE.REF(binder)` to that of the stunt double `Ident(nme.SELECTOR_DUMMY)`.
Diffstat (limited to 'test/files/run/t6288.scala')
-rw-r--r--test/files/run/t6288.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/files/run/t6288.scala b/test/files/run/t6288.scala
new file mode 100644
index 0000000000..9d8fb990d7
--- /dev/null
+++ b/test/files/run/t6288.scala
@@ -0,0 +1,25 @@
+import scala.tools.partest._
+import java.io.{Console => _, _}
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -Xprint:patmat -Xprint-pos -d " + testOutput.path
+
+ override def code =
+ """
+ |object Case3 {
+ | def unapply(z: Any): Option[Int] = Some(-1)
+ |
+ | "" match {
+ | case Case3(nr) => ()
+ | }
+ |}""".stripMargin.trim
+
+ override def show(): Unit = {
+ // Now: [84][84]Case3.unapply([84]x1);
+ // Was: [84][84]Case3.unapply([64]x1);
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}