Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScalaDoc : type parameter in extension method is wrong #12813

Closed
PaulCoral opened this issue Jun 13, 2021 · 3 comments · Fixed by #13191
Closed

ScalaDoc : type parameter in extension method is wrong #12813

PaulCoral opened this issue Jun 13, 2021 · 3 comments · Fixed by #13191
Assignees
Milestone

Comments

@PaulCoral
Copy link
Contributor

PaulCoral commented Jun 13, 2021

Compiler version

sbt 1.5.3 / scalaVersion 3.0.0 and 3.0.1-RC1

Minimized example

Start a new project sbt new scala/scala3.g8

/* src/main/scala/Main.scala */
@main def hello: Unit = 
  println(foo)

val foo: (Int,String) = 1.toTuple2("string")

extension [A](thiz:A)
  def toTuple2[B](that:B):(A,B) = thiz -> that /* <- HERE */

then run sbt doc, when finished open target/scala-3*/api/index.html in a browser and look for package <empty>.

Output

image

Expectation

Type parameter B is not present. Expecting the type paremeter of the method toTuple2 function to be [B]

@nicolasstucki
Copy link
Contributor

In tasty, the extension

extension [A](thiz:A)
  def toTuple2[B](that:B):(A,B) = thiz -> that /* <- HERE */

Is represented as

def toTuple2[A](thiz:A)[B](that:B):(A,B) = thiz -> that /* <- HERE */

To get the type parameters we need to drop the parameters until the thiz parameter and then possibly drop contextual/implicit parameters, then it might be followed by the desired type parameters.

@julienrf
Copy link
Contributor

Is anyone from the doctool team interested in taking this one?

@romanowski
Copy link
Contributor

romanowski commented Jun 15, 2021

Yes, me :)

@romanowski romanowski self-assigned this Jun 15, 2021
KacperFKorban added a commit to KacperFKorban/dotty that referenced this issue Jul 28, 2021
KacperFKorban added a commit to KacperFKorban/dotty that referenced this issue Jul 28, 2021
KacperFKorban added a commit to KacperFKorban/dotty that referenced this issue Jul 29, 2021
KacperFKorban added a commit to KacperFKorban/dotty that referenced this issue Jul 30, 2021
KacperFKorban added a commit to KacperFKorban/dotty that referenced this issue Jul 30, 2021
tanishiking pushed a commit to tanishiking/scala3 that referenced this issue Aug 10, 2021
@Kordyjan Kordyjan added this to the 3.1.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants