@@ -54,30 +54,14 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
5454 * - If inside of a macro definition, check the validity of the macro.
5555 */
5656 protected def transformSplice (body : Tree , splice : Tree )(implicit ctx : Context ): Tree = {
57- if (level >= 1 ) {
58- val body1 = transform(body)(spliceContext)
59- splice match {
60- case Apply (fun : TypeApply , _) if splice.isTerm =>
61- // Type of the splice itsel must also be healed
62- // internal.Quoted.expr[F[T]](... T ...) --> internal.Quoted.expr[F[$t]](... T ...)
63- val tp = checkType(splice.sourcePos).apply(splice.tpe.widenTermRefExpr)
64- cpy.Apply (splice)(cpy.TypeApply (fun)(fun.fun, tpd.TypeTree (tp) :: Nil ), body1 :: Nil )
65- case splice : Select => cpy.Select (splice)(body1, splice.name)
66- }
67- }
68- else {
69- assert(enclosingInlineds.isEmpty, " unexpanded macro" )
70- assert(ctx.owner.isInlineMethod)
71- if (Splicer .canBeSpliced(body)) { // level 0 inside an inline definition
72- transform(body)(spliceContext) // Just check PCP
73- splice
74- }
75- else { // level 0 inside an inline definition
76- ctx.error(
77- " Malformed macro call. The contents of the splice ${...} must call a static method and arguments must be quoted or inline." ,
78- splice.sourcePos)
79- splice
80- }
57+ val body1 = transform(body)(spliceContext)
58+ splice match {
59+ case Apply (fun : TypeApply , _) if splice.isTerm =>
60+ // Type of the splice itsel must also be healed
61+ // internal.Quoted.expr[F[T]](... T ...) --> internal.Quoted.expr[F[$t]](... T ...)
62+ val tp = checkType(splice.sourcePos).apply(splice.tpe.widenTermRefExpr)
63+ cpy.Apply (splice)(cpy.TypeApply (fun)(fun.fun, tpd.TypeTree (tp) :: Nil ), body1 :: Nil )
64+ case splice : Select => cpy.Select (splice)(body1, splice.name)
8165 }
8266 }
8367
0 commit comments