Skip to content

Commit 7d12c39

Browse files
authored
Merge pull request #3229 from dotty-staging/try-optimize-4
Micro-optimization: Make denotAt inlineable
2 parents 3a8ec6d + 8d07272 commit 7d12c39

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,17 +1566,17 @@ object Types {
15661566
/** The denotation currently denoted by this type */
15671567
final def denot(implicit ctx: Context): Denotation = {
15681568
val now = ctx.period
1569-
if (checkedPeriod == now) lastDenotation else denotAt(now)
1569+
val lastd = lastDenotation
1570+
if (checkedPeriod == now) lastd else denotAt(lastd, now)
15701571
}
15711572

15721573
/** A first fall back to do a somewhat more expensive calculation in case the first
15731574
* attempt in `denot` does not yield a denotation.
15741575
*/
1575-
private def denotAt(now: Period)(implicit ctx: Context): Denotation = {
1576-
val d = lastDenotation
1577-
if (d != null && (d.validFor contains now)) {
1576+
private def denotAt(lastd: Denotation, now: Period)(implicit ctx: Context): Denotation = {
1577+
if (lastd != null && (lastd.validFor contains now)) {
15781578
checkedPeriod = now
1579-
d
1579+
lastd
15801580
}
15811581
else computeDenot
15821582
}

0 commit comments

Comments
 (0)