summaryrefslogtreecommitdiff
path: root/test/pending/run
diff options
context:
space:
mode:
authorVojin Jovanovic <vojin.jovanovic@epfl.ch>2012-01-09 18:11:10 +0100
committerVojin Jovanovic <vojin.jovanovic@epfl.ch>2012-01-09 18:11:10 +0100
commit1126912bce5d098571c1bd29a04e4781e19c3d85 (patch)
tree79e753014c1adfa26e39e32911125bfc0ad8ee4c /test/pending/run
parent5a4b555c378d79d57b59dfd6edafd2b9a59866bb (diff)
parent820491ed6376e9f8f8a8102387495113dce55444 (diff)
downloadscala-1126912bce5d098571c1bd29a04e4781e19c3d85.tar.gz
scala-1126912bce5d098571c1bd29a04e4781e19c3d85.tar.bz2
scala-1126912bce5d098571c1bd29a04e4781e19c3d85.zip
Merge branch 'master' into execution-context
Diffstat (limited to 'test/pending/run')
-rw-r--r--test/pending/run/reify_closure1.check2
-rw-r--r--test/pending/run/reify_closure1.scala20
-rw-r--r--test/pending/run/reify_closure2a.check2
-rw-r--r--test/pending/run/reify_closure2a.scala20
-rw-r--r--test/pending/run/reify_closure2b.check2
-rw-r--r--test/pending/run/reify_closure2b.scala22
-rw-r--r--test/pending/run/reify_closure3a.check2
-rw-r--r--test/pending/run/reify_closure3a.scala22
-rw-r--r--test/pending/run/reify_closure3b.check2
-rw-r--r--test/pending/run/reify_closure3b.scala24
-rw-r--r--test/pending/run/reify_closure4a.check2
-rw-r--r--test/pending/run/reify_closure4a.scala22
-rw-r--r--test/pending/run/reify_closure4b.check2
-rw-r--r--test/pending/run/reify_closure4b.scala24
-rw-r--r--test/pending/run/reify_closure5a.check2
-rw-r--r--test/pending/run/reify_closure5a.scala20
-rw-r--r--test/pending/run/reify_closure5b.check2
-rw-r--r--test/pending/run/reify_closure5b.scala22
-rw-r--r--test/pending/run/reify_closure6.check3
-rw-r--r--test/pending/run/reify_closure6.scala26
-rw-r--r--test/pending/run/t5266_1.check2
-rw-r--r--test/pending/run/t5266_1.scala23
-rw-r--r--test/pending/run/t5266_2.check2
-rw-r--r--test/pending/run/t5334_1.scala (renamed from test/pending/run/t5266_2.scala)10
-rw-r--r--test/pending/run/t5334_2.scala15
25 files changed, 262 insertions, 33 deletions
diff --git a/test/pending/run/reify_closure1.check b/test/pending/run/reify_closure1.check
new file mode 100644
index 0000000000..b2f7f08c17
--- /dev/null
+++ b/test/pending/run/reify_closure1.check
@@ -0,0 +1,2 @@
+10
+10
diff --git a/test/pending/run/reify_closure1.scala b/test/pending/run/reify_closure1.scala
new file mode 100644
index 0000000000..825a38dc1d
--- /dev/null
+++ b/test/pending/run/reify_closure1.scala
@@ -0,0 +1,20 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo[T](ys: List[T]): Int => Int = {
+ val fun: reflect.Code[Int => Int] = x => {
+ x
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(List(1, 2, 3))(10))
+ println(foo(List(1, 2, 3, 4))(10))
+}
diff --git a/test/pending/run/reify_closure2a.check b/test/pending/run/reify_closure2a.check
new file mode 100644
index 0000000000..c1f3abd7e6
--- /dev/null
+++ b/test/pending/run/reify_closure2a.check
@@ -0,0 +1,2 @@
+11
+12
diff --git a/test/pending/run/reify_closure2a.scala b/test/pending/run/reify_closure2a.scala
new file mode 100644
index 0000000000..b88bec005d
--- /dev/null
+++ b/test/pending/run/reify_closure2a.scala
@@ -0,0 +1,20 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo(y: Int): Int => Int = {
+ val fun: reflect.Code[Int => Int] = x => {
+ x + y
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(1)(10))
+ println(foo(2)(10))
+}
diff --git a/test/pending/run/reify_closure2b.check b/test/pending/run/reify_closure2b.check
new file mode 100644
index 0000000000..c1f3abd7e6
--- /dev/null
+++ b/test/pending/run/reify_closure2b.check
@@ -0,0 +1,2 @@
+11
+12
diff --git a/test/pending/run/reify_closure2b.scala b/test/pending/run/reify_closure2b.scala
new file mode 100644
index 0000000000..e9fb40bede
--- /dev/null
+++ b/test/pending/run/reify_closure2b.scala
@@ -0,0 +1,22 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo(y: Int): Int => Int = {
+ class Foo(y: Int) {
+ val fun: reflect.Code[Int => Int] = x => {
+ x + y
+ }
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(new Foo(y).fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(1)(10))
+ println(foo(2)(10))
+}
diff --git a/test/pending/run/reify_closure3a.check b/test/pending/run/reify_closure3a.check
new file mode 100644
index 0000000000..c1f3abd7e6
--- /dev/null
+++ b/test/pending/run/reify_closure3a.check
@@ -0,0 +1,2 @@
+11
+12
diff --git a/test/pending/run/reify_closure3a.scala b/test/pending/run/reify_closure3a.scala
new file mode 100644
index 0000000000..6414fa58a3
--- /dev/null
+++ b/test/pending/run/reify_closure3a.scala
@@ -0,0 +1,22 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo(y: Int): Int => Int = {
+ def y1 = y
+
+ val fun: reflect.Code[Int => Int] = x => {
+ x + y1
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(1)(10))
+ println(foo(2)(10))
+}
diff --git a/test/pending/run/reify_closure3b.check b/test/pending/run/reify_closure3b.check
new file mode 100644
index 0000000000..c1f3abd7e6
--- /dev/null
+++ b/test/pending/run/reify_closure3b.check
@@ -0,0 +1,2 @@
+11
+12
diff --git a/test/pending/run/reify_closure3b.scala b/test/pending/run/reify_closure3b.scala
new file mode 100644
index 0000000000..5c4f3c81b9
--- /dev/null
+++ b/test/pending/run/reify_closure3b.scala
@@ -0,0 +1,24 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo(y: Int): Int => Int = {
+ class Foo(y: Int) {
+ def y1 = y
+
+ val fun: reflect.Code[Int => Int] = x => {
+ x + y1
+ }
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(new Foo(y).fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(1)(10))
+ println(foo(2)(10))
+}
diff --git a/test/pending/run/reify_closure4a.check b/test/pending/run/reify_closure4a.check
new file mode 100644
index 0000000000..c1f3abd7e6
--- /dev/null
+++ b/test/pending/run/reify_closure4a.check
@@ -0,0 +1,2 @@
+11
+12
diff --git a/test/pending/run/reify_closure4a.scala b/test/pending/run/reify_closure4a.scala
new file mode 100644
index 0000000000..99e9d82706
--- /dev/null
+++ b/test/pending/run/reify_closure4a.scala
@@ -0,0 +1,22 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo(y: Int): Int => Int = {
+ val y1 = y
+
+ val fun: reflect.Code[Int => Int] = x => {
+ x + y1
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(1)(10))
+ println(foo(2)(10))
+}
diff --git a/test/pending/run/reify_closure4b.check b/test/pending/run/reify_closure4b.check
new file mode 100644
index 0000000000..c1f3abd7e6
--- /dev/null
+++ b/test/pending/run/reify_closure4b.check
@@ -0,0 +1,2 @@
+11
+12
diff --git a/test/pending/run/reify_closure4b.scala b/test/pending/run/reify_closure4b.scala
new file mode 100644
index 0000000000..24dfa9fe17
--- /dev/null
+++ b/test/pending/run/reify_closure4b.scala
@@ -0,0 +1,24 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo(y: Int): Int => Int = {
+ class Foo(y: Int) {
+ val y1 = y
+
+ val fun: reflect.Code[Int => Int] = x => {
+ x + y1
+ }
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(new Foo(y).fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(1)(10))
+ println(foo(2)(10))
+}
diff --git a/test/pending/run/reify_closure5a.check b/test/pending/run/reify_closure5a.check
new file mode 100644
index 0000000000..df9e19c591
--- /dev/null
+++ b/test/pending/run/reify_closure5a.check
@@ -0,0 +1,2 @@
+13
+14
diff --git a/test/pending/run/reify_closure5a.scala b/test/pending/run/reify_closure5a.scala
new file mode 100644
index 0000000000..0ac53d5479
--- /dev/null
+++ b/test/pending/run/reify_closure5a.scala
@@ -0,0 +1,20 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo[T](ys: List[T]): Int => Int = {
+ val fun: reflect.Code[Int => Int] = x => {
+ x + ys.length
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(List(1, 2, 3))(10))
+ println(foo(List(1, 2, 3, 4))(10))
+}
diff --git a/test/pending/run/reify_closure5b.check b/test/pending/run/reify_closure5b.check
new file mode 100644
index 0000000000..df9e19c591
--- /dev/null
+++ b/test/pending/run/reify_closure5b.check
@@ -0,0 +1,2 @@
+13
+14
diff --git a/test/pending/run/reify_closure5b.scala b/test/pending/run/reify_closure5b.scala
new file mode 100644
index 0000000000..02eb771f0c
--- /dev/null
+++ b/test/pending/run/reify_closure5b.scala
@@ -0,0 +1,22 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo[T](ys: List[T]): Int => Int = {
+ class Foo[T](ys: List[T]) {
+ val fun: reflect.Code[Int => Int] = x => {
+ x + ys.length
+ }
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(new Foo(ys).fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(List(1, 2, 3))(10))
+ println(foo(List(1, 2, 3, 4))(10))
+}
diff --git a/test/pending/run/reify_closure6.check b/test/pending/run/reify_closure6.check
new file mode 100644
index 0000000000..3526d04b0e
--- /dev/null
+++ b/test/pending/run/reify_closure6.check
@@ -0,0 +1,3 @@
+first invocation = 15
+second invocation = 18
+q after second invocation = 2
diff --git a/test/pending/run/reify_closure6.scala b/test/pending/run/reify_closure6.scala
new file mode 100644
index 0000000000..909071aa44
--- /dev/null
+++ b/test/pending/run/reify_closure6.scala
@@ -0,0 +1,26 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ var q = 0
+ def foo[T](ys: List[T]): Int => Int = {
+ val z = 1
+ var y = 0
+ val fun: reflect.Code[Int => Int] = x => {
+ y += 1
+ q += 1
+ x + ys.length * z + q + y
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println("first invocation = " + foo(List(1, 2, 3))(10))
+ println("second invocation = " + foo(List(1, 2, 3, 4))(10))
+ println("q after second invocation = " + q)
+}
diff --git a/test/pending/run/t5266_1.check b/test/pending/run/t5266_1.check
deleted file mode 100644
index 3feac16a0b..0000000000
--- a/test/pending/run/t5266_1.check
+++ /dev/null
@@ -1,2 +0,0 @@
-2
-evaluated = null \ No newline at end of file
diff --git a/test/pending/run/t5266_1.scala b/test/pending/run/t5266_1.scala
deleted file mode 100644
index 06a81a04ea..0000000000
--- a/test/pending/run/t5266_1.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-import scala.tools.nsc.reporters._
-import scala.tools.nsc.Settings
-import reflect.runtime.Mirror.ToolBox
-
-object Test extends App {
- val code = scala.reflect.Code.lift{
- def x = 2
- println(x)
- };
-
- val settings = new Settings
- settings.debug.value = true
- settings.Xshowtrees.value = true
- settings.Xprint.value = List("typer")
- settings.printtypes.value = true
- settings.Ytyperdebug.value = true
-
- val reporter = new ConsoleReporter(settings)
- val toolbox = new ToolBox(reporter)
- val ttree = toolbox.typeCheck(code.tree)
- val evaluated = toolbox.runExpr(ttree)
- println("evaluated = " + evaluated)
-} \ No newline at end of file
diff --git a/test/pending/run/t5266_2.check b/test/pending/run/t5266_2.check
deleted file mode 100644
index 3feac16a0b..0000000000
--- a/test/pending/run/t5266_2.check
+++ /dev/null
@@ -1,2 +0,0 @@
-2
-evaluated = null \ No newline at end of file
diff --git a/test/pending/run/t5266_2.scala b/test/pending/run/t5334_1.scala
index cd841da021..c1eba89c2b 100644
--- a/test/pending/run/t5266_2.scala
+++ b/test/pending/run/t5334_1.scala
@@ -4,14 +4,12 @@ import reflect.runtime.Mirror.ToolBox
object Test extends App {
val code = scala.reflect.Code.lift{
- def x = 2
- def y = x
- println(y)
+ class C
+ new C
};
- val reporter = new ConsoleReporter(settings)
+ val reporter = new ConsoleReporter(new Settings)
val toolbox = new ToolBox(reporter)
val ttree = toolbox.typeCheck(code.tree)
- val evaluated = toolbox.runExpr(ttree)
- println("evaluated = " + evaluated)
+ toolbox.runExpr(ttree)
}
diff --git a/test/pending/run/t5334_2.scala b/test/pending/run/t5334_2.scala
new file mode 100644
index 0000000000..361b8c85f2
--- /dev/null
+++ b/test/pending/run/t5334_2.scala
@@ -0,0 +1,15 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ class C
+ List((new C, new C))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}