Reference a secondary constructor from KDoc

Currently, I can document a secondary constructor just like any other member, but this documentation seems to be completely detached from the rest. Maybe it makes its way into the “compiled” reference, but when using doc pop-ups in the IDE (which is probably how it is usually used), I can see no references whatsoever when I’m viewing the docs for the class itself. I can document the primary constructor right there, and I can put references to other members (“If you need to do X, call method [Y]”), but I see no way to reference a secondary constructor in the same manner.

It is especially annoying when the primary constructor is private and I want to refer the user to a public secondary constructor in the form of “To create an instance, use [this constructor]”.

All I’ve been able to find is this question with no meaningful answers:

…and before anyone asks: the primary constructor is private because it accepts a private class instance for delegation, along the lines of

class MyClass private constructor(
    val publicProperty: String,
    private val impl: PublicInterface
) : PublicInterface by impl {
    constructor(publicProperty: String) : this(publicProperty, PrivateImpl())
}
1 Like

https://youtrack.jetbrains.com/issue/KT-15984