Skip to content

Commit 8c3f80a

Browse files
committed
Update doc comments
1 parent 47a720f commit 8c3f80a

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

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

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,20 @@ object CacheAliasImplicits {
1818

1919
/** Flags that disable caching */
2020
val NoCacheFlags =
21-
StableRealizable | // It's a simple forwarder, leave it as one
22-
Exported // Export forwarders are never cached
21+
StableRealizable // It's a simple forwarder, leave it as one
22+
| Exported // Export forwarders are never cached
2323
}
2424

2525
/** This phase ensures that the right hand side of parameterless alias implicits
26-
* is cached. It applies to all alias implicits that have neither type parameters
27-
* nor a given clause. Example: The alias
26+
* is cached if necessary. Dually, it optimizes lazy vak alias implicit to be uncached
27+
* if that does not change runtime behavior.
2828
*
29-
* TC = rhs
29+
* A definition does not need to be cached if its right hand side has a stable type
30+
* and is of one of them forms
3031
*
31-
* is expanded before this phase to:
32-
*
33-
* implicit def a: TC = rhs
34-
*
35-
* It is then expanded further as follows:
36-
*
37-
* 1. If `rhs` is a simple name `x` (possibly with a `this.` prefix) that
38-
* refers to a value, leave it as is.
39-
*
40-
* 2. Otherwise, replace the definition with
41-
*
42-
* lazy implicit val a: TC = rhs
32+
* this
33+
* this.y
34+
* y
4335
*/
4436
class CacheAliasImplicits extends MiniPhase with IdentityDenotTransformer { thisPhase =>
4537
import tpd._

0 commit comments

Comments
 (0)