File tree 2 files changed +7
-13
lines changed
compiler/src/dotty/tools/dotc 2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -1224,17 +1224,6 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
1224
1224
}
1225
1225
}
1226
1226
1227
- /** An extractor for typed splices */
1228
- object Splice {
1229
- def apply (tree : Tree )(implicit ctx : Context ): Tree = {
1230
- val baseType = tree.tpe.baseType(defn.QuotedExprClass ).orElse(tree.tpe.baseType(defn.QuotedTypeClass ))
1231
- val argType =
1232
- if (baseType != NoType ) baseType.argTypesHi.head
1233
- else defn.NothingType
1234
- ref(defn.InternalQuoted_exprSplice ).appliedToTypes(List (argType, defn.QuoteContextClass .typeRef)).appliedTo(tree)
1235
- }
1236
- }
1237
-
1238
1227
/** A key to be used in a context property that tracks enclosing inlined calls */
1239
1228
private val InlinedCalls = Property .Key [List [Tree ]]()
1240
1229
Original file line number Diff line number Diff line change @@ -74,7 +74,8 @@ trait QuotesAndSplices {
74
74
if (ctx.mode.is(Mode .QuotedPattern )) spliceOwner(ctx.outer) else ctx.owner
75
75
val pat = typedPattern(tree.expr, defn.QuotedExprClass .typeRef.appliedTo(pt))(
76
76
spliceContext.retractMode(Mode .QuotedPattern ).withOwner(spliceOwner(ctx)))
77
- Splice (pat)
77
+ val argType = pat.tpe.baseType(defn.QuotedExprClass ).argTypesHi.head
78
+ ref(defn.InternalQuoted_exprSplice ).appliedToTypes(List (argType, defn.QuoteContextClass .typeRef)).appliedTo(pat)
78
79
}
79
80
else {
80
81
ctx.error(i " Type must be fully defined. \n Consider annotating the splice using a type ascription: \n ( $tree: XYZ). " , tree.expr.sourcePos)
@@ -204,7 +205,11 @@ trait QuotesAndSplices {
204
205
case Typed (Apply (fn, pat :: Nil ), tpt) if fn.symbol == defn.InternalQuoted_exprSplice && ! tpt.tpe.derivesFrom(defn.RepeatedParamClass ) =>
205
206
val tpt1 = transform(tpt) // Transform type bindings
206
207
val exprTpt = AppliedTypeTree (TypeTree (defn.QuotedExprClass .typeRef), tpt1 :: Nil )
207
- transform(Splice (Typed (pat, exprTpt)))
208
+ val newSplice =
209
+ ref(defn.InternalQuoted_exprSplice )
210
+ .appliedToTypes(List (tpt1.tpe, defn.QuoteContextClass .typeRef))
211
+ .appliedTo(Typed (pat, exprTpt))
212
+ transform(newSplice)
208
213
case Apply (fn, pat :: Nil ) if fn.symbol == defn.InternalQuoted_exprSplice =>
209
214
try ref(defn.InternalQuoted_patternHole .termRef).appliedToType(tree.tpe).withSpan(tree.span)
210
215
finally {
You can’t perform that action at this time.
0 commit comments