Skip to content

Commit 7294180

Browse files
Merge pull request #2207 from dotty-staging/fix-#2188
Fix #2188: Do cbn transform also on Selects
2 parents 8d22a17 + 6e8ca80 commit 7294180

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ class ElimByName extends MiniPhaseTransform with InfoTransformer { thisTransform
112112
override def transformIdent(tree: Ident)(implicit ctx: Context, info: TransformerInfo): Tree =
113113
applyIfFunction(tree, tree)
114114

115+
override def transformSelect(tree: Select)(implicit ctx: Context, info: TransformerInfo): Tree =
116+
applyIfFunction(tree, tree)
117+
115118
override def transformTypeApply(tree: TypeApply)(implicit ctx: Context, info: TransformerInfo): Tree = tree match {
116119
case TypeApply(Select(_, nme.asInstanceOf_), arg :: Nil) =>
117120
// tree might be of form e.asInstanceOf[x.type] where x becomes a function.

tests/pos/i2188.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Fill(elem: => Int) {
2+
class Iter {
3+
def next(): Int = elem
4+
}
5+
}

0 commit comments

Comments
 (0)