Skip to content

Commit 8f3a44b

Browse files
oderskyallanrenucci
authored andcommitted
Fix ()'s in new/exploreTyperState
1 parent 30cada8 commit 8f3a44b

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
@@ -507,7 +507,7 @@ trait Implicits { self: Typer =>
507507
&& from.isValueType
508508
&& ( from.isValueSubType(to)
509509
|| inferView(dummyTreeOfType(from), to)
510-
(ctx.fresh.addMode(Mode.ImplicitExploration).setExploreTyperState)
510+
(ctx.fresh.addMode(Mode.ImplicitExploration).setExploreTyperState())
511511
.isInstanceOf[SearchSuccess]
512512
// TODO: investigate why we can't TyperState#test here
513513
)
@@ -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
@@ -1751,7 +1751,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
17511751
typed(tree, selType)(ctx addMode Mode.Pattern)
17521752

17531753
def tryEither[T](op: Context => T)(fallBack: (T, TyperState) => T)(implicit ctx: Context) = {
1754-
val nestedCtx = ctx.fresh.setNewTyperState
1754+
val nestedCtx = ctx.fresh.setNewTyperState()
17551755
val result = op(nestedCtx)
17561756
if (nestedCtx.reporter.hasErrors)
17571757
fallBack(result, nestedCtx.typerState)

0 commit comments

Comments
 (0)