Skip to content

Commit 32b6907

Browse files
committed
Incorporated review feedback
* Fixed whitespace and comment typos. * Simplified loop logic in checkDivergence.
1 parent fb100cc commit 32b6907

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ trait Implicits { self: Typer =>
11661166
* search history (`root`) which in turn maintains a possibly empty dictionary of
11671167
* recursive implicit terms constructed during this search.
11681168
*
1169-
* A search history provides operations to created a nested search history, check for
1169+
* A search history provides operations to create a nested search history, check for
11701170
* divergence, enter by name references and definitions in the implicit dictionary, lookup
11711171
* recursive references and emit a complete implicit dictionary when the outermost search
11721172
* is complete.
@@ -1220,22 +1220,20 @@ abstract class SearchHistory { outer =>
12201220
// as we ascend the chain of open implicits to the outermost search context.
12211221

12221222
@tailrec
1223-
def loop(ois: List[(Candidate, Type)], belowByname: Boolean): Boolean = {
1223+
def loop(ois: List[(Candidate, Type)], belowByname: Boolean): Boolean =
12241224
ois match {
12251225
case Nil => false
12261226
case (hd@(cand1, tp)) :: tl =>
1227-
(if (cand1.ref == cand.ref) {
1227+
if (cand1.ref == cand.ref) {
12281228
val wideTp = tp.widenExpr
12291229
lazy val wildTp = wildApprox(wideTp)
1230-
if (belowByname && (wildTp <:< wildPt)) Some(false)
1231-
else if ((wideTp.typeSize < ptSize && wideTp.coveringSet == ptCoveringSet) || (wildTp == wildPt)) Some(true)
1232-
else None
1233-
} else None) match {
1234-
case Some(res) => res
1235-
case None => loop(tl, isByname(tp) || belowByname)
1230+
if (belowByname && (wildTp <:< wildPt)) false
1231+
else if ((wideTp.typeSize < ptSize && wideTp.coveringSet == ptCoveringSet) || (wildTp == wildPt)) true
1232+
else loop(tl, isByname(tp) || belowByname)
12361233
}
1234+
else loop(tl, isByname(tp) || belowByname)
12371235
}
1238-
}
1236+
12391237
loop(open, isByname(pt))
12401238
}
12411239

@@ -1378,7 +1376,7 @@ final class SearchRoot extends SearchHistory {
13781376
else {
13791377
result match {
13801378
case failure: SearchFailure => failure
1381-
case success@SearchSuccess(tree, _, _) =>
1379+
case success @ SearchSuccess(tree, _, _) =>
13821380
import tpd._
13831381

13841382
// We might have accumulated dictionary entries for by name implicit arguments
@@ -1438,7 +1436,7 @@ final class SearchRoot extends SearchHistory {
14381436
tpd.ref(vsymMap(id.symbol))
14391437
case tree => tree
14401438
})
1441-
val nrhss = rhss.map(rhs => rhsMap(rhs))
1439+
val nrhss = rhss.map(rhsMap(_))
14421440

14431441
val vdefs = (nsyms zip nrhss) map {
14441442
case (nsym, nrhs) => ValDef(nsym.asTerm, nrhs)

0 commit comments

Comments
 (0)