5

我试图了解scaladoc 宏是如何 工作的。例如

/** $DESCR
  *
  * @define DESCR
  * A `Consumer` simplifies resource management...
  *
  * @define KEY
  * the key type
  *
  * @define VALUE
  * the value type
  */
object Consumer {
  /** Creates a new consumer
    *
    * @tparam A       $KEY
    * @tparam B       $VALUE
    */
  def apply[A, B](): Consumer[A, B] = ???
}

/** $DESCR
  *
  * @tparam A $KEY
  * @tparam B $VALUE
  */
trait Consumer[-A, +B]

我的印象是,这应该生成一个文档,其中包含 trait 和伴随对象的描述A Consumer simplifies resource management...,并且还显示了apply方法和trait.

但是宏似乎在特征中不可用。虽然对象已正确记录,但特征文档仅显示宏名称$DESCR, $KEY, $VALUE.

4

0 回答 0