scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Scaladoc: Too many deprecated methods #11393

Open ashawley opened 5 years ago

ashawley commented 5 years ago

There are a bunch of methods listed as deprecated for List in 2.13. It doesn't appear they're actually deprecated. The method names are in the color green. Is it something to do with deprecations in IterableOnceExtensionMethods?

collectFirst
copyToBuffer
count
exists
filter
find
flatMap
foldLeft
foldRight
forall
foreach
isEmpty
map
[... 31 others]

These are implicit methods for List but they are not deprecated, and they should be shadowed in Scaladoc. This unnecessarily clutters up the Scaladocs but also dilutes the list of deprecated members. Granted, most people probably learn about their deprecations from interactive compiler warnings and not the api docs.

szeiger commented 5 years ago

In some cases like copyToBuffer the deprecated methods are legitimate. Others like collectFirst and count are listed twice, both as regular (non-deprecated) methods and as deprecated extension methods. This is another instance of https://github.com/scala/bug/issues/6110.

Jasper-M commented 5 years ago

The scaladoc also says they are shadowed, and mentions a way to call them anyway ((list: IterableOnceExtensionMethods[A]).count(f)).

szeiger commented 5 years ago

Yeah, it looks like this is not an actual bug in scaladoc (anymore). I didn't rerun #6110 but I assume it's in a similar state these days. scaladoc already gets the shadowing right, the real question is what to do with that information. Is it safe to assume that an instance method or extension methods "overrides" a shadowed, less specific extension method? Unlike overridden methods, these shadowed methods can still be called through a simple type ascription. Sorting the methods into deprecated and non-deprecated first and only mentioning shadowing individually makes it hard to convey this information.