summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-11-06 21:51:17 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-02-01 09:52:38 +0100
commit9e7eb8c1531d104d19ee382f650bf627c859d168 (patch)
tree24d7968f0bb1209820ebce9a18102ff9d54869a2 /src/compiler/scala/tools/nsc/typechecker/Implicits.scala
parent1623c62b67efeb1dc87825731b88a0294a3c3488 (diff)
downloadscala-9e7eb8c1531d104d19ee382f650bf627c859d168.tar.gz
scala-9e7eb8c1531d104d19ee382f650bf627c859d168.tar.bz2
scala-9e7eb8c1531d104d19ee382f650bf627c859d168.zip
Implicits: Move shadowing checks after plausibility checks
Shadowing is rarer than implausbility; this seems to be the most efficient way to order these filters.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Implicits.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 847211945c..776920ed42 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -788,7 +788,7 @@ trait Implicits {
final class LocalShadower extends Shadower {
val shadowed = util.HashSet[Name](512)
def addInfos(infos: Infos) {
- shadowed addEntries infos.map(_.name)
+ infos.foreach(i => shadowed.addEntry(i.name))
}
def isShadowed(name: Name) = shadowed(name)
}
@@ -805,7 +805,6 @@ trait Implicits {
private def isIneligible(info: ImplicitInfo) = (
info.isCyclicOrErroneous
|| isView && (info.sym eq Predef_conforms)
- || shadower.isShadowed(info.name)
|| (!context.macrosEnabled && info.sym.isTermMacro)
)
@@ -814,6 +813,7 @@ trait Implicits {
def survives(info: ImplicitInfo) = (
!isIneligible(info) // cyclic, erroneous, shadowed, or specially excluded
&& isPlausiblyCompatible(info.tpe, wildPt) // optimization to avoid matchesPt
+ && !shadower.isShadowed(info.name) // OPT rare, only check for plausible candidates
&& matchesPt(info) // stable and matches expected type
)
/** The implicits that are not valid because they come later in the source and