-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9105 from forketyfork/2.13.x
Fixed scaladoc failure on @throws tag when -implicits flag is on
- Loading branch information
Showing
5 changed files
with
54 additions
and
8 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
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,9 @@ | ||
package scala.test.scaladoc.implicits.throws { | ||
|
||
/** | ||
* @throws java.lang.Exception exception | ||
*/ | ||
class A { | ||
} | ||
|
||
} |
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 @@ | ||
Done. |
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,37 @@ | ||
import scala.language._ | ||
import scala.tools.nsc.doc.base.comment.Text | ||
import scala.tools.nsc.doc.model._ | ||
import scala.tools.partest.ScaladocModelTest | ||
|
||
/** | ||
* Reproducer for https://github.com/scala/bug/issues/11021 | ||
* The @throws tag shouldn't cause an error when -implicits is enabled. | ||
*/ | ||
object Test extends ScaladocModelTest { | ||
|
||
// test a file instead of a piece of code | ||
override def resourceFile = "implicits-throws-res.scala" | ||
|
||
// start implicits | ||
def scaladocSettings = "-implicits" | ||
|
||
def testModel(root: Package) = { | ||
// get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) | ||
import access._ | ||
|
||
val base = root._package("scala")._package("test")._package("scaladoc")._package("implicits")._package("throws") | ||
|
||
val A = base._class("A") | ||
|
||
val expectedComment = "exception" | ||
|
||
A.comment | ||
.flatMap(comment => comment.throws.get("java.lang.Exception")) | ||
.flatMap(body => body.summary) match { | ||
case Some(Text(actualComment)) => | ||
assert(actualComment == expectedComment, s"Expected: $expectedComment, actual: $actualComment") | ||
case _ => | ||
assert(false, s"Failed to match the comment") | ||
} | ||
} | ||
} |