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 {
10201020 interval
10211021 }
10221022
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-
10291023 /** Show declaration string; useful for showing declarations
10301024 * as seen from subclasses.
10311025 */
Original file line number Diff line number Diff line change @@ -1648,6 +1648,8 @@ object Types {
16481648 }
16491649
16501650 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
16511653 if (checkedPeriod == ctx.period) lastSymbol else computeSymbol
16521654
16531655 private def computeSymbol (implicit ctx : Context ): Symbol =
@@ -1692,17 +1694,11 @@ object Types {
16921694 /** The denotation currently denoted by this type */
16931695 final def denot (implicit ctx : Context ): Denotation = {
16941696 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)) {
17041700 checkedPeriod = now
1705- lastd
1701+ lastDenotation
17061702 }
17071703 else computeDenot
17081704 }
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ class ExtensionMethods extends MiniPhase with DenotTransformer with FullParamete
108108 moduleClassSym
109109 }
110110 case ref : SymDenotation =>
111- if (isMethodWithExtension(ref) && ref.hasAnnotation(defn.TailrecAnnot )) {
111+ if (isMethodWithExtension(ref.symbol ) && ref.hasAnnotation(defn.TailrecAnnot )) {
112112 val ref1 = ref.copySymDenotation()
113113 ref1.removeAnnotation(defn.TailrecAnnot )
114114 ref1
Original file line number Diff line number Diff line change @@ -21,12 +21,16 @@ object ValueClasses {
2121 ! d.isPrimitiveValueClass
2222 }
2323
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 &&
2629 isDerivedValueClass(d.owner) &&
2730 ! d.isConstructor &&
2831 ! d.isSuperAccessor &&
2932 ! d.is(Macro )
33+ }
3034
3135 /** The member of a derived value class that unboxes it. */
3236 def valueClassUnbox (d : ClassDenotation )(implicit ctx : Context ): Symbol =
You can’t perform that action at this time.
0 commit comments