File tree Expand file tree Collapse file tree 2 files changed +3
-10
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import scala.util.control.NonFatal
2323import config .Config
2424import reporting .*
2525import collection .mutable
26- import cc .{CapturingType , derivedCapturingType }
26+ import cc .{CapturingType , derivedCapturingType , stripCapturing }
2727
2828import scala .annotation .internal .sharable
2929import scala .compiletime .uninitialized
@@ -2232,7 +2232,7 @@ object SymDenotations {
22322232 tp match {
22332233 case tp @ TypeRef (prefix, _) =>
22342234 def foldGlb (bt : Type , ps : List [Type ]): Type = ps match {
2235- case p :: ps1 => foldGlb(bt & recur(p), ps1)
2235+ case p :: ps1 => foldGlb(bt & recur(p.stripCapturing ), ps1)
22362236 case _ => bt
22372237 }
22382238
Original file line number Diff line number Diff line change @@ -895,20 +895,13 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
895895 canWidenAbstract && acc(true , tp)
896896
897897 def tryBaseType (cls2 : Symbol ) =
898- var base = nonExprBaseType(tp1, cls2)
898+ val base = nonExprBaseType(tp1, cls2)
899899 if base.exists && (base ne tp1)
900900 && (! caseLambda.exists
901901 || widenAbstractOKFor(tp2)
902902 || tp1.widen.underlyingClassRef(refinementOK = true ).exists)
903903 then
904904 def checkBase =
905- // Strip existing capturing set from base type
906- base = base.stripCapturing
907- // Pass capture set of tp1 to base type
908- tp1 match
909- case tp1 @ CapturingType (_, refs1) =>
910- base = CapturingType (base, refs1, tp1.isBoxed)
911- case _ =>
912905 isSubType(base, tp2, if tp1.isRef(cls2) then approx else approx.addLow)
913906 && recordGadtUsageIf { MatchType .thatReducesUsingGadt(tp1) }
914907 if tp1.widenDealias.isInstanceOf [AndType ] || base.isInstanceOf [OrType ] then
You can’t perform that action at this time.
0 commit comments