summaryrefslogtreecommitdiff
path: root/test/files/run/t6187.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/t6187.scala')
-rw-r--r--test/files/run/t6187.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/t6187.scala b/test/files/run/t6187.scala
new file mode 100644
index 0000000000..ae642917e7
--- /dev/null
+++ b/test/files/run/t6187.scala
@@ -0,0 +1,18 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ override def code = """
+import language.experimental.macros, reflect.macros.Context
+def macroImpl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[List[T]] = {
+ val r = c.universe.reify { List(t.splice) }
+ c.Expr[List[T]]( c.resetLocalAttrs(r.tree) )
+}
+def demo[T](t: T): List[T] = macro macroImpl[T]
+def m[T](t: T): List[List[T]] =
+ demo( List((t,true)) collect { case (x,true) => x } )
+m(List(1))
+// Showing we haven't added unreachable warnings
+List(1) collect { case x => x }
+List("") collect { case x => x }
+ """.trim
+}