Skip to content

Scaladoc: Fix rendering dependent function types - #14327

Merged
pikinier20 merged 3 commits into
scala:mainfrom
Sporarum:scaladoc-dependent-type
Feb 15, 2022
Merged

Scaladoc: Fix rendering dependent function types#14327
pikinier20 merged 3 commits into
scala:mainfrom
Sporarum:scaladoc-dependent-type

Conversation

@Sporarum

@Sporarum Sporarum commented Jan 22, 2022

Copy link
Copy Markdown
Contributor

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

pikinier20 commented Feb 2, 2022

Copy link
Copy Markdown
Contributor

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

@KacperFKorban KacperFKorban left a comment

Copy link
Copy Markdown
Member

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
pikinier20 force-pushed the scaladoc-dependent-type branch from f91033a to f2888c4 Compare February 15, 2022 12:05
@pikinier20

Copy link
Copy Markdown
Contributor
type F = [A] => (a: A) => a.type

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

@pikinier20
pikinier20 enabled auto-merge February 15, 2022 12:06
@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.

4 participants