diff options
author | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-04-01 22:26:55 +0200 |
---|---|---|
committer | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-04-02 13:05:37 +0200 |
commit | 9fbac09b6ec7fcb1b2df75fcbc04bc795eccd669 (patch) | |
tree | c06549a36370a9a5a9f2d4c6fc7490647b481162 /test/files/scalacheck/quasiquotes/UnliftableProps.scala | |
parent | 8489be16b57a08f51bf3655c99cede52477b3022 (diff) | |
download | scala-9fbac09b6ec7fcb1b2df75fcbc04bc795eccd669.tar.gz scala-9fbac09b6ec7fcb1b2df75fcbc04bc795eccd669.tar.bz2 scala-9fbac09b6ec7fcb1b2df75fcbc04bc795eccd669.zip |
SI-8466 fix quasiquote crash on recursively iterable unlifting
In order to handle unquoting quasiquotes needs to know if type is
iterable and whats the depth of the iterable nesting which is called
rank. (e.g. List[List[Tree]] is rank 2 iterable of Tree)
The logic that checks depth of iterable nesting didn't take a situation
where T is in fact Iterable[T] which caused infinite recursion in
stripIterable function.
In order to fix it stripIterable now always recurs no more than
non-optional limit times.
Diffstat (limited to 'test/files/scalacheck/quasiquotes/UnliftableProps.scala')
-rw-r--r-- | test/files/scalacheck/quasiquotes/UnliftableProps.scala | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/files/scalacheck/quasiquotes/UnliftableProps.scala b/test/files/scalacheck/quasiquotes/UnliftableProps.scala index 1d7629aa29..659b18edab 100644 --- a/test/files/scalacheck/quasiquotes/UnliftableProps.scala +++ b/test/files/scalacheck/quasiquotes/UnliftableProps.scala @@ -155,4 +155,12 @@ object UnliftableProps extends QuasiquoteProperties("unliftable") { assert(t21 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)) assert(t22 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)) } + + property("unlift xml comment") = test { + implicit val unliftXmlComment = Unliftable[xml.Comment] { + case q"new _root_.scala.xml.Comment(${value: String})" => xml.Comment(value) + } + val q"${comment: xml.Comment}" = q"<!--foo-->" + assert(comment.commentText == "foo") + } } |