summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKato Kazuyoshi <kato.kazuyoshi@gmail.com>2015-03-27 19:21:22 -0700
committerKato Kazuyoshi <kato.kazuyoshi@gmail.com>2015-05-27 21:13:11 -0700
commit23a3ac4ee21499a4d2fbffb5cecff88c7e03790c (patch)
tree97c8b99545337051b21c0da295aa08b53b0a57b7
parent15ca0b31afecfa24686c7a650f550ba5fcac1f03 (diff)
downloadscala-23a3ac4ee21499a4d2fbffb5cecff88c7e03790c.tar.gz
scala-23a3ac4ee21499a4d2fbffb5cecff88c7e03790c.tar.bz2
scala-23a3ac4ee21499a4d2fbffb5cecff88c7e03790c.zip
SI-8210 Scaladoc: Fix the false negative @inheritdoc warning on accessors
This fix is just for the false negative warning. Probably we can skip setters entirely, but I'm not 100% sure.
-rwxr-xr-xsrc/compiler/scala/tools/nsc/ast/DocComments.scala6
-rw-r--r--test/scaladoc/run/SI-8210.check1
-rw-r--r--test/scaladoc/run/SI-8210.scala24
3 files changed, 28 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala
index 02a199f7ac..6442ef2d54 100755
--- a/src/compiler/scala/tools/nsc/ast/DocComments.scala
+++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala
@@ -76,9 +76,9 @@ trait DocComments { self: Global =>
superComment(sym) match {
case None =>
- if (ownComment.indexOf("@inheritdoc") != -1)
- reporter.warning(sym.pos, "The comment for " + sym +
- " contains @inheritdoc, but no parent comment is available to inherit from.")
+ // SI-8210 - The warning would be false negative when this symbol is a setter
+ if (ownComment.indexOf("@inheritdoc") != -1 && ! sym.isSetter)
+ reporter.warning(sym.pos, s"The comment for ${sym} contains @inheritdoc, but no parent comment is available to inherit from.")
ownComment.replaceAllLiterally("@inheritdoc", "<invalid inheritdoc annotation>")
case Some(sc) =>
if (ownComment == "") sc
diff --git a/test/scaladoc/run/SI-8210.check b/test/scaladoc/run/SI-8210.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-8210.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-8210.scala b/test/scaladoc/run/SI-8210.scala
new file mode 100644
index 0000000000..3bd818473f
--- /dev/null
+++ b/test/scaladoc/run/SI-8210.scala
@@ -0,0 +1,24 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+ override def code = """
+object Foo {
+ trait Config {
+ /** The bar obviously. */
+ def bar: Int
+ }
+ class ConfigBuilder extends Config {
+ /** @inheritdoc
+ *
+ * The default value is 1234.
+ */
+ var bar: Int = 1234
+ }
+}
+ """
+
+ def scaladocSettings = ""
+
+ def testModel(root: Package) = ()
+}