Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,12 @@ class ReifyQuotes extends MacroTransform {
val meth =
if (isType) ref(defn.Unpickler_unpickleType).appliedToType(originalTp)
else ref(defn.Unpickler_unpickleExpr).appliedToType(originalTp.widen)
val spliceResType =
if(isType) defn.QuotedTypeType.appliedTo(WildcardType)
else defn.QuotedExprType.appliedTo(defn.AnyType) | defn.QuotedTypeType.appliedTo(WildcardType)
meth.appliedTo(
liftList(PickledQuotes.pickleQuote(body).map(x => Literal(Constant(x))), defn.StringType),
liftList(splices, defn.AnyType))
liftList(splices, defn.FunctionType(1).appliedTo(defn.SeqType.appliedTo(defn.AnyType), spliceResType)))
}
if (splices.nonEmpty) pickleAsTasty()
else if (isType) {
Expand Down
4 changes: 2 additions & 2 deletions library/src/scala/runtime/quoted/Unpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ object Unpickler {
/** Unpickle `repr` which represents a pickled `Expr` tree,
* replacing splice nodes with `args`
*/
def unpickleExpr[T](repr: Pickled, args: Seq[Any]): Expr[T] = new TastyExpr[T](repr, args)
def unpickleExpr[T](repr: Pickled, args: Seq[Seq[Any] => (Expr[Any] | Type[_])]): Expr[T] = new TastyExpr[T](repr, args)

/** Unpickle `repr` which represents a pickled `Type` tree,
* replacing splice nodes with `args`
*/
def unpickleType[T](repr: Pickled, args: Seq[Any]): Type[T] = new TastyType[T](repr, args)
def unpickleType[T](repr: Pickled, args: Seq[Seq[Any] => Type[_]]): Type[T] = new TastyType[T](repr, args)
}