Referencing constructor parameter in KDoc

I want to reference a constructor parameter in the KDoc comment of a property:

class Thing(parts: Set<Part>) {
    /**
     * Empty if [parts] are empty.
     */
    val isEmpty get() = parts.isEmpty

    var parts: Set<Part> = parts
        get ...
        set ...
}

If I use only [parts] the reference parts relates to the property, but not to the constructor parameter. I’m basically looking for something like [constructor.parts].

Is it possible to reference parameters from constructors or other functions in KDoc?

Currently it’s not possible in Kotlin. We’ve created a ticket on YouTrack, on which you can subscribe, by pressing star, to be noticed about updates on this feature request.

1 Like

Thank you!