summaryrefslogtreecommitdiff
path: root/src/scaladoc
diff options
context:
space:
mode:
authorStefan Zeiger <szeiger@novocode.com>2016-08-12 13:37:34 +0200
committerGitHub <noreply@github.com>2016-08-12 13:37:34 +0200
commit7ff88c0bcba04cf8edbe98d488d14028e6ac399f (patch)
treebda800be3690f55a54eb0c72792a9d2cd898810a /src/scaladoc
parent1950412f6d4118433408444ace371eb020342711 (diff)
parent1149453c9a762b0a5792d6139ec2c201e418c914 (diff)
downloadscala-7ff88c0bcba04cf8edbe98d488d14028e6ac399f.tar.gz
scala-7ff88c0bcba04cf8edbe98d488d14028e6ac399f.tar.bz2
scala-7ff88c0bcba04cf8edbe98d488d14028e6ac399f.zip
Merge pull request #5231 from gourlaysama/ticket/t9585-scaladoc-wrong-implicits
SI-9585 hide auto-implicit conversions from scaladoc
Diffstat (limited to 'src/scaladoc')
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala
index e67a717257..cedbdd1547 100644
--- a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala
@@ -171,6 +171,20 @@ trait ModelFactoryImplicitSupport {
return Nil
}
+ if (!settings.docImplicitsShowAll && viewSimplifiedType.resultType.typeSymbol == sym) {
+ // If, when looking at views for a class A, we find one that returns A as well
+ // (possibly with different type parameters), we ignore it.
+ // It usually is a way to build a "whatever" into an A, but we already have an A, as in:
+ // {{{
+ // object Box {
+ // implicit def anyToBox[T](t: T): Box[T] = new Box(t)
+ // }
+ // class Box[T](val t: T)
+ // }}}
+ // We don't want the implicit conversion from Box[T] to Box[Box[T]] to appear.
+ return Nil
+ }
+
// type the view application so we get the exact type of the result (not the formal type)
val viewTree = result.tree.setType(viewSimplifiedType)
val appliedTree = new ApplyImplicitView(viewTree, List(Ident("<argument>") setType viewTree.tpe.paramTypes.head))