简体   繁体   中英

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

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):

在此输入图像描述

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

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
    ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM