File tree Expand file tree Collapse file tree 4 files changed +13
-19
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 4 files changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -1020,12 +1020,6 @@ object Denotations {
1020
1020
interval
1021
1021
}
1022
1022
1023
- /** For ClassDenotations only:
1024
- * If caches influenced by parent classes are still valid, the denotation
1025
- * itself, otherwise a freshly initialized copy.
1026
- */
1027
- def syncWithParents (implicit ctx : Context ): SingleDenotation = this
1028
-
1029
1023
/** Show declaration string; useful for showing declarations
1030
1024
* as seen from subclasses.
1031
1025
*/
Original file line number Diff line number Diff line change @@ -1648,6 +1648,8 @@ object Types {
1648
1648
}
1649
1649
1650
1650
final def symbol (implicit ctx : Context ): Symbol =
1651
+ // We can rely on checkedPeriod (unlike in the definition of `denot` below)
1652
+ // because SymDenotation#installAfter never changes the symbol
1651
1653
if (checkedPeriod == ctx.period) lastSymbol else computeSymbol
1652
1654
1653
1655
private def computeSymbol (implicit ctx : Context ): Symbol =
@@ -1692,17 +1694,11 @@ object Types {
1692
1694
/** The denotation currently denoted by this type */
1693
1695
final def denot (implicit ctx : Context ): Denotation = {
1694
1696
val now = ctx.period
1695
- val lastd = lastDenotation
1696
- if (checkedPeriod == now) lastd else denotAt(lastd, now)
1697
- }
1698
-
1699
- /** A first fall back to do a somewhat more expensive calculation in case the first
1700
- * attempt in `denot` does not yield a denotation.
1701
- */
1702
- private def denotAt (lastd : Denotation , now : Period )(implicit ctx : Context ): Denotation = {
1703
- if (checkedPeriod != Nowhere && lastd.validFor.contains(now)) {
1697
+ // Even if checkedPeriod == now we still need to recheck lastDenotation.validFor
1698
+ // as it may have been mutated by SymDenotation#installAfter
1699
+ if (checkedPeriod != Nowhere && lastDenotation.validFor.contains(now)) {
1704
1700
checkedPeriod = now
1705
- lastd
1701
+ lastDenotation
1706
1702
}
1707
1703
else computeDenot
1708
1704
}
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ class ExtensionMethods extends MiniPhase with DenotTransformer with FullParamete
108
108
moduleClassSym
109
109
}
110
110
case ref : SymDenotation =>
111
- if (isMethodWithExtension(ref) && ref.hasAnnotation(defn.TailrecAnnot )) {
111
+ if (isMethodWithExtension(ref.symbol ) && ref.hasAnnotation(defn.TailrecAnnot )) {
112
112
val ref1 = ref.copySymDenotation()
113
113
ref1.removeAnnotation(defn.TailrecAnnot )
114
114
ref1
Original file line number Diff line number Diff line change @@ -21,12 +21,16 @@ object ValueClasses {
21
21
! d.isPrimitiveValueClass
22
22
}
23
23
24
- def isMethodWithExtension (d : SymDenotation )(implicit ctx : Context ) =
25
- d.isRealMethod &&
24
+ def isMethodWithExtension (sym : Symbol )(implicit ctx : Context ) =
25
+ ctx.atPhaseNotLaterThan(ctx.extensionMethodsPhase) { implicit ctx =>
26
+ val d = sym.denot
27
+ d.validFor.containsPhaseId(ctx.phaseId) &&
28
+ d.isRealMethod &&
26
29
isDerivedValueClass(d.owner) &&
27
30
! d.isConstructor &&
28
31
! d.isSuperAccessor &&
29
32
! d.is(Macro )
33
+ }
30
34
31
35
/** The member of a derived value class that unboxes it. */
32
36
def valueClassUnbox (d : ClassDenotation )(implicit ctx : Context ): Symbol =
You can’t perform that action at this time.
0 commit comments