File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -152,10 +152,15 @@ object Inliner {
152152
153153 /** Replace `Inlined` node by a block that contains its bindings and expansion */
154154 def dropInlined (inlined : Inlined )(implicit ctx : Context ): Tree =
155- if (enclosingInlineds.nonEmpty) inlined // Remove in the outer most inlined call
156- else reposition(inlined, inlined.call.span)
155+ val tree1 =
156+ if inlined.bindings.isEmpty then inlined.expansion
157+ else cpy.Block (inlined)(inlined.bindings, inlined.expansion)
158+ // Reposition in the outer most inlined call
159+ if (enclosingInlineds.nonEmpty) tree1 else reposition(tree1, inlined.span)
157160
158161 def reposition (tree : Tree , callSpan : Span )(implicit ctx : Context ): Tree = {
162+ // Reference test tests/run/i4947b
163+
159164 val curSource = ctx.compilationUnit.source
160165
161166 // Tree copier that changes the source of all trees to `curSource`
@@ -183,9 +188,6 @@ object Inliner {
183188 given as Context = ctx.withSource(curSource)
184189
185190 tree match {
186- case tree : Inlined =>
187- if tree.bindings.isEmpty then transform(tree.expansion)
188- else transform(cpy.Block (tree)(tree.bindings, tree.expansion))
189191 case tree : Ident => finalize(untpd.Ident (tree.name)(curSource))
190192 case tree : Literal => finalize(untpd.Literal (tree.const)(curSource))
191193 case tree : This => finalize(untpd.This (tree.qual)(curSource))
You can’t perform that action at this time.
0 commit comments