File tree 1 file changed +12
-1
lines changed
compiler/src/dotty/tools/dotc/transform 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -336,12 +336,23 @@ object ExplicitOuter {
336
336
class OuterOps (val ictx : Context ) extends AnyVal {
337
337
private implicit def ctx : Context = ictx
338
338
339
+ private def outerType (cls : ClassSymbol ): Type = {
340
+ val encl = cls.owner.enclosingClass
341
+ if (cls.is(Scala2x ))
342
+ encl.asClass.classInfo.selfInfo match {
343
+ case tp : TypeRef => tp.classSymbol.typeRef
344
+ case self : Symbol => self.typeRef
345
+ case _ => encl.typeRef
346
+ }
347
+ else encl.typeRef
348
+ }
349
+
339
350
/** If `cls` has an outer parameter add one to the method type `tp`. */
340
351
def addParam (cls : ClassSymbol , tp : Type ): Type =
341
352
if (hasOuterParam(cls)) {
342
353
val mt @ MethodTpe (pnames, ptypes, restpe) = tp
343
354
mt.derivedLambdaType(
344
- nme.OUTER :: pnames, cls.owner.enclosingClass.typeRef :: ptypes, restpe)
355
+ nme.OUTER :: pnames, outerType( cls) :: ptypes, restpe)
345
356
} else tp
346
357
347
358
/** If function in an apply node is a constructor that needs to be passed an
You can’t perform that action at this time.
0 commit comments