@@ -779,8 +779,8 @@ object Semantic:
779779 if tryReporter.errors.nonEmpty && isSyntheticApply(meth) then
780780 tryReporter.abort()
781781 val klass = meth.owner.companionClass.asClass
782- val outerCls = klass.owner.lexicallyEnclosingClass.asClass
783- val outer = resolveOuterSelect(outerCls , ref, 1 )
782+ val targetCls = klass.owner.lexicallyEnclosingClass.asClass
783+ val outer = resolveThis(targetCls , ref, meth.owner.asClass )
784784 outer.instantiate(klass, klass.primaryConstructor, args)
785785 else
786786 reporter.reportAll(tryReporter.errors)
@@ -1322,9 +1322,12 @@ object Semantic:
13221322 val qual = eval(qualifier, thisV, klass)
13231323
13241324 name match
1325- case OuterSelectName (_, hops) =>
1326- val SkolemType (tp) = expr.tpe: @ unchecked
1327- withTrace(trace2) { resolveOuterSelect(tp.classSymbol.asClass, qual, hops) }
1325+ case OuterSelectName (_, _) =>
1326+ val current = qualifier.tpe.classSymbol
1327+ val target = expr.tpe.widenSingleton.classSymbol.asClass
1328+ withTrace(trace2) {
1329+ resolveThis(target, qual, current.asClass)
1330+ }
13281331 case _ =>
13291332 withTrace(trace2) { qual.select(expr.symbol) }
13301333
@@ -1493,41 +1496,6 @@ object Semantic:
14931496
14941497 }
14951498
1496- /** Resolve outer select introduced during inlining.
1497- *
1498- * See `tpd.outerSelect` and `ElimOuterSelect`.
1499- */
1500- def resolveOuterSelect (target : ClassSymbol , thisV : Value , hops : Int ): Contextual [Value ] = log(" resolving outer " + target.show + " , this = " + thisV.show + " , hops = " + hops, printer, (_ : Value ).show) {
1501- // Is `target` reachable from `cls` with the given `hops`?
1502- def reachable (cls : ClassSymbol , hops : Int ): Boolean = log(" reachable from " + cls + " -> " + target + " in " + hops, printer) {
1503- if hops == 0 then cls == target
1504- else reachable(cls.owner.lexicallyEnclosingClass.asClass, hops - 1 )
1505- }
1506-
1507- thisV match
1508- case Hot => Hot
1509-
1510- case ref : Ref =>
1511- val obj = ref.objekt
1512- val curOpt = obj.klass.baseClasses.find(cls => reachable(cls, hops))
1513- curOpt match
1514- case Some (cur) =>
1515- resolveThis(target, thisV, cur)
1516-
1517- case None =>
1518- report.error(" [Internal error] unexpected outerSelect, thisV = " + thisV + " , target = " + target.show + " , hops = " + hops, trace.toVector.last.srcPos)
1519- Cold
1520-
1521- case RefSet (refs) =>
1522- refs.map(ref => resolveOuterSelect(target, ref, hops)).join
1523-
1524- case fun : Fun =>
1525- report.error(" [Internal error] unexpected thisV = " + thisV + " , target = " + target.show + " , hops = " + hops, trace.toVector.last.srcPos)
1526- Cold
1527-
1528- case Cold => Cold
1529- }
1530-
15311499 /** Compute the outer value that correspond to `tref.prefix` */
15321500 def outerValue (tref : TypeRef , thisV : Ref , klass : ClassSymbol ): Contextual [Value ] =
15331501 val cls = tref.classSymbol.asClass
0 commit comments