File tree 2 files changed +9
-3
lines changed
compiler/src/dotty/tools/dotc
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 @@ -245,10 +245,12 @@ object Implicits:
245
245
if refs.isEmpty && (! considerExtension || companionRefs.isEmpty) then
246
246
Nil
247
247
else
248
- val nestedCtx = ctx.fresh.addMode(Mode .TypevarsMissContext )
249
248
val candidates = new mutable.ListBuffer [Candidate ]
250
249
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
+ }
252
254
if extensionOnly then ckind &= Candidate .Extension
253
255
if ckind != Candidate .None then
254
256
candidates += Candidate (ref, ckind, level)
You can’t perform that action at this time.
0 commit comments