summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/code.scala20
-rw-r--r--test/files/pos/t0651.scala4
-rw-r--r--test/files/pos/t531.scala10
-rw-r--r--test/files/pos/t532.scala10
4 files changed, 44 insertions, 0 deletions
diff --git a/test/files/pos/code.scala b/test/files/pos/code.scala
new file mode 100644
index 0000000000..4def5d2f94
--- /dev/null
+++ b/test/files/pos/code.scala
@@ -0,0 +1,20 @@
+import reflect.runtime.Mirror.ToolBox
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+
+object Test extends App {
+ def foo[T](ys: List[T]) = {
+ val fun: reflect.Code[Int => Int] = x => x + ys.length
+ fun
+ }
+ val code = foo(List(2))
+ val tree = code.tree.asInstanceOf[scala.reflect.runtime.Mirror.Tree]
+ val targetType = code.manifest.tpe.asInstanceOf[scala.reflect.runtime.Mirror.Type]
+ println("testing: "+tree)
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter, args mkString " ")
+ val ttree = toolbox.typeCheck(tree, targetType)
+ println("result = "+ttree)
+}
+
+
diff --git a/test/files/pos/t0651.scala b/test/files/pos/t0651.scala
new file mode 100644
index 0000000000..52bef7e02b
--- /dev/null
+++ b/test/files/pos/t0651.scala
@@ -0,0 +1,4 @@
+object Reflection1 extends App {
+ case class Element(name: String)
+ println(reflect.Code.lift({val e = Element("someName"); e}).tree)
+}
diff --git a/test/files/pos/t531.scala b/test/files/pos/t531.scala
new file mode 100644
index 0000000000..02763e08f1
--- /dev/null
+++ b/test/files/pos/t531.scala
@@ -0,0 +1,10 @@
+object Test extends App {
+ import scala.reflect._;
+ def titi = {
+ var truc = 0
+ val tata: Code[()=>Unit] = () => {
+ truc = 6
+ }
+ ()
+ }
+}
diff --git a/test/files/pos/t532.scala b/test/files/pos/t532.scala
new file mode 100644
index 0000000000..32649b1629
--- /dev/null
+++ b/test/files/pos/t532.scala
@@ -0,0 +1,10 @@
+object Test extends App {
+ import scala.reflect._;
+ def titi: Unit = {
+ var truc = 0
+ val tata: Code[()=>Unit] = () => {
+ truc = truc + 6
+ }
+ ()
+ }
+}