summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2012-08-23 11:25:01 -0700
committerSom Snytt <som.snytt@gmail.com>2012-09-01 08:50:55 -0700
commit6917599b9bb5a316e0ce9e63927dae8c0f09c861 (patch)
tree257d361f6d367fbdf90071bc074ffbb94bb006f2 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent67de646839f664864a3eeb640973b62c44ffa016 (diff)
downloadscala-6917599b9bb5a316e0ce9e63927dae8c0f09c861.tar.gz
scala-6917599b9bb5a316e0ce9e63927dae8c0f09c861.tar.bz2
scala-6917599b9bb5a316e0ce9e63927dae8c0f09c861.zip
SI-6278 fixed: synthetic implicit def must sort with its associated implicit class
Add a case to the ad-hoc (or add-hack) addSynthetics to keep the trees close. This relies on naming convention, so changes in naming of the implicit def would require an update here.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 1770f2419a..043658dab5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2739,12 +2739,18 @@ trait Typers extends Modes with Adaptations with Tags {
// this code by associating defaults and companion objects
// with the original tree instead of the new symbol.
def matches(stat: Tree, synt: Tree) = (stat, synt) match {
+ // synt is default arg for stat
case (DefDef(_, statName, _, _, _, _), DefDef(mods, syntName, _, _, _, _)) =>
mods.hasDefaultFlag && syntName.toString.startsWith(statName.toString)
+ // synt is companion module
case (ClassDef(_, className, _, _), ModuleDef(_, moduleName, _)) =>
className.toTermName == moduleName
+ // synt is implicit def for implicit class (#6278)
+ case (ClassDef(cmods, cname, _, _), DefDef(dmods, dname, _, _, _, _)) =>
+ cmods.isImplicit && dmods.isImplicit && cname.toTermName == dname
+
case _ => false
}