aboutsummaryrefslogtreecommitdiff
path: root/compiler/test
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-02-10 15:29:35 +0100
committerMartin Odersky <odersky@gmail.com>2017-04-04 13:29:38 +0200
commitcb3e536f954d7e9a3eea528b07ffb768537f1383 (patch)
tree53cab8de26fa24af18324aea3a08917ffdc4636d /compiler/test
parentc245600ed4bfd4af6f2b45e8cae2cf5a63ddeaf0 (diff)
downloaddotty-cb3e536f954d7e9a3eea528b07ffb768537f1383.tar.gz
dotty-cb3e536f954d7e9a3eea528b07ffb768537f1383.tar.bz2
dotty-cb3e536f954d7e9a3eea528b07ffb768537f1383.zip
Fix cheeky comment in nested scope
Diffstat (limited to 'compiler/test')
-rw-r--r--compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala30
1 files changed, 30 insertions, 0 deletions
diff --git a/compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala b/compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala
index 930ec117a..81ac77761 100644
--- a/compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala
+++ b/compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala
@@ -488,4 +488,34 @@ class DocstringTests extends DocstringTest {
checkDocString(c.rawComment.map(_.raw), "/** Class1 */")
}
}
+
+ @Test def nestedComment = {
+ val source =
+ """
+ |trait T {
+ | /** Cheeky comment */
+ |}
+ |class C
+ """.stripMargin
+
+ import dotty.tools.dotc.ast.untpd._
+ checkFrontend(source) {
+ case p @ PackageDef(_, Seq(_, c: TypeDef)) =>
+ assert(c.rawComment == None, s"class C is not supposed to have a docstring (${c.rawComment.get}) in:$source")
+ }
+ }
+
+ @Test def eofComment = {
+ val source =
+ """
+ |class C
+ |/** Cheeky comment */
+ """.stripMargin
+
+ import dotty.tools.dotc.ast.untpd._
+ checkFrontend(source) {
+ case p @ PackageDef(_, Seq(c: TypeDef)) =>
+ assert(c.rawComment == None, s"class C is not supposed to have a docstring (${c.rawComment.get}) in:$source")
+ }
+ }
} /* End class */