bug
bug copied to clipboard
ScalaDoc search doesn't always find type aliases?
(Apologies if this is the wrong place to mention this enhancement request.)
I spent about ten minutes discovering this one the hard way yesterday:
- Go into the 2.12 ScalaDocs
- Search for "TimeoutException"
- Nothing shows up.
It does exist in the standard library, as scala.concurrent.TimeoutException, but doesn't get picked up by search, apparently because it is an alias for java.util.concurrent.TimeoutException.
In the above case, the type alias is defined in a package object, and comes from Java; either or both of those might be involved in the fact that it doesn't show up at all.
Yup, another example: search for String.
Huh -- that one hadn't occurred to me, since I've always known that that was referring to Java String. But it's a good point: for a naive user, who isn't coming to Scala from Java, String is kind of magical and weird.
And the thing is, in both of these cases, it does show up in search -- but it shows up under "Member results" in small print, which isn't what one expects when looking for a type. It's actually really dramatic in the case of String, because it is buried in the middle of an enormous pile of results -- essentially unfindable unless you know where to look in the first place.
I understand why it works as it does -- it's logical and consistent -- but it isn't helpful. Types are important enough in Scala, and the difference between a "real" type and an alias so minor, that we should give folks more help with this. The user expectation is to see Types in the Entity Results column, since that's where they usually show up.
(And yes, I know there are problematic edge cases where the same type alias gets reused in a million places. I suspect some creative thought is needed here...)
I agree this is a problem.
This one should be pretty straightforward to fix. If someone wants to try, let me know and I can help you out to get started!
I don't see it in search (contrary to the follow-up comment?); at tim I see the entity compileTimeOnly and the member currentTime.
I couldn't reproduce with a trivial example; I thought it might be related to the issue about not showing members when the package has no entities. Also, TIL scaladoc calls them entities.
Huh -- interesting point. My earlier comment was based on String, which had just been pointed out -- that does show up, under Predef, if you know to look for it. But you're correct that TimeoutException, my original example, doesn't show at all (which explains why I was so mystified originally). Not sure what the difference is...
Maybe a duplicate of #10395
I've closed #10395 as a duplicate even though it's older, since this one has more discussion