File tree Expand file tree Collapse file tree 4 files changed +13
-14
lines changed
test/dotty/tools/backend/jvm Expand file tree Collapse file tree 4 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -847,17 +847,18 @@ object Erasure {
847
847
override def typedTry (tree : untpd.Try , pt : Type )(using Context ): Try =
848
848
super .typedTry(tree, adaptProto(tree, pt))
849
849
850
+ override def typedBlock (tree : untpd.Block , pt : Type )(using Context ): Tree =
851
+ super .typedBlock(tree, pt) match
852
+ // Drop empty block after it has been repositioned (see Inliner.reposition)
853
+ case Block (Nil , expr) => expr
854
+ case block => block
855
+
850
856
private def adaptProto (tree : untpd.Tree , pt : Type )(using Context ) =
851
857
if (pt.isValueType) pt else
852
858
if (tree.typeOpt.derivesFrom(ctx.definitions.UnitClass ))
853
859
tree.typeOpt
854
860
else valueErasure(tree.typeOpt)
855
861
856
- override def typedInlined (tree : untpd.Inlined , pt : Type )(using Context ): Tree =
857
- super .typedInlined(tree, pt) match {
858
- case tree : Inlined => Inliner .dropInlined(tree)
859
- }
860
-
861
862
override def typedValDef (vdef : untpd.ValDef , sym : Symbol )(using Context ): Tree =
862
863
if (sym.isEffectivelyErased) erasedDef(sym)
863
864
else
Original file line number Diff line number Diff line change @@ -214,6 +214,9 @@ class FirstTransform extends MiniPhase with InfoTransformer { thisPhase =>
214
214
case _ => tree
215
215
}
216
216
217
+ override def transformInlined (tree : Inlined )(using Context ): Tree =
218
+ cpy.Block (tree)(tree.bindings, tree.expansion)
219
+
217
220
// invariants: all modules have companion objects
218
221
// all types are TypeTrees
219
222
// all this types are explicit
Original file line number Diff line number Diff line change @@ -205,11 +205,6 @@ object Inliner {
205
205
using ctx.withOwner(retainer)))
206
206
.reporting(i " retainer for $meth: $result" , inlining)
207
207
208
- /** Replace `Inlined` node by a block that contains its bindings and expansion */
209
- def dropInlined (inlined : Inlined )(using Context ): Tree =
210
- if inlined.bindings.isEmpty then inlined.expansion
211
- else cpy.Block (inlined)(inlined.bindings, inlined.expansion)
212
-
213
208
def reposition (tree : Tree , callSpan : Span )(using Context ): Tree = {
214
209
// Reference test tests/run/i4947b
215
210
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ class InlineBytecodeTests extends DottyBytecodeTest {
134
134
val expected =
135
135
List (
136
136
Label (0 ),
137
- LineNumber (6 , Label (0 )),
137
+ LineNumber (2 , Label (0 )), // TODO this lable seems to not be used
138
138
LineNumber (3 , Label (0 )),
139
139
VarOp (ALOAD , 0 ),
140
140
Ldc (LDC , " tracking" ),
@@ -199,7 +199,7 @@ class InlineBytecodeTests extends DottyBytecodeTest {
199
199
val expected =
200
200
List (
201
201
Label (0 ),
202
- LineNumber (12 , Label (0 )),
202
+ LineNumber (6 , Label (0 )), // TODO this lable seems to not be used
203
203
LineNumber (7 , Label (0 )),
204
204
VarOp (ALOAD , 0 ),
205
205
Ldc (LDC , " tracking" ),
@@ -259,7 +259,7 @@ class InlineBytecodeTests extends DottyBytecodeTest {
259
259
val expected =
260
260
List (
261
261
Label (0 ),
262
- LineNumber (12 , Label (0 )),
262
+ LineNumber (2 , Label (0 )), // TODO this lable seems to not be used
263
263
LineNumber (3 , Label (0 )),
264
264
VarOp (ALOAD , 0 ),
265
265
Ldc (LDC , " tracking2" ),
@@ -320,7 +320,7 @@ class InlineBytecodeTests extends DottyBytecodeTest {
320
320
val expected =
321
321
List (
322
322
Label (0 ),
323
- LineNumber (13 , Label (0 )),
323
+ LineNumber (2 , Label (0 )), // TODO this lable seems to not be used
324
324
LineNumber (3 , Label (0 )),
325
325
VarOp (ALOAD , 0 ),
326
326
Ldc (LDC , " tracking2" ),
You can’t perform that action at this time.
0 commit comments