-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#16610): warn Scaladoc on multiple cases
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.
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Warning: tests/warn/i16610.scala:11:2 ------------------------------------------------------------------------------- | ||
11 | /** // warn | ||
| ^ | ||
| Ambiguous Scaladoc comment on multiple cases is ignored. | ||
| Remove the comment or make separate cases to add Scaladoc comments to each of them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Description of enum | ||
*/ | ||
enum MyEnum { | ||
|
||
/** | ||
* Description of case 1 | ||
*/ | ||
case MyCase1 | ||
|
||
/** // warn | ||
* Description of case 2 and 3 | ||
*/ | ||
case MyCase2, MyCase3 | ||
} |