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 {
674
674
final def retractMode (mode : Mode ): c.type = c.setMode(c.mode &~ mode)
675
675
}
676
676
677
- private def exploreCtx (using Context ): Context =
677
+ private def exploreCtx (using Context ): FreshContext =
678
678
util.Stats .record(" explore" )
679
679
val base = ctx.base
680
680
import base ._
@@ -701,6 +701,10 @@ object Contexts {
701
701
val ectx = exploreCtx
702
702
try op(using ectx) finally wrapUpExplore(ectx)
703
703
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
+
704
708
private def changeOwnerCtx (owner : Symbol )(using Context ): Context =
705
709
val base = ctx.base
706
710
import base ._
Original file line number Diff line number Diff line change @@ -239,10 +239,12 @@ object Implicits:
239
239
if refs.isEmpty && (! considerExtension || companionRefs.isEmpty) then
240
240
Nil
241
241
else
242
- val nestedCtx = ctx.fresh.addMode(Mode .TypevarsMissContext )
243
242
val candidates = new mutable.ListBuffer [Candidate ]
244
243
def tryCandidate (extensionOnly : Boolean )(ref : ImplicitRef ) =
245
- var ckind = explore(candidateKind(ref.underlyingRef))(using nestedCtx)
244
+ var ckind = exploreInFreshCtx { (using ctx : FreshContext ) =>
245
+ ctx.setMode(ctx.mode | Mode .TypevarsMissContext )
246
+ candidateKind(ref.underlyingRef)
247
+ }
246
248
if extensionOnly then ckind &= Candidate .Extension
247
249
if ckind != Candidate .None then
248
250
candidates += Candidate (ref, ckind, level)
You can’t perform that action at this time.
0 commit comments