summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-08-08 08:15:56 -0700
committerEugene Burmako <xeno.by@gmail.com>2013-08-08 08:15:56 -0700
commited5c1abbfca18a880c79048cc7e9578ae932101d (patch)
tree7f4dd7f6ea5aaa42b2d473f5095d5134924f7c66 /test
parente9ccb416b307d853120411572a57cb57867a9afc (diff)
parent36524c21964696ec71170970c6a65f9bb7aec8f0 (diff)
downloadscala-ed5c1abbfca18a880c79048cc7e9578ae932101d.tar.gz
scala-ed5c1abbfca18a880c79048cc7e9578ae932101d.tar.bz2
scala-ed5c1abbfca18a880c79048cc7e9578ae932101d.zip
Merge pull request #2800 from densh/topic/toolbox-positions
SI-7331 tb.parse returns unpositioned trees
Diffstat (limited to 'test')
-rw-r--r--test/files/run/t7331a.check2
-rw-r--r--test/files/run/t7331a.scala10
-rw-r--r--test/files/run/t7331b.check3
-rw-r--r--test/files/run/t7331b.scala11
-rw-r--r--test/files/run/t7331c.check3
-rw-r--r--test/files/run/t7331c.scala11
6 files changed, 40 insertions, 0 deletions
diff --git a/test/files/run/t7331a.check b/test/files/run/t7331a.check
new file mode 100644
index 0000000000..a59b400344
--- /dev/null
+++ b/test/files/run/t7331a.check
@@ -0,0 +1,2 @@
+source-<toolbox>,line-1,offset=0
+2 \ No newline at end of file
diff --git a/test/files/run/t7331a.scala b/test/files/run/t7331a.scala
new file mode 100644
index 0000000000..1851945e63
--- /dev/null
+++ b/test/files/run/t7331a.scala
@@ -0,0 +1,10 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val tb = cm.mkToolBox()
+ val tree = tb.parse("x")
+ println(tree.pos)
+ println(tree.pos.source.content.length)
+} \ No newline at end of file
diff --git a/test/files/run/t7331b.check b/test/files/run/t7331b.check
new file mode 100644
index 0000000000..7034a95a3f
--- /dev/null
+++ b/test/files/run/t7331b.check
@@ -0,0 +1,3 @@
+reflective compilation has failed:
+
+')' expected but eof found.
diff --git a/test/files/run/t7331b.scala b/test/files/run/t7331b.scala
new file mode 100644
index 0000000000..052656d11b
--- /dev/null
+++ b/test/files/run/t7331b.scala
@@ -0,0 +1,11 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.{ToolBox, ToolBoxError}
+
+object Test extends App {
+ val tb = cm.mkToolBox()
+ try tb.parse("f(x")
+ catch {
+ case ToolBoxError(msg, _) => println(msg)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t7331c.check b/test/files/run/t7331c.check
new file mode 100644
index 0000000000..af9f1b1ad9
--- /dev/null
+++ b/test/files/run/t7331c.check
@@ -0,0 +1,3 @@
+ClassDef(Modifiers(), newTypeName("C"), List(), Template(List(Select(Ident(scala), newTypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))))))
+source-<toolbox>,line-1,offset=6
+NoPosition
diff --git a/test/files/run/t7331c.scala b/test/files/run/t7331c.scala
new file mode 100644
index 0000000000..75873afcd0
--- /dev/null
+++ b/test/files/run/t7331c.scala
@@ -0,0 +1,11 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val tb = cm.mkToolBox()
+ val tree = tb.parse("class C").asInstanceOf[ClassDef]
+ println(showRaw(tree))
+ println(tree.pos)
+ println(tree.impl.self.pos)
+} \ No newline at end of file