Skip to content

Optimize computeEligible #9640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,13 @@ object Implicits:
if (monitored) record(s"check eligible refs in irefCtx", refs.length)
val ownEligible = filterMatching(tp)
if (isOuterMost) ownEligible
else ownEligible ::: {
val shadowed = ownEligible.map(_.ref.implicitName).toSet
outerImplicits.eligible(tp).filterNot(cand => shadowed.contains(cand.ref.implicitName))
}
else if ownEligible.isEmpty then outerImplicits.eligible(tp)
else
val outerEligible = outerImplicits.eligible(tp)
if outerEligible.isEmpty then ownEligible
else
val shadowed = ownEligible.map(_.ref.implicitName).toSet
ownEligible ::: outerEligible.filterConserve(cand => !shadowed.contains(cand.ref.implicitName))
}

override def isAccessible(ref: TermRef)(using Context): Boolean =
Expand Down