我试图使用@usecase
scaladoc注释来简化复杂的类型,这种类型在为我构建类型lambda的kind-projector的过程中已被证实。这是有问题的功能:
def oneOf[P[_], I](alts: List[Alt[Schema[Unit, P, ?], I, B] forSome {type B}]): Schema[Unit, P, I]
然而,当它变成scaladoc时,它变得非常糟糕:
def oneOf[P[_], I](alts: List[Alt[[γ$13$]HCofree[[β$0$[_$1], γ$1$]SchemaF[P, β$0$, γ$1$], Unit, γ$13$], I, _]]): Schema[Unit, P, I]
如果我能在scaladocs中使用原始函数定义,我会喜欢它,所以我尝试使用@usecase
注释来给出我自己的定义:
/** Builds an un-annotated schema for the sum type `I` from a list of alternatives.
*
* Each alternative value in the list describes a single constructor of `I`.
* For example, to construct the schema for [[scala.util.Either]] one would provide
* two alternatives, one for the `Left` constructor and one for `Right`.
*
* @usecase def oneOf[P[_], I](alts: List[Alt[Schema[Unit, P, ?], I, _]]): Schema[Unit, P, I]
*/
def oneOf[P[_], I](alts: List[Alt[Schema[Unit, P, ?], I, B] forSome {type B}]): Schema[Unit, P, I] =
然而,看起来@usecase
值实际上是由Scala编译器以某种方式处理的,我所做的一切都不能说服它允许我直接使用这个字符串。这是一个示例错误:
> doc
[info] Main Scala API documentation to /home/nuttycom/schematic/target/scala-2.12/api...
[error] /home/nuttycom/schematic/src/main/scala/schematic/Schema.scala:106: not found: type ?
[error] * @usecase def oneOf[P[_], I](alts: List[Alt[Schema[Unit, P, ?], I, _]]): Schema[Unit, P, I]
[error] ^
[info] No documentation generated with unsuccessful compiler run
我是否可以使用任何机制让scaladoc不尝试解析或以其他方式验证用例字符串?