Scaladoc fails to generate links for inner classes in method and class signatures

609 Views Asked by At

I have a top level trait that contains a number of classes and traits like:

trait Trees { self: Types =>
  trait Tree
  trait IdentifiedTree extends Tree
  trait Empty extends Tree

  /** The factory for [[TypeUse]] instances */
  trait TypeUse extends Tree
  /** AST tree to represent erroneous trees */
  object BadTree extends IdentifiedTree
  /** AST tree for empty statements and trees */
  val Empty: Empty = new Empty {}
}

trait Types

When I generate the documentation for it, using scaladoc I can link to the inner classes, using [[CLASS_NAME]], but scaladoc fails to create links for trees both in signatures and extends.

I use sbt to generate the scaladoc, and I use the following flags:

scalacOptions in (Compile, doc) ++= Seq("-groups", "-implicits",
     "-diagrams", "-no-prefixes", "-author", "-explaintypes",
     "-language:implicitConversions,higherKinds")

To give you a better idea, the api for the above definition is as follows (please note the missing links):

enter image description here

Can you tell me what am I doing wrong, please?

1

There are 1 best solutions below

4
On

I think the problem with the nested traits is that the inner traits do not even exists outside of an instantiation of the top level trait. This post might be of some help.

Changing the top level Trees to be an Object solved the problem for me. However, I am not sure if this makes sense for your use case.

object Trees {
    trait Tree
    trait IdentifiedTree extends Tree
    trait Empty extends Tree
    ...
}