summaryrefslogtreecommitdiff
path: root/test/files/run/macro-system-properties.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-05-09 12:07:03 +0200
committerEugene Burmako <xeno.by@gmail.com>2013-05-09 12:07:03 +0200
commita3d03ab8667e09e53c74d3fbb0cd7b8ae00fc8c9 (patch)
treec263ae2ec9d1b453c1b6697fc6c863a74311dc38 /test/files/run/macro-system-properties.scala
parent5c77e01794434b2fa01a1bd250c08198c31796e3 (diff)
downloadscala-a3d03ab8667e09e53c74d3fbb0cd7b8ae00fc8c9.tar.gz
scala-a3d03ab8667e09e53c74d3fbb0cd7b8ae00fc8c9.tar.bz2
scala-a3d03ab8667e09e53c74d3fbb0cd7b8ae00fc8c9.zip
fixes a crash in ReflectionUtils.systemProperties
Due to SI-7465 we were erroneously assuming that System.getProperties only contains string key and string values. This led to a CCE when there was something else.
Diffstat (limited to 'test/files/run/macro-system-properties.scala')
-rw-r--r--test/files/run/macro-system-properties.scala16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/files/run/macro-system-properties.scala b/test/files/run/macro-system-properties.scala
new file mode 100644
index 0000000000..e182defc81
--- /dev/null
+++ b/test/files/run/macro-system-properties.scala
@@ -0,0 +1,16 @@
+import scala.tools.nsc._
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+ import language.experimental._, reflect.macros.Context
+ object GrabContext {
+ def lastContext = Option(System.getProperties.get("lastContext").asInstanceOf[reflect.macros.runtime.Context])
+ // System.properties lets you stash true globals (unlike statics which are classloader scoped)
+ def impl(c: Context)() = { System.getProperties.put("lastContext", c); c.literalUnit }
+ def grab() = macro impl
+ }
+ object Test { class C(implicit a: Any) { GrabContext.grab } }
+ object Test { class C(implicit a: Any) { GrabContext.grab } }
+ """
+}