Skip to content

ScalaDoc shows wrong type for this.type #16024

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

Closed
odersky opened this issue Sep 12, 2022 · 1 comment · Fixed by #17213
Closed

ScalaDoc shows wrong type for this.type #16024

odersky opened this issue Sep 12, 2022 · 1 comment · Fixed by #17213

Comments

@odersky
Copy link
Contributor

odersky commented Sep 12, 2022

Compiler version

3.2.1 RC-1

Minimized example

In Tuple.scala:

  inline def map[F[_]](f: [t] => t => F[t]): Map[this.type, F] =
    runtime.Tuples.map(this, f).asInstanceOf[Map[this.type, F]]

Output

Scaladoc output:

def map[F[_]](f: [t] => (x$1: t) => F[t]): Map[Tuple, F]

Expectation

this.type should be rendered as this.type, not Tuple. The two have very different meanings. I am not sure whether other singleton types are rendered correctly, we should check that as well.

@odersky odersky added stat:needs triage Every issue needs to have an "area" and "itype" label area:doctool itype:bug and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 12, 2022
@som-snytt
Copy link
Contributor

This rings a bell #15426 which is deemed fixed in June. Nightly docs shows that was fixed but not this report.

Florian3k added a commit that referenced this issue Jun 2, 2023
This PR introduces multiple fixes and improvements to type rendering in
Scaladoc

- Fixed rendering of TypeRefs (`A#B`) and TermRefs (`a.b.type`)
- Fixed rendering of `Tuple1[T]` (previously `(T)`)
- Fixed rendering of `this.type` (except for type bounds, see below)
- Types with `@showAsInfix` are rendered infix
- Correct parenthesizing around infix types, `&` types, `|` types and
function types
- Type parameters of superclasses in inherited methods are substituted
with actual types from inheriting class/trait (see
`scaladoc-testcases/src/tests/supertypeParamsSubstitution.scala`)

https://github.com/lampepfl/dotty/pull/17213/files#diff-93a78912075a9fdb34fefa437d191be59888cb723ccb244374e77033d9eca779R12-R20
- `this` and `type` are highlighted as keywords

fixes #16024
fixes #16143
fixed #16057
fixes #16084 (partially) - fixed rendering of `Int` instead of `n.type`
and `(This, n.type)` instead of `Split[This, n.type]`. `this.type` in
type bounds remains unfixed. I created separate issue for that #17226

Documentation with those changes has been deployed to
https://scala3doc.virtuslab.com/pr-types-rendering-fixes/scala3/api/index.html
@Kordyjan Kordyjan added this to the 3.4.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.

3 participants