Skip to content

Commit 1df91db

Browse files
committed
Fix tree traversal in ElimByName
ElimByName prevented some trees to be traversed by the following phases in the group.
1 parent 8cd223b commit 1df91db

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/transform/CollectNullableFields.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ class CollectNullableFields extends MiniPhase {
4545

4646
override def phaseName = CollectNullableFields.name
4747

48-
/** CollectNullableFields records usages of by names */
49-
5048
/** Running after `ElimByName` to see by names as nullable types.
5149
*
5250
* We don't necessary need to run after `Getters`, but the implementation

compiler/src/dotty/tools/dotc/transform/ElimByName.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ class ElimByName extends TransformByNameApply with InfoTransformer {
4949

5050
/** Map `tree` to `tree.apply()` is `ftree` was of ExprType and becomes now a function */
5151
private def applyIfFunction(tree: Tree, ftree: Tree)(implicit ctx: Context) =
52-
if (isByNameRef(ftree))
53-
ctx.atPhase(next) { implicit ctx => tree.select(defn.Function0_apply).appliedToNone }
52+
if (isByNameRef(ftree)) {
53+
val tree0 = transformFollowing(tree)
54+
ctx.atPhase(next) { implicit ctx => tree0.select(defn.Function0_apply).appliedToNone }
55+
}
5456
else tree
5557

5658
override def transformIdent(tree: Ident)(implicit ctx: Context): Tree =

0 commit comments

Comments
 (0)