diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-12-10 12:46:13 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-12-10 13:10:52 +0100 |
commit | e249f2eeb8451c1b754711294ed954c8de7775fb (patch) | |
tree | 2a202ea255ec265cee3f343bd4b76e8443f767a4 /src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala | |
parent | 0acb8a30c379f268e8a3e1340504530493a1a1dc (diff) | |
download | scala-e249f2eeb8451c1b754711294ed954c8de7775fb.tar.gz scala-e249f2eeb8451c1b754711294ed954c8de7775fb.tar.bz2 scala-e249f2eeb8451c1b754711294ed954c8de7775fb.zip |
SI-4922 Show default in Scaladoc for generic methods.
We must account for cloned symbols.
Diffstat (limited to 'src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala index 3ae1210ebf..8ced574676 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -950,7 +950,16 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { // units.filter should return only one element (currentRun.units filter (_.source.file == aSym.sourceFile)).toList match { case List(unit) => - (unit.body find (_.symbol == aSym)) match { + // SI-4922 `sym == aSym` is insufficent if `aSym` is a clone of symbol + // of the parameter in the tree, as can happen with type parametric methods. + def isCorrespondingParam(sym: Symbol) = ( + sym != null && + sym != NoSymbol && + sym.owner == aSym.owner && + sym.name == aSym.name && + sym.isParamWithDefault + ) + (unit.body find (t => isCorrespondingParam(t.symbol))) match { case Some(ValDef(_,_,_,rhs)) => makeTree(rhs) case _ => None } |