Skip to content

scaladoc displays incorrect type for implicitly-added and shadowed methods #23720

@katrinafyi

Description

@katrinafyi

Compiler version

3.3.6

Minimized code

object X {
  trait Arbitrary[T] {
    def f: Some[T]
  }

  implicit def arbList[T](implicit a: Arbitrary[T]): Arbitrary[List[T]] = ???
}

paste this into a scala file then run scaladoc

this can also be seen in scaladocs for scalacheck.

Output

on the page for trait Arbitrary[T], we see

Image which is confusing because (1) the methods have identical signatures, and (2) the return type for the implicitly-added method is simply wrong.

Expectation

the implicitly-added method actually comes from an Arbitrary[List[T]] and so the return type of its f should be Some[List[T]].

this is related to #17599 but the incorrect typing is new. as noted there, the "implicitly added" methods are actually not callable. so, if you try to use x.f, you will get a value of type Some[T] which matches the scaladoc. but then, it is incorrect to say that a method with such a signature is provided by arbList - it is not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions