Skip to content

Commit 48c9961

Browse files
committed
Minor improvements
1 parent f7b179c commit 48c9961

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
@@ -172,15 +172,10 @@ class ReifyQuotes extends MacroTransformWithImplicits {
172172
// Maps type splices to type references of tags e.g., ~t -> some type T$1
173173
val map: Map[Type, Type] = tagsExplicitTypeDefsPairs.map(x => (x._1, x._2.symbol.typeRef)).toMap
174174
val tMap = new TypeMap() {
175-
override def apply(tp: Type): Type = {
176-
if (map.contains(tp))
177-
map.apply(tp)
178-
else
179-
mapOver(tp)
180-
}
175+
override def apply(tp: Type): Type = map.getOrElse(tp, mapOver(tp))
181176
}
182177

183-
Block(typeDefs ++ tagsExplicitTypeDefsPairs.map(_._2),
178+
Block(typeDefs ++ explicitTypeDefs,
184179
new TreeTypeMap(
185180
typeMap = tMap,
186181
substFrom = itags.map(_._1.symbol),
@@ -463,8 +458,6 @@ class ReifyQuotes extends MacroTransformWithImplicits {
463458
case tree: TypeTree if tree.tpe.typeSymbol.isSplice =>
464459
val splicedType = tree.tpe.asInstanceOf[TypeRef].prefix.termSymbol
465460
splice(ref(splicedType).select(tpnme.UNARY_~))
466-
case tree: TypeApply =>
467-
super.transform(tree)
468461
case tree: Select if tree.symbol.isSplice =>
469462
splice(tree)
470463
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
@@ -118,11 +118,9 @@ package liftable {
118118
}
119119

120120
object Arrays {
121-
// FIXME missing hole for ~t
122-
// implicit def ArrayIsLiftable[T: Liftable](implicit t: Type[T], ct: Expr[ClassTag[T]]): Liftable[Array[T]] = (arr: Array[T]) => '{
123-
// new Array[~t](~(arr.length: Expr[Int]))(~ct)
124-
// }
125-
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+
}
126124
}
127125

128126
}

0 commit comments

Comments
 (0)