Skip to content

Commit 3c99a20

Browse files
committed
Fix ()'s in new/exploreTyperState
1 parent f0b3080 commit 3c99a20

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ trait Implicits { self: Typer =>
509509
&& from.isValueType
510510
&& ( from.isValueSubType(to)
511511
|| inferView(dummyTreeOfType(from), to)
512-
(ctx.fresh.addMode(Mode.ImplicitExploration).setExploreTyperState)
512+
(ctx.fresh.addMode(Mode.ImplicitExploration).setExploreTyperState())
513513
.isInstanceOf[SearchSuccess]
514514
// TODO: investigate why we can't TyperState#test here
515515
)
@@ -787,7 +787,7 @@ trait Implicits { self: Typer =>
787787
val generated1 = adapt(generated, pt)
788788
lazy val shadowing =
789789
typed(untpd.Ident(ref.name) withPos pos.toSynthetic, funProto)(
790-
nestedContext.addMode(Mode.ImplicitShadowing).setExploreTyperState)
790+
nestedContext.addMode(Mode.ImplicitShadowing).setExploreTyperState())
791791
def refSameAs(shadowing: Tree): Boolean =
792792
ref.symbol == closureBody(shadowing).symbol || {
793793
shadowing match {
@@ -819,7 +819,7 @@ trait Implicits { self: Typer =>
819819
val history = ctx.searchHistory nest wildProto
820820
val result =
821821
if (history eq ctx.searchHistory) divergingImplicit(cand.ref)
822-
else typedImplicit(cand)(nestedContext.setNewTyperState.setSearchHistory(history))
822+
else typedImplicit(cand)(nestedContext.setNewTyperState().setSearchHistory(history))
823823
result match {
824824
case fail: SearchFailure =>
825825
rankImplicits(pending1, acc)

compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ object ProtoTypes {
3939
(tp.widenExpr relaxed_<:< pt.widenExpr) || viewExists(tp, pt)
4040

4141
/** Test compatibility after normalization in a fresh typerstate. */
42-
def normalizedCompatible(tp: Type, pt: Type)(implicit ctx: Context) = {
43-
val nestedCtx = ctx.fresh.setExploreTyperState
44-
val normTp = normalize(tp, pt)(nestedCtx)
45-
isCompatible(normTp, pt)(nestedCtx) ||
46-
pt.isRef(defn.UnitClass) && normTp.isParameterless
42+
def normalizedCompatible(tp: Type, pt: Type)(implicit ctx: Context) = ctx.typerState.test {
43+
val normTp = normalize(tp, pt)
44+
isCompatible(normTp, pt) || pt.isRef(defn.UnitClass) && normTp.isParameterless
4745
}
4846

4947
private def disregardProto(pt: Type)(implicit ctx: Context): Boolean = pt.dealias match {

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
17551755
typed(tree, selType)(ctx addMode Mode.Pattern)
17561756

17571757
def tryEither[T](op: Context => T)(fallBack: (T, TyperState) => T)(implicit ctx: Context) = {
1758-
val nestedCtx = ctx.fresh.setNewTyperState
1758+
val nestedCtx = ctx.fresh.setNewTyperState()
17591759
val result = op(nestedCtx)
17601760
if (nestedCtx.reporter.hasErrors)
17611761
fallBack(result, nestedCtx.typerState)

0 commit comments

Comments
 (0)