Skip to content

Commit e71f237

Browse files
committed
Don't cache inline givens
It's not necessary anyway, and changes the meaning of `inline`.
1 parent 26f02e7 commit e71f237

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,18 @@ class CacheAliasImplicits extends MiniPhase with IdentityDenotTransformer { this
5050
override def transformDefDef(tree: DefDef)(implicit ctx: Context): Tree = {
5151
val sym = tree.symbol
5252
val rhsType = tree.rhs.tpe
53-
val isCached = sym.info match {
54-
case _: ExprType if sym.is(Given, butNot = CacheAliasImplicits.NoCacheFlags) =>
55-
rhsType match {
56-
case TermRef(NoPrefix, _)
57-
if rhsType.isStable => false
58-
case TermRef(pre: ThisType, _)
59-
if rhsType.isStable && pre.cls == sym.owner.enclosingClass => false
60-
case _ => true
61-
}
62-
case _ => false
53+
val isCached = !sym.is(Inline) && {
54+
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
61+
case _ => true
62+
}
63+
case _ => false
64+
}
6365
}
6466
if (isCached) {
6567
sym.copySymDenotation(

0 commit comments

Comments
 (0)