@@ -673,6 +673,9 @@ object Trees {
673673 */
674674 case class Inlined [+ T <: Untyped ] private [ast] (call : tpd.Tree , bindings : List [MemberDef [T ]], expansion : Tree [T ])(implicit @ constructorOnly src : SourceFile )
675675 extends Tree [T ] {
676+
677+ def inlinedFromOuterScope : Boolean = call.isEmpty
678+
676679 type ThisTree [+ T <: Untyped ] = Inlined [T ]
677680 override def isTerm = expansion.isTerm
678681 override def isType = expansion.isType
@@ -1479,7 +1482,7 @@ object Trees {
14791482 * innermost enclosing call for which the inlined version is currently
14801483 * processed.
14811484 */
1482- protected def inlineContext (call : tpd. Tree )(using Context ): Context = ctx
1485+ protected def inlineContext (tree : Inlined )(using Context ): Context = ctx
14831486
14841487 /** The context to use when mapping or accumulating over a tree */
14851488 def localCtx (tree : Tree )(using Context ): Context
@@ -1549,8 +1552,8 @@ object Trees {
15491552 cpy.Try (tree)(transform(block), transformSub(cases), transform(finalizer))
15501553 case SeqLiteral (elems, elemtpt) =>
15511554 cpy.SeqLiteral (tree)(transform(elems), transform(elemtpt))
1552- case Inlined (call, bindings, expansion) =>
1553- cpy.Inlined (tree)(call, transformSub(bindings), transform(expansion)(using inlineContext(call )))
1555+ case tree @ Inlined (call, bindings, expansion) =>
1556+ cpy.Inlined (tree)(call, transformSub(bindings), transform(expansion)(using inlineContext(tree )))
15541557 case TypeTree () =>
15551558 tree
15561559 case SingletonTypeTree (ref) =>
@@ -1693,8 +1696,8 @@ object Trees {
16931696 this (this (this (x, block), handler), finalizer)
16941697 case SeqLiteral (elems, elemtpt) =>
16951698 this (this (x, elems), elemtpt)
1696- case Inlined (call, bindings, expansion) =>
1697- this (this (x, bindings), expansion)(using inlineContext(call ))
1699+ case tree @ Inlined (call, bindings, expansion) =>
1700+ this (this (x, bindings), expansion)(using inlineContext(tree ))
16981701 case TypeTree () =>
16991702 x
17001703 case SingletonTypeTree (ref) =>
0 commit comments