diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-02-08 13:56:16 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-02-09 17:16:24 +0100 |
commit | f2e0616f90f934689e4892358d56221504ad2a46 (patch) | |
tree | 785c080954d9e3db23834bb7e73026349ae969e9 /test/scaladoc | |
parent | 08dd102e002b38c7c3151c0c081ee0f902e3b918 (diff) | |
download | scala-f2e0616f90f934689e4892358d56221504ad2a46.tar.gz scala-f2e0616f90f934689e4892358d56221504ad2a46.tar.bz2 scala-f2e0616f90f934689e4892358d56221504ad2a46.zip |
SI-9620: add doc annotation to hide specific conversions
This commit will introduce the doc annotation `@hideImplicitConversion`.
By specifying which conversions to hide, the user can "toggle" which
conversions are kept in the parsed entity.
This implementation is a better workaround than hardcoding which ones to
ignore when running scaladoc.
Review: @VladUreche
Diffstat (limited to 'test/scaladoc')
-rw-r--r-- | test/scaladoc/run/SI-9620.check | 1 | ||||
-rw-r--r-- | test/scaladoc/run/SI-9620.scala | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/test/scaladoc/run/SI-9620.check b/test/scaladoc/run/SI-9620.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/SI-9620.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/SI-9620.scala b/test/scaladoc/run/SI-9620.scala new file mode 100644 index 0000000000..96260aad9a --- /dev/null +++ b/test/scaladoc/run/SI-9620.scala @@ -0,0 +1,43 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + override def code = """ + package a + + trait Foo[S] { + def foo(t: S): Int = 123 + } + + /** Boo with only one foo method, hopefully! + * @hideImplicitConversion BooShouldNotAppearIsFoo + */ + trait Boo[T] + + object Boo { + sealed trait ShouldNotAppear + implicit class BooShouldNotAppearIsFoo(boo: Boo[ShouldNotAppear]) extends Foo[ShouldNotAppear] + implicit class BooLongIsFoo(boo: Boo[Long]) extends Foo[Long] + } + """ + + // no need for special settings + def scaladocSettings = "-implicits" + + def testModel(rootPackage: Package) = { + import access._ + + // Assert Boo only has one implicit conversion + val boo = rootPackage._package("a")._trait("Boo") + val conversions = boo._conversions("a.Boo.BooShouldNotAppearIsFoo") ++ boo._conversions("a.Boo.BooLongIsFoo") + assert(conversions.length == 1, conversions.length + " == 1") + + // Assert that the implicit conversion is not "BooShouldNotAppearIsFoo" + assert(conversions.head.conversionShortName == "BooLongIsFoo", + conversions.head.conversionShortName + " == BooLongIsFoo") + + // Assert that the same for full path + assert(conversions.head.conversionQualifiedName == "a.Boo.BooLongIsFoo", + conversions.head.conversionQualifiedName + " == a.Boo.BooLongIsFoo") + } +} |