Skip to content

Commit 0f33d4d

Browse files
committed
Don't cache given aliases to this
A given alias given Foo = this does not need to be cached in a lazy val since `this` is an immutable reference.
1 parent 4b81eda commit 0f33d4d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class CacheAliasImplicits extends MiniPhase with IdentityDenotTransformer { this
5656
if rhsTpe.isStable => false
5757
case rhsTpe @ TermRef(pre: ThisType, _)
5858
if rhsTpe.isStable && pre.cls == sym.owner.enclosingClass => false
59+
case rhsTpe: ThisType => false
5960
case _ => true
6061
}
6162
case _ => false

0 commit comments

Comments
 (0)