summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-11-26 23:15:18 -0800
committerJason Zaugg <jzaugg@gmail.com>2013-11-26 23:15:18 -0800
commit073ebbd20ce9775260b83a78ecf9ed6a3e6d3d9e (patch)
tree54774da32b079d290c48a4f2e7ea2e7915ecb45e /test/files/run
parenta6f758202ada377888563d51915119a386dd6b3e (diff)
parentf30ae6149ddd4386debbf3a5650b1fc005ed00e9 (diff)
downloadscala-073ebbd20ce9775260b83a78ecf9ed6a3e6d3d9e.tar.gz
scala-073ebbd20ce9775260b83a78ecf9ed6a3e6d3d9e.tar.bz2
scala-073ebbd20ce9775260b83a78ecf9ed6a3e6d3d9e.zip
Merge pull request #3197 from retronym/merge/2.10.x-positions-to-master
Merge 2.10.x, and PR #3196, to master
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/dynamic-applyDynamic.check14
-rw-r--r--test/files/run/dynamic-applyDynamic.scala26
-rw-r--r--test/files/run/dynamic-applyDynamicNamed.check14
-rw-r--r--test/files/run/dynamic-applyDynamicNamed.scala26
-rw-r--r--test/files/run/dynamic-selectDynamic.check13
-rw-r--r--test/files/run/dynamic-selectDynamic.scala25
-rw-r--r--test/files/run/dynamic-updateDynamic.check14
-rw-r--r--test/files/run/dynamic-updateDynamic.scala28
8 files changed, 160 insertions, 0 deletions
diff --git a/test/files/run/dynamic-applyDynamic.check b/test/files/run/dynamic-applyDynamic.check
new file mode 100644
index 0000000000..ae6996f8fc
--- /dev/null
+++ b/test/files/run/dynamic-applyDynamic.check
@@ -0,0 +1,14 @@
+[[syntax trees at end of typer]] // newSource1.scala
+[0:67]package [0:0]<empty> {
+ [0:67]object X extends [9:67][67]scala.AnyRef {
+ [67]def <init>(): [9]X.type = [67]{
+ [67][67][67]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.applyDynamic(<39:45>"method")([46:48]10);
+ [56:61]<56:57><56:57>[56]X.this.d.applyDynamic(<56:57>"apply")([58:60]10)
+ }
+}
+
diff --git a/test/files/run/dynamic-applyDynamic.scala b/test/files/run/dynamic-applyDynamic.scala
new file mode 100644
index 0000000000..b06041194c
--- /dev/null
+++ b/test/files/run/dynamic-applyDynamic.scala
@@ -0,0 +1,26 @@
+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.method(10)
+ d(10)
+ }
+ """.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
+
+import language.dynamics
+class D extends Dynamic {
+ def applyDynamic(name: String)(value: Any) = ???
+} \ No newline at end of file
diff --git a/test/files/run/dynamic-applyDynamicNamed.check b/test/files/run/dynamic-applyDynamicNamed.check
new file mode 100644
index 0000000000..c4e050ba17
--- /dev/null
+++ b/test/files/run/dynamic-applyDynamicNamed.check
@@ -0,0 +1,14 @@
+[[syntax trees at end of typer]] // newSource1.scala
+[0:97]package [0:0]<empty> {
+ [0:97]object X extends [9:97][97]scala.AnyRef {
+ [97]def <init>(): [9]X.type = [97]{
+ [97][97][97]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:70][37:38][37:38][37]X.this.d.applyDynamicNamed(<39:43>"meth")([44:55][44][44]scala.Tuple2.apply[[44]String, [44]Int]([44:50]"value1", [53:55]10), [57:69][57][57]scala.Tuple2.apply[[57]String, [57]Int]([57:63]"value2", [66:69]100));
+ [77:91]<77:78><77:78>[77]X.this.d.applyDynamicNamed(<77:78>"apply")([79:90][79][79]scala.Tuple2.apply[[79]String, [79]Int]([79:85]"value1", [88:90]10))
+ }
+}
+
diff --git a/test/files/run/dynamic-applyDynamicNamed.scala b/test/files/run/dynamic-applyDynamicNamed.scala
new file mode 100644
index 0000000000..cc59f9058b
--- /dev/null
+++ b/test/files/run/dynamic-applyDynamicNamed.scala
@@ -0,0 +1,26 @@
+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.meth(value1 = 10, value2 = 100)
+ d(value1 = 10)
+ }
+ """.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
+
+import language.dynamics
+class D extends Dynamic {
+ def applyDynamicNamed(name: String)(value: (String, Any)*) = ???
+}
diff --git a/test/files/run/dynamic-selectDynamic.check b/test/files/run/dynamic-selectDynamic.check
new file mode 100644
index 0000000000..9635ca4e6f
--- /dev/null
+++ b/test/files/run/dynamic-selectDynamic.check
@@ -0,0 +1,13 @@
+[[syntax trees at end of typer]] // newSource1.scala
+[0:50]package [0:0]<empty> {
+ [0:50]object X extends [9:50][50]scala.AnyRef {
+ [50]def <init>(): [9]X.type = [50]{
+ [50][50][50]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:38][37:38][37]X.this.d.selectDynamic(<39:44>"field")
+ }
+}
+
diff --git a/test/files/run/dynamic-selectDynamic.scala b/test/files/run/dynamic-selectDynamic.scala
new file mode 100644
index 0000000000..bd6c138c50
--- /dev/null
+++ b/test/files/run/dynamic-selectDynamic.scala
@@ -0,0 +1,25 @@
+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
+ }
+ """.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
+
+import language.dynamics
+class D extends Dynamic {
+ def selectDynamic(name: String) = ???
+}
diff --git a/test/files/run/dynamic-updateDynamic.check b/test/files/run/dynamic-updateDynamic.check
new file mode 100644
index 0000000000..154fea34cb
--- /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 {
+ [69]def <init>(): [9]X.type = [69]{
+ [69][69][69]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 = ???
+}
+