Skip to content

Commit

Permalink
Use withMode instead of inMode
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Jan 31, 2024
1 parent 5c1f86a commit 8547e0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Contexts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ object Contexts {
inline def atPhaseNoEarlier[T](limit: Phase)(inline op: Context ?=> T)(using Context): T =
op(using if !limit.exists || limit <= ctx.phase then ctx else ctx.withPhase(limit))

inline def inMode[T](mode: Mode)(inline op: Context ?=> T)(using ctx: Context): T =
inline private def inMode[T](mode: Mode)(inline op: Context ?=> T)(using ctx: Context): T =
op(using if mode != ctx.mode then ctx.fresh.setMode(mode) else ctx)

inline def withMode[T](mode: Mode)(inline op: Context ?=> T)(using ctx: Context): T =
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5037,7 +5037,7 @@ object Types extends TypeUtils {
record("MatchType.reduce computed")
if (myReduced != null) record("MatchType.reduce cache miss")
myReduced =
trace(i"reduce match type $this $hashCode", matchTypes, show = true)(inMode(Mode.Type) {
trace(i"reduce match type $this $hashCode", matchTypes, show = true)(withMode(Mode.Type) {
def matchCases(cmp: TrackingTypeComparer): Type =
val saved = ctx.typerState.snapshot()
try cmp.matchCases(scrutinee.normalized, cases.map(MatchTypeCaseSpec.analyze(_)))
Expand Down

0 comments on commit 8547e0d

Please sign in to comment.