File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -132,15 +132,11 @@ object ExplicitOuter {
132
132
import ast .tpd ._
133
133
134
134
/** Ensure that class `cls` has outer accessors */
135
- def ensureOuterAccessors (cls : ClassSymbol )(implicit ctx : Context ): Unit = {
136
- // todo: implementing #165 would simplify this logic
137
- val prevPhase = ctx.phase.prev
138
- assert(prevPhase.id <= ctx.explicitOuterPhase.id, " can add $outer symbols only before ExplicitOuter" )
139
- assert(prevPhase.isInstanceOf [DenotTransformer ], " adding outerAccessors requires being DenotTransformer" )
140
- if (! hasOuter(cls)) {
141
- newOuterAccessors(cls).foreach(_.enteredAfter(prevPhase.asInstanceOf [DenotTransformer ]))
135
+ def ensureOuterAccessors (cls : ClassSymbol )(implicit ctx : Context ): Unit =
136
+ ctx.atPhase(ctx.explicitOuterPhase.next) { implicit ctx =>
137
+ if (! hasOuter(cls))
138
+ newOuterAccessors(cls).foreach(_.enteredAfter(ctx.explicitOuterPhase.asInstanceOf [DenotTransformer ]))
142
139
}
143
- }
144
140
145
141
/** The outer accessor and potentially outer param accessor needed for class `cls` */
146
142
private def newOuterAccessors (cls : ClassSymbol )(implicit ctx : Context ) =
Original file line number Diff line number Diff line change @@ -768,7 +768,7 @@ object PatternMatcher {
768
768
def outerTest : Tree = trans.transformFollowingDeep {
769
769
val expectedOuter = singleton(expectedTp.normalizedPrefix)
770
770
val expectedClass = expectedTp.dealias.classSymbol.asClass
771
- ExplicitOuter .ensureOuterAccessors(expectedClass)(ctx.withPhase(ctx.explicitOuterPhase.next))
771
+ ExplicitOuter .ensureOuterAccessors(expectedClass)
772
772
scrutinee.ensureConforms(expectedTp)
773
773
.outerSelect(1 , expectedOuter.tpe.widen)
774
774
.select(defn.Object_eq )
You can’t perform that action at this time.
0 commit comments