summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-04-02 18:36:15 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-04-02 18:36:15 +0200
commitceb99257ae98e5bc3603132445582517b3a425b7 (patch)
tree001dbbef364324b6e1ef67efbb9a0806226bbb09 /src
parent1b21784e74e963be553a68a8923db9c501bc5355 (diff)
parent9fbac09b6ec7fcb1b2df75fcbc04bc795eccd669 (diff)
downloadscala-ceb99257ae98e5bc3603132445582517b3a425b7.tar.gz
scala-ceb99257ae98e5bc3603132445582517b3a425b7.tar.bz2
scala-ceb99257ae98e5bc3603132445582517b3a425b7.zip
Merge pull request #3671 from densh/si/8466
SI-8466 fix quasiquote crash on recursively iterable unlifting
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/reflect/quasiquotes/Holes.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala b/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala
index 55a28f9f20..68cc728eb3 100644
--- a/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala
+++ b/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala
@@ -43,13 +43,13 @@ trait Holes { self: Quasiquotes =>
tpe <:< NothingClass.tpe || tpe <:< NullClass.tpe
private def extractIterableTParam(tpe: Type) =
IterableTParam.asSeenFrom(tpe, IterableClass)
- private def stripIterable(tpe: Type, limit: Option[Rank] = None): (Rank, Type) =
- if (limit.map { _ == NoDot }.getOrElse { false }) (NoDot, tpe)
+ private def stripIterable(tpe: Type, limit: Rank = DotDotDot): (Rank, Type) =
+ if (limit == NoDot) (NoDot, tpe)
else if (tpe != null && !isIterableType(tpe)) (NoDot, tpe)
else if (isBottomType(tpe)) (NoDot, tpe)
else {
val targ = extractIterableTParam(tpe)
- val (rank, innerTpe) = stripIterable(targ, limit.map { _.pred })
+ val (rank, innerTpe) = stripIterable(targ, limit.pred)
(rank.succ, innerTpe)
}
private def iterableTypeFromRank(n: Rank, tpe: Type): Type = {
@@ -76,7 +76,7 @@ trait Holes { self: Quasiquotes =>
class ApplyHole(annotatedRank: Rank, unquotee: Tree) extends Hole {
val (strippedTpe, tpe): (Type, Type) = {
- val (strippedRank, strippedTpe) = stripIterable(unquotee.tpe, limit = Some(annotatedRank))
+ val (strippedRank, strippedTpe) = stripIterable(unquotee.tpe, limit = annotatedRank)
if (isBottomType(strippedTpe)) cantSplice()
else if (isNativeType(strippedTpe)) {
if (strippedRank != NoDot && !(strippedTpe <:< treeType) && !isLiftableType(strippedTpe)) cantSplice()
@@ -193,7 +193,7 @@ trait Holes { self: Quasiquotes =>
val (iterableRank, _) = stripIterable(tpe)
if (iterableRank.value < rank.value)
c.abort(pat.pos, s"Can't extract $tpe with $rank, consider using $iterableRank")
- val (_, strippedTpe) = stripIterable(tpe, limit = Some(rank))
+ val (_, strippedTpe) = stripIterable(tpe, limit = rank)
if (strippedTpe <:< treeType) treeNoUnlift
else
unlifters.spawn(strippedTpe, rank).map {