diff options
author | Simon Schaefer <mail@antoras.de> | 2013-11-24 00:07:31 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-11-26 19:02:54 +0100 |
commit | 3629b645cc2b1403c51925dd9c696a57008c0ce2 (patch) | |
tree | a1943705b83d870e96cd4270707e0be3c03f5f5b /test/files | |
parent | 696545d53f89d8a764273dacca5c6d3043911722 (diff) | |
download | scala-3629b645cc2b1403c51925dd9c696a57008c0ce2.tar.gz scala-3629b645cc2b1403c51925dd9c696a57008c0ce2.tar.bz2 scala-3629b645cc2b1403c51925dd9c696a57008c0ce2.zip |
SI-8005 Fixes NoPositon error for updateDynamic calls
Previously there occurred a NoPosition error when one asks for position
information in the AST because no positions were set to the trees
created during the transformation for updateDynamic calls. This commit
applies range positions to the trees in order to being able to highlight
them inside of the scala-ide.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/dynamic-updateDynamic.check | 14 | ||||
-rw-r--r-- | test/files/run/dynamic-updateDynamic.scala | 28 |
2 files changed, 42 insertions, 0 deletions
diff --git a/test/files/run/dynamic-updateDynamic.check b/test/files/run/dynamic-updateDynamic.check new file mode 100644 index 0000000000..3e21b7dfdc --- /dev/null +++ b/test/files/run/dynamic-updateDynamic.check @@ -0,0 +1,14 @@ +[[syntax trees at end of typer]] // newSource1.scala +[0:69]package [0:0]<empty> { + [0:69]object X extends [9:69][69]scala.AnyRef { + [9]def <init>(): [9]X.type = [9]{ + [9][9][9]X.super.<init>(); + [9]() + }; + [17:30]private[this] val d: [21]D = [25:30][25:30][25:30]new [29:30]D(); + [21]<stable> <accessor> def d: [21]D = [21][21]X.this.d; + [37:49][37:38][37:38][37]X.this.d.updateDynamic(<39:44>"field")([47:49]10); + [56:57][56:57][56]X.this.d.selectDynamic(<58:63>"field") + } +} + diff --git a/test/files/run/dynamic-updateDynamic.scala b/test/files/run/dynamic-updateDynamic.scala new file mode 100644 index 0000000000..80fe0ea35f --- /dev/null +++ b/test/files/run/dynamic-updateDynamic.scala @@ -0,0 +1,28 @@ +import scala.tools.partest.DirectTest + +object Test extends DirectTest { + + override def extraSettings: String = + s"-usejavacp -Xprint-pos -Xprint:typer -Yrangepos -Ystop-after:typer -d ${testOutput.path}" + + override def code = """ + object X { + val d = new D + d.field = 10 + d.field + } + """.trim + + override def show(): Unit = { + Console.withErr(System.out) { + compile() + } + } +} + +import language.dynamics +class D extends Dynamic { + def selectDynamic(name: String): Any = ??? + def updateDynamic(name: String)(value: Any): Unit = ??? +} + |