Skip to content
New issue

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

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

Already on GitHub? # to your account

scaladoc comment for multiple enum cases is silently ignored without any warning #16610

Closed
unkarjedy opened this issue Jan 3, 2023 · 2 comments · Fixed by #19555
Closed

scaladoc comment for multiple enum cases is silently ignored without any warning #16610

unkarjedy opened this issue Jan 3, 2023 · 2 comments · Fixed by #19555

Comments

@unkarjedy
Copy link
Contributor

Compiler version

ThisBuild / version := "0.1.0-SNAPSHOT"

ThisBuild / scalaVersion := "3.2.1"

lazy val root = (project in file("."))
  .settings(
    name := "untitled380"
  )

Minimized code

/**
 * Description of enum
 */
enum MyEnum {

  /**
   * Description of case 1
   */
  case MyCase1

  /**
   * Description of case 1 and 3
   */
  case MyCase2, MyCase3
}

Run sbt doc
Notice that no documentation will be generated for MyCase2 and MyCase3:

This is kinda expected (to some degree), for example because scala doc could contain references to parameters and type parameters:

/**
 * @param myParameter parameter description
 * @tparam MyTypeParameter type parameter description
 *
 */
enum TestEnum[MyTypeParameter](myParameter: Int) {
  /**
   * @param myParameterInner42 parameter description
   * @tparam MyTypeParameterInner type parameter description
   */
  case EnumMember[MyTypeParameterInner](myParameterInner42: Int)
    extends TestEnum[MyTypeParameterInner](myParameterInner42)
}

Expectation

At least some warning should be printed during sbt doc.
Something like "Scaladoc at position ... was ignored because..."

Actual result

The comment is silently ignored without any warning

@unkarjedy unkarjedy added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 3, 2023
@unkarjedy
Copy link
Contributor Author

Noticed while fixing https://youtrack.jetbrains.com/issue/SCL-20892

@szymon-rd szymon-rd added area:doctool and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 4, 2023
@Dedelweiss
Copy link
Contributor

Hello @unkarjedy, during my research on your problem, with @ckipp01, we noticed that the comment deletion as in your example was not done during the generation of Scaladoc but well before.

As you can see in the screenshot below, the comment is not already present in the TASTY file of our code. So when our scaladoc is generated with "sbt doc" for example, it already has no idea of the existence of this comment, which makes the warning at scaladoc generation time impossible.

One of the secondary solutions would be to send a warning when the comment is deleted at compile time, but this is no longer relevant to the generation of the scaladoc.

Screenshot 2023-03-17 at 13 58 06

i10416 added a commit to i10416/dotty that referenced this issue Jan 28, 2024
Before this commit, the compiler ignored Scaladoc comment on multiple
enum cases without warning.

This is partly expected because the case to which the doc is attached is ambiguous,
but we should at least warn users that the comment is ignored by compiler due to
ambiguity and they should take an action if they want the doc to be displayed.
i10416 added a commit to i10416/dotty that referenced this issue Jan 28, 2024
Before this commit, the compiler ignored Scaladoc comment on multiple
enum cases without warning.

This is partly expected because the case to which the doc is attached is ambiguous,
but we should at least warn users that the comment is ignored by compiler due to
ambiguity and they should take an action if they want the doc to be displayed.
Florian3k pushed a commit that referenced this issue Mar 11, 2024
close #16610 

Before this commit, the compiler ignored Scaladoc comment on multiple
enum cases without warning.

This is partly expected because the case to which the doc is attached is
ambiguous, but we should at least warn users that the comment is ignored
by compiler due to ambiguity and they should take an action if they want
the doc to be displayed.
@Kordyjan Kordyjan added this to the 3.4.2 milestone Mar 28, 2024
@Kordyjan Kordyjan modified the milestones: 3.4.2, 3.5.0 May 10, 2024
WojciechMazur added a commit that referenced this issue Jul 2, 2024
close #16610 

Before this commit, the compiler ignored Scaladoc comment on multiple
enum cases without warning.

This is partly expected because the case to which the doc is attached is
ambiguous, but we should at least warn users that the comment is ignored
by compiler due to ambiguity and they should take an action if they want
the doc to be displayed.
[Cherry-picked 11a6f0a][modified]
WojciechMazur added a commit that referenced this issue Jul 3, 2024
…to LTS (#20983)

Backports #19555 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants