File tree Expand file tree Collapse file tree 1 file changed +9
-17
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -18,28 +18,20 @@ object CacheAliasImplicits {
18
18
19
19
/** Flags that disable caching */
20
20
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
23
23
}
24
24
25
25
/** 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.
28
28
*
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
30
31
*
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
43
35
*/
44
36
class CacheAliasImplicits extends MiniPhase with IdentityDenotTransformer { thisPhase =>
45
37
import tpd ._
You can’t perform that action at this time.
0 commit comments