Skip to content

Commit 6cd8e2b

Browse files
committed
Minor improvements
1 parent 93da8c2 commit 6cd8e2b

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,10 @@ class ReifyQuotes extends MacroTransformWithImplicits {
173173
// Maps type splices to type references of tags e.g., ~t -> some type T$1
174174
val map: Map[Type, Type] = tagsExplicitTypeDefsPairs.map(x => (x._1, x._2.symbol.typeRef)).toMap
175175
val tMap = new TypeMap() {
176-
override def apply(tp: Type): Type = {
177-
if (map.contains(tp))
178-
map.apply(tp)
179-
else
180-
mapOver(tp)
181-
}
176+
override def apply(tp: Type): Type = map.getOrElse(tp, mapOver(tp))
182177
}
183178

184-
Block(typeDefs ++ tagsExplicitTypeDefsPairs.map(_._2),
179+
Block(typeDefs ++ explicitTypeDefs,
185180
new TreeTypeMap(
186181
typeMap = tMap,
187182
substFrom = itags.map(_._1.symbol),
@@ -462,8 +457,6 @@ class ReifyQuotes extends MacroTransformWithImplicits {
462457
case tree: TypeTree if tree.tpe.typeSymbol.isSplice =>
463458
val splicedType = tree.tpe.asInstanceOf[TypeRef].prefix.termSymbol
464459
splice(ref(splicedType).select(tpnme.UNARY_~))
465-
case tree: TypeApply =>
466-
super.transform(tree)
467460
case tree: Select if tree.symbol.isSplice =>
468461
splice(tree)
469462
case tree: RefTree if needsLifting(tree) =>

tests/run-with-compiler/quote-lib.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,9 @@ package liftable {
117117
}
118118

119119
object Arrays {
120-
// FIXME missing hole for ~t
121-
// implicit def ArrayIsLiftable[T: Liftable](implicit t: Type[T], ct: Expr[ClassTag[T]]): Liftable[Array[T]] = (arr: Array[T]) => '{
122-
// new Array[~t](~(arr.length: Expr[Int]))(~ct)
123-
// }
124-
120+
implicit def ArrayIsLiftable[T: Liftable](implicit t: Type[T], ct: Expr[ClassTag[T]]): Liftable[Array[T]] = (arr: Array[T]) => '{
121+
new Array[~t](~(arr.length: Expr[Int]))(~ct)
122+
}
125123
}
126124

127125
}

0 commit comments

Comments
 (0)