summaryrefslogtreecommitdiff
path: root/test/files/run/reify_maps.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/reify_maps.scala')
-rw-r--r--test/files/run/reify_maps.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/files/run/reify_maps.scala b/test/files/run/reify_maps.scala
new file mode 100644
index 0000000000..d3d95ffa24
--- /dev/null
+++ b/test/files/run/reify_maps.scala
@@ -0,0 +1,25 @@
+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{
+ val colors = Map("red" -> 0xFF0000,
+ "turquoise" -> 0x00FFFF,
+ "black" -> 0x000000,
+ "orange" -> 0xFF8040,
+ "brown" -> 0x804000)
+ for (name <- List("red", "green", "blue", "turquoise")) println(
+ colors.get(name) match {
+ case Some(code) =>
+ name + " has code: " + code
+ case None =>
+ "Unknown color: " + name
+ }
+ )
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ toolbox.runExpr(code.tree)
+}