diff options
Diffstat (limited to 'test')
-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 = ??? +} + |