scala / scala3

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

Scaladoc documents "implicitly added" methods which are shadowed #17599

Open Sporarum opened 1 year ago

Sporarum commented 1 year ago

Example, method == in Int: https://scala-lang.org/api/3.x/scala/Int.html#

What seems to be happening:

In the case where:

Method f is documented twice in A, even though B's can never be called

Expectation

Only methods which are actually callable should be displayed

Or if we want to keep this information somewhere, there should be a section at the very end grouping all of these, like "Implicitly added, but shadowed by explicit members", potentially folded by default

Sporarum commented 1 year ago

I said of the same signature, but we could refine it further if we wanted, I believe the actual condition would be something like:

There exists no arguments such that A.f is not applicable to them, but B.f is

Or

There are no arguments such that B.f is more specific than A.f

Depending on wether we search for implicit conversion only if there are no applicable overrides or not

som-snytt commented 1 year ago

This may be https://github.com/lampepfl/dotty/issues/15853 ? I don't remember the details, but it rang a bell.

Sporarum commented 1 year ago

They seem very similar but slightly different, I believe my proposed solutions above would solve both ?