@@ -78,7 +78,9 @@ trait QuotesAndSplices {
7878 if (ctx.mode.is(Mode .QuotedPattern )) spliceOwner(ctx.outer) else ctx.owner
7979 val pat = typedPattern(tree.expr, defn.QuotedExprClass .typeRef.appliedTo(pt))(
8080 spliceContext.retractMode(Mode .QuotedPattern ).withOwner(spliceOwner(ctx)))
81- Splice (pat)
81+ val baseType = pat.tpe.baseType(defn.QuotedExprClass )
82+ val argType = if baseType != NoType then baseType.argTypesHi.head else defn.NothingType
83+ ref(defn.InternalQuoted_exprSplice ).appliedToTypes(List (argType, defn.QuoteContextClass .typeRef)).appliedTo(pat)
8284 }
8385 else {
8486 ctx.error(i " Type must be fully defined. \n Consider annotating the splice using a type ascription: \n ( $tree: XYZ). " , tree.expr.sourcePos)
@@ -205,11 +207,15 @@ trait QuotesAndSplices {
205207 val freshTypeBindingsBuff = new mutable.ListBuffer [Tree ]
206208 val typePatBuf = new mutable.ListBuffer [Tree ]
207209 override def transform (tree : Tree )(implicit ctx : Context ) = tree match {
208- case Typed (Splice ( pat), tpt) if ! tpt.tpe.derivesFrom(defn.RepeatedParamClass ) =>
210+ case Typed (Apply (fn, pat :: Nil ), tpt) if fn.symbol == defn. InternalQuoted_exprSplice && ! tpt.tpe.derivesFrom(defn.RepeatedParamClass ) =>
209211 val tpt1 = transform(tpt) // Transform type bindings
210212 val exprTpt = AppliedTypeTree (TypeTree (defn.QuotedExprClass .typeRef), tpt1 :: Nil )
211- transform(Splice (Typed (pat, exprTpt)))
212- case Splice (pat) =>
213+ val newSplice =
214+ ref(defn.InternalQuoted_exprSplice )
215+ .appliedToTypes(List (tpt1.tpe, defn.QuoteContextClass .typeRef))
216+ .appliedTo(Typed (pat, exprTpt))
217+ transform(newSplice)
218+ case Apply (fn, pat :: Nil ) if fn.symbol == defn.InternalQuoted_exprSplice =>
213219 try ref(defn.InternalQuoted_patternHole .termRef).appliedToType(tree.tpe).withSpan(tree.span)
214220 finally {
215221 val patType = pat.tpe.widen
0 commit comments