summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorFrançois Garillot <francois@garillot.net>2013-06-21 13:49:37 +0200
committerPaul Phillips <paulp@improving.org>2013-07-24 13:13:31 -0700
commitc34b048c2f35ae48dad50cf1b870c8c6dde71fd9 (patch)
tree2cfcbb0bab76dcd662feab074246cee49d85ed11 /test/files/run
parentfc4b464faeb43c3e2917b11a95c4f84481c443f7 (diff)
downloadscala-c34b048c2f35ae48dad50cf1b870c8c6dde71fd9.tar.gz
scala-c34b048c2f35ae48dad50cf1b870c8c6dde71fd9.tar.bz2
scala-c34b048c2f35ae48dad50cf1b870c8c6dde71fd9.zip
[backport] SI-7569 Fix end position in PostfixSelect tree
introduced in 5b54681: the end position of Postfix operators should take the operator length into account. review by @som-snytt
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t7569.check12
-rw-r--r--test/files/run/t7569.scala19
2 files changed, 31 insertions, 0 deletions
diff --git a/test/files/run/t7569.check b/test/files/run/t7569.check
new file mode 100644
index 0000000000..aade96d233
--- /dev/null
+++ b/test/files/run/t7569.check
@@ -0,0 +1,12 @@
+source-newSource1.scala,line-3,offset=49 A.this.one
+source-newSource1.scala,line-3,offset=49 A.this
+source-newSource1.scala,line-2,offset=41 A.super.<init>()
+source-newSource1.scala,line-2,offset=41 A.super.<init>
+source-newSource1.scala,line-2,offset=41 this
+source-newSource1.scala,line-3,offset=49 A.this.one
+source-newSource1.scala,line-3,offset=49 A.this
+RangePosition(newSource1.scala, 55, 57, 65) scala.Int.box(1).toString()
+RangePosition(newSource1.scala, 55, 57, 65) scala.Int.box(1).toString
+RangePosition(newSource1.scala, 55, 55, 56) scala.Int.box(1)
+NoPosition scala.Int.box
+NoPosition scala.Int
diff --git a/test/files/run/t7569.scala b/test/files/run/t7569.scala
new file mode 100644
index 0000000000..b1b1443a18
--- /dev/null
+++ b/test/files/run/t7569.scala
@@ -0,0 +1,19 @@
+import scala.tools.partest._
+object Test extends CompilerTest {
+ import global._
+ override def extraSettings = super.extraSettings + " -Yrangepos"
+ override def sources = List(
+ """|import scala.language.postfixOps
+ |class A {
+ | val one = 1 toString
+ |}""".stripMargin
+ )
+ def check(source: String, unit: CompilationUnit) {
+ for (ClassDef(_, _, _, Template(_, _, stats)) <- unit.body ; stat <- stats ; t <- stat) {
+ t match {
+ case _: Select | _ : Apply | _:This => println("%-15s %s".format(t.pos.toString, t))
+ case _ =>
+ }
+ }
+ }
+}