scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.88k stars 1.06k forks source link

Scaladoc is years before the language and creates `opaque object`s #21228

Closed KacperFKorban closed 1 month ago

KacperFKorban commented 3 months ago

Compiler version

3.6.0-RC1-bin-20240718-bd84584-NIGHTLY, 3.4.2

Minimized code

//> using scala 3.nightly
// opaqueobject.scala

object Sth:
  opaque type A = Int

scala-cli doc opaqueobject.scala

Output

The object documentation also gets an opaque modifier. The opaque type is documented correctly.

`opaque object` documentation

Expectation

The object documentation doesn't have an opaque modifier

odersky commented 3 months ago

It's not really opaque types. The compiler uses internally opaque as a flag for the object or class containing an opaque type. That won't change. It should be the job of the scaladoc to filter that out.

mbovel commented 1 month ago

We could probably filter out opaque in parseObject?

https://github.com/scala/scala3/blob/b8c5ecb4580f29a3c66e1ad69db41113d09f2395/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala#L314-L319

Or could we directly remove opaque from def getExtraModifiers()?

cc @Florian3k

KacperFKorban commented 1 month ago

@mbovel Yes, it seems like the correct solution. (I meant the one in parseObject :sweat_smile:)

Florian3k commented 1 month ago

Filtering should be fine. Not so sure about removing it from getExtraModifiers.