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: Fix rendering dependent function types #14327

Merged
merged 3 commits into from Feb 15, 2022

Conversation

Sporarum
Copy link
Contributor

@Sporarum Sporarum commented Jan 22, 2022

A valid dependent function type, such as:
type J = (a: A) => a.type
is reported as:
type J = A => A { def apply(a: A): a; }

@pikinier20
Copy link
Contributor

pikinier20 commented Feb 2, 2022

Thank you for reporting this issue!
There were actually two or three things that overlapped:

  1. We didn't handle dependent function type desugaring
  2. We rendered TermParamRef's without .type suffix
  3. We check if applied type is a function and render it as A => B instead of Function1[A, B] which made this example look weird as if the return type had refinement.

Let's wait for the CI to pass. Locally, the example looks good:
image

@KacperFKorban Could you take a look at it?

@pikinier20 pikinier20 changed the title Add test where scaladoc fails due to dependent function types Scaladoc: Fix rendering dependent function types Feb 2, 2022
@pikinier20 pikinier20 marked this pull request as ready for review February 2, 2022 11:02
Copy link
Member

@KacperFKorban KacperFKorban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the following type be handled correctly?

type F = [A] => (a: A) => a.type

@pikinier20
Copy link
Contributor

type F = [A] => (a: A) => a.type

It works. Just in case I added the testcase to the tests.

@pikinier20 pikinier20 merged commit a98abb5 into scala:main Feb 15, 2022
@Sporarum Sporarum deleted the scaladoc-dependent-type branch August 24, 2022 07:27
@Kordyjan Kordyjan added this to the 3.1.3 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants