File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -674,7 +674,7 @@ object Contexts {
674674 final def retractMode (mode : Mode ): c.type = c.setMode(c.mode &~ mode)
675675 }
676676
677- private def exploreCtx (using Context ): Context =
677+ private def exploreCtx (using Context ): FreshContext =
678678 util.Stats .record(" explore" )
679679 val base = ctx.base
680680 import base ._
@@ -701,6 +701,10 @@ object Contexts {
701701 val ectx = exploreCtx
702702 try op(using ectx) finally wrapUpExplore(ectx)
703703
704+ inline def exploreInFreshCtx [T ](inline op : FreshContext ?=> T )(using Context ): T =
705+ val ectx = exploreCtx
706+ try op(using ectx) finally wrapUpExplore(ectx)
707+
704708 private def changeOwnerCtx (owner : Symbol )(using Context ): Context =
705709 val base = ctx.base
706710 import base ._
Original file line number Diff line number Diff line change @@ -245,10 +245,12 @@ object Implicits:
245245 if refs.isEmpty && (! considerExtension || companionRefs.isEmpty) then
246246 Nil
247247 else
248- val nestedCtx = ctx.fresh.addMode(Mode .TypevarsMissContext )
249248 val candidates = new mutable.ListBuffer [Candidate ]
250249 def tryCandidate (extensionOnly : Boolean )(ref : ImplicitRef ) =
251- var ckind = explore(candidateKind(ref.underlyingRef))(using nestedCtx)
250+ var ckind = exploreInFreshCtx { (using ctx : FreshContext ) =>
251+ ctx.setMode(ctx.mode | Mode .TypevarsMissContext )
252+ candidateKind(ref.underlyingRef)
253+ }
252254 if extensionOnly then ckind &= Candidate .Extension
253255 if ckind != Candidate .None then
254256 candidates += Candidate (ref, ckind, level)
You can’t perform that action at this time.
0 commit comments