diff options
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/t8934a/A_1.scala | 18 | ||||
-rw-r--r-- | test/files/pos/t8934a/Test_2.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t8934a/Test_2.scala | 12 |
3 files changed, 31 insertions, 0 deletions
diff --git a/test/files/pos/t8934a/A_1.scala b/test/files/pos/t8934a/A_1.scala new file mode 100644 index 0000000000..6c1f29d030 --- /dev/null +++ b/test/files/pos/t8934a/A_1.scala @@ -0,0 +1,18 @@ +import language.experimental.macros +import reflect.macros.whitebox.Context + +object Unapply { + def impl1(c: Context)(a: c.Tree): c.Tree = { + import c.universe._ + q"(new { def unapply[T](a: String): Option[(Int, String)] = ??? }).unapply($a)" + } + def unapply(a: Any): Any = macro impl1 +} + +object UnapplySeq { + def impl1(c: Context)(a: c.Tree): c.Tree = { + import c.universe._ + q"(new { def unapplySeq[T](a: String): Option[(Int, Seq[String])] = ??? }).unapplySeq($a)" + } + def unapplySeq(a: Any): Any = macro impl1 +} diff --git a/test/files/pos/t8934a/Test_2.flags b/test/files/pos/t8934a/Test_2.flags new file mode 100644 index 0000000000..618dfe2b75 --- /dev/null +++ b/test/files/pos/t8934a/Test_2.flags @@ -0,0 +1 @@ +-Ystop-after:typer -Ymacro-expand:discard -nowarn diff --git a/test/files/pos/t8934a/Test_2.scala b/test/files/pos/t8934a/Test_2.scala new file mode 100644 index 0000000000..e1792ed3c5 --- /dev/null +++ b/test/files/pos/t8934a/Test_2.scala @@ -0,0 +1,12 @@ +object Test { + "" match { + case Unapply(a, b) => + a: Int + b: String + case UnapplySeq(a, b1, b2) => + a: Int + b1: String + b2: String + } +} +// These used to fail `too many patterns` under -Ymacro-expand:discard |