@@ -15,6 +15,7 @@ import typer.Implicits.SearchFailureType
1515import  scala .collection .mutable 
1616import  dotty .tools .dotc .core .StdNames ._ 
1717import  dotty .tools .dotc .core .quoted ._ 
18+ import  dotty .tools .dotc .typer .Inliner 
1819import  dotty .tools .dotc .util .SourcePosition 
1920
2021
@@ -381,7 +382,12 @@ class Staging extends MacroTransformWithImplicits {
381382          capturers(body.symbol)(body)
382383        case  _=> 
383384          val  (body1, splices) =  nested(isQuote =  true ).split(body)
384-           if  (level ==  0  &&  ! ctx.inInlineMethod) pickledQuote(body1, splices, body.tpe, isType).withPos(quote.pos)
385+           if  (level ==  0  &&  ! ctx.inInlineMethod) {
386+             val  body2  = 
387+               if  (body1.isType) body1
388+               else  Inlined (Inliner .inlineCallTrace(ctx.owner, quote.pos), Nil , body1)
389+             pickledQuote(body2, splices, body.tpe, isType).withPos(quote.pos)
390+           }
385391          else  {
386392            //  In top-level splice in an inline def. Keep the tree as it is, it will be transformed at inline site.
387393            body
@@ -432,7 +438,11 @@ class Staging extends MacroTransformWithImplicits {
432438      else  if  (level ==  1 ) {
433439        val  (body1, quotes) =  nested(isQuote =  false ).split(splice.qualifier)
434440        val  tpe  =  outer.embedded.getHoleType(splice)
435-         makeHole(body1, quotes, tpe).withPos(splice.pos)
441+         val  hole  =  makeHole(body1, quotes, tpe).withPos(splice.pos)
442+         if  (splice.isType) hole else  {
443+           if  (splice.qualifier.symbol.is(Synthetic )) hole //  TODO check if it is a capture
444+           else  Inlined (EmptyTree , Nil , hole)
445+         }
436446      }
437447      else  if  (enclosingInlineds.nonEmpty) { //  level 0 in an inlined call
438448        val  spliceCtx  =  ctx.outer //  drop the last `inlineContext`
0 commit comments