diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-08-20 10:31:23 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-08-20 10:31:23 -0700 |
commit | 38d5b203745e799d819759ccce2f96655085f537 (patch) | |
tree | 5c0e664803a9682bb25c6b48658d0660d9727a02 /test/files/neg/t5903b/Macros_1.scala | |
parent | 1df7b32a15bac0c57d4371b6e081f06d9e145aaf (diff) | |
parent | 01f771e687291803da1983bdac97d9288c069bfe (diff) | |
download | scala-38d5b203745e799d819759ccce2f96655085f537.tar.gz scala-38d5b203745e799d819759ccce2f96655085f537.tar.bz2 scala-38d5b203745e799d819759ccce2f96655085f537.zip |
Merge pull request #2848 from paulp/patmat2
Pattern matcher: extractors become name-based.
Diffstat (limited to 'test/files/neg/t5903b/Macros_1.scala')
-rw-r--r-- | test/files/neg/t5903b/Macros_1.scala | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/files/neg/t5903b/Macros_1.scala b/test/files/neg/t5903b/Macros_1.scala new file mode 100644 index 0000000000..b1b875969d --- /dev/null +++ b/test/files/neg/t5903b/Macros_1.scala @@ -0,0 +1,23 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +object Interpolation { + implicit class TestInterpolation(c: StringContext) { + object t { + def unapply[T](x: T) = macro Macros.unapplyImpl[T] + } + } +} + +object Macros { + def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = { + import c.universe._ + q""" + new { + def isEmpty = false + def get = "2" + def unapply(x: String) = this + }.unapply($x) + """ + } +} |