Type aliases inherit scaladocs

Hi Scala community,

I have noticed that type aliases do not ‘inherit’ the scaladocs of the types they alias. This is an issue I have encountered when constructing ‘uber’ imports that include type aliases for different classes scattered throughout the codebase. I think it would be a nice feature if the scaladoc from the aliased type were associated with the type alias as well.

I guess my initial questions would be:

  • Is there a technical reason why this has not been done before?
  • Do people think this would be a worthwhile thing to do and would anyone object if I attempted this?

Cheers,

Ed

6 Likes

Hey @thelasthog,

I’m working on the new doctool for Scala3. I think what you propose definitely sounds useful. We already have @inheritdoc instruction which tells the doctool to copy the docstring of overridden definition, so it makes perfect sense to have, say, an @exposedoc instruction which instead means “copy the docstring of the underlying definition”.

If you’re still interested in working on this, then we’d definitely be happy to help you along and include your work. Two places to look are the implementation of @inheritdoc and the code for handling exports (it also needs to get the “underlying definition”, so you can use it to understand how to do that). In case you get stuck, feel free to open a WIP PR so that we can discuss your work.

2 Likes

Hi @AleksanderBG,

I am still keen to work on this. Will get cracking on this in the new year. Thanks for your response,

Ed

2 Likes