File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -49,15 +49,14 @@ class CacheAliasImplicits extends MiniPhase with IdentityDenotTransformer { this
4949
5050 override def transformDefDef (tree : DefDef )(implicit ctx : Context ): Tree = {
5151 val sym = tree.symbol
52- val rhsType = tree.rhs.tpe
53- val isCached = ! sym.is(Inline ) && {
52+ val isCached = sym.is(Inline ) && {
5453 sym.info match {
55- case _ : ExprType if sym.is(Given , butNot = CacheAliasImplicits .NoCacheFlags ) =>
56- rhsType match {
57- case TermRef (NoPrefix , _)
58- if rhsType .isStable => false
59- case TermRef (pre : ThisType , _)
60- if rhsType .isStable && pre.cls == sym.owner.enclosingClass => false
54+ case ExprType (resTpe) if sym.is(Given , butNot = CacheAliasImplicits .NoCacheFlags ) =>
55+ tree.rhs.tpe match {
56+ case rhsTpe @ TermRef (NoPrefix , _)
57+ if rhsTpe .isStable => false
58+ case rhsTpe @ TermRef (pre : ThisType , _)
59+ if rhsTpe .isStable && pre.cls == sym.owner.enclosingClass => false
6160 case _ => true
6261 }
6362 case _ => false
@@ -66,7 +65,7 @@ class CacheAliasImplicits extends MiniPhase with IdentityDenotTransformer { this
6665 if (isCached) {
6766 sym.copySymDenotation(
6867 initFlags = sym.flags &~ Method | Lazy ,
69- info = rhsType )
68+ info = sym.info.widenExpr )
7069 .installAfter(thisPhase)
7170 cpy.ValDef (tree)(tree.name, tree.tpt, tree.rhs)
7271 }
You can’t perform that action at this time.
0 commit comments