@@ -16,6 +16,7 @@ import dotty.tools.dotc.core.tasty.{ PositionPickler, TastyPickler, TastyPrinter
16
16
import dotty .tools .dotc .core .tasty .TreeUnpickler .UnpickleMode
17
17
import dotty .tools .dotc .quoted .QuoteContext
18
18
import dotty .tools .dotc .tastyreflect .{ReflectionImpl , TastyTreeExpr , TreeType }
19
+ import dotty .tools .dotc .util .Spans .NoSpan
19
20
20
21
import dotty .tools .tasty .TastyString
21
22
@@ -112,38 +113,28 @@ object PickledQuotes {
112
113
// typeSpliceMap = splicedTypes.toMap
113
114
// transform(expr1)
114
115
case Hole (isType, idx, args) =>
116
+ assert(! isType)
115
117
val splice = splices(idx)
116
118
def wrap (arg : Tree ) =
117
119
if (arg.isTerm) (qctx : scala.quoted.QuoteContext ) ?=> new TastyTreeExpr (arg, QuoteContext .scopeId)
118
120
else new TreeType (arg, QuoteContext .scopeId)
119
121
val reifiedArgs = args.map(wrap)
120
- val filled = if (isType) {
121
- ???
122
- val quotedType = splice.asInstanceOf [Seq [Any ] => quoted.Type [? ]](reifiedArgs)
123
- PickledQuotes .quotedTypeToTree(quotedType)
124
- }
125
- else {
126
- val splice1 = splice.asInstanceOf [Seq [Any ] => scala.quoted.QuoteContext ?=> quoted.Expr [? ]]
127
- val quotedExpr = splice1(reifiedArgs)(using dotty.tools.dotc.quoted.QuoteContext ())
128
- PickledQuotes .quotedExprToTree(quotedExpr)
129
- }
122
+
123
+ val splice1 = splice.asInstanceOf [Seq [Any ] => scala.quoted.QuoteContext ?=> quoted.Expr [? ]]
124
+ val quotedExpr = splice1(reifiedArgs)(using dotty.tools.dotc.quoted.QuoteContext ())
125
+ val filled = PickledQuotes .quotedExprToTree(quotedExpr)
126
+
130
127
// We need to make sure a hole is created with the source file of the surrounding context, even if
131
- // it filled with contents a different source file. Otherwise nodes contqaining holes might end
132
- // up without a position. PositionPickler makes sure that holes always get spans assigned,
133
- // so we can just return the filler tree with the new source and no span here.
128
+ // it filled with contents a different source file.
134
129
if (filled.source == ctx.source) filled
135
- else {
136
- val filled1 = filled.cloneIn(ctx.source)
137
- // filled1.span = NoSpan
138
- filled1
139
- }
130
+ else filled.cloneIn(ctx.source)
140
131
141
132
// super.transform(tree).withType(dealiasTypeTags(tree.tpe))
142
133
case tree =>
143
134
super .transform(tree).withType(spliceTypes(tree.tpe))
144
135
}
145
136
}
146
- val evaluatedExpansion = evaluateHoles.transform(expnasion1)
137
+ val evaluatedExpansion = evaluateHoles.transform(expnasion1)(inlineContext(call))
147
138
cpy.Inlined (unpickled)(call, Nil , evaluatedExpansion)
148
139
else
149
140
val forceAndCleanArtefacts = new TreeMap {
0 commit comments