File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -820,9 +820,13 @@ object TypeOps:
820820 prefixTVar.uncheckedNN
821821 case ThisType (tref) if ! tref.symbol.isStaticOwner =>
822822 val symbol = tref.symbol
823+ val compatibleSingleton = singletons.valuesIterator.find(_.underlying.derivesFrom(symbol))
823824 if singletons.contains(symbol) then
824825 prefixTVar = singletons(symbol) // e.g. tests/pos/i16785.scala, keep Outer.this
825826 prefixTVar.uncheckedNN
827+ else if compatibleSingleton.isDefined then
828+ prefixTVar = compatibleSingleton.get
829+ prefixTVar.uncheckedNN
826830 else if symbol.is(Module ) then
827831 TermRef (this (tref.prefix), symbol.sourceModule)
828832 else if (prefixTVar != null )
@@ -920,10 +924,11 @@ object TypeOps:
920924 }
921925
922926 val inferThisMap = new InferPrefixMap
923- val tvars = tp1.etaExpand match
927+ val prefixInferredTp = inferThisMap(tp1)
928+ val tvars = prefixInferredTp.etaExpand match
924929 case eta : TypeLambda => constrained(eta)
925930 case _ => Nil
926- val protoTp1 = inferThisMap.apply(tp1) .appliedTo(tvars)
931+ val protoTp1 = prefixInferredTp .appliedTo(tvars)
927932
928933 if gadtSyms.nonEmpty then
929934 ctx.gadtState.addToConstraint(gadtSyms)
You can’t perform that action at this time.
0 commit comments