summaryrefslogtreecommitdiff
path: root/test/files/run/t5923a
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-05-12 14:53:25 +0200
committerEugene Burmako <xeno.by@gmail.com>2013-05-12 22:18:59 +0200
commitadef4b526833a804dcbc160ff67c83e42c9fc2ee (patch)
treeefa187b493141b363053765e07cff8e401bcc7be /test/files/run/t5923a
parent7f29f8512d4975cf3a5a0b536a8910e4e3b4316b (diff)
downloadscala-adef4b526833a804dcbc160ff67c83e42c9fc2ee.tar.gz
scala-adef4b526833a804dcbc160ff67c83e42c9fc2ee.tar.bz2
scala-adef4b526833a804dcbc160ff67c83e42c9fc2ee.zip
SI-5923 instantiates targs in deferred macro applications
In January I submitted a pull request that, as I thought back then, fixes SI-5923: https://github.com/scala/scala/commit/fe60284769. The pull request was merged, and everyone was happy that the bug got fixed. Unfortunately, the fix was: a) incomplete, b) broke something else, as noticed by Miles in https://groups.google.com/d/topic/scala-internals/7pA9CiiD3u8/discussion. Now we got a real fix in 2.10.x (https://github.com/scala/scala/commit/90ac5c4e13), and it's my pleasure to port it to master.
Diffstat (limited to 'test/files/run/t5923a')
-rw-r--r--test/files/run/t5923a/Macros_1.scala14
-rw-r--r--test/files/run/t5923a/Test_2.scala5
2 files changed, 19 insertions, 0 deletions
diff --git a/test/files/run/t5923a/Macros_1.scala b/test/files/run/t5923a/Macros_1.scala
new file mode 100644
index 0000000000..6d21362c4d
--- /dev/null
+++ b/test/files/run/t5923a/Macros_1.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+case class C[T](t: String)
+object C {
+ implicit def foo[T]: C[T] = macro Macros.impl[T]
+}
+
+object Macros {
+ def impl[T: c.WeakTypeTag](c: Context) = {
+ import c.universe._
+ reify(C[T](c.literal(weakTypeOf[T].toString).splice))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t5923a/Test_2.scala b/test/files/run/t5923a/Test_2.scala
new file mode 100644
index 0000000000..001ff9aea8
--- /dev/null
+++ b/test/files/run/t5923a/Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ println(implicitly[C[Int]])
+ println(implicitly[C[String]])
+ println(implicitly[C[Nothing]])
+} \ No newline at end of file