File tree Expand file tree Collapse file tree 3 files changed +34
-4
lines changed
src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -1879,7 +1879,7 @@ object Parsers {
1879
1879
in.nextToken()
1880
1880
TypeDef (name, tparams, typ()).withMods(mods).setComment(docstring)
1881
1881
case SUPERTYPE | SUBTYPE | SEMI | NEWLINE | NEWLINES | COMMA | RBRACE | EOF =>
1882
- TypeDef (name, tparams, typeBounds()).withMods(mods)
1882
+ TypeDef (name, tparams, typeBounds()).withMods(mods).setComment(docstring)
1883
1883
case _ =>
1884
1884
syntaxErrorOrIncomplete(" `=', `>:', or `<:' expected" )
1885
1885
EmptyTree
Original file line number Diff line number Diff line change @@ -180,15 +180,15 @@ object Scanners {
180
180
/** All doc comments as encountered, each list contains doc comments from
181
181
* the same block level. Starting with the deepest level and going upward
182
182
*/
183
- private [this ] var docsPerBlockStack : List [List [Comment ]] = List (List () )
183
+ private [this ] var docsPerBlockStack : List [List [Comment ]] = List (Nil )
184
184
185
185
/** Adds level of nesting to docstrings */
186
186
def enterBlock (): Unit =
187
- docsPerBlockStack = Nil ::: docsPerBlockStack
187
+ docsPerBlockStack = List ( Nil ) ::: docsPerBlockStack
188
188
189
189
/** Removes level of nesting for docstrings */
190
190
def exitBlock (): Unit = docsPerBlockStack = docsPerBlockStack match {
191
- case x :: xs => List (List () )
191
+ case x :: Nil => List (Nil )
192
192
case _ => docsPerBlockStack.tail
193
193
}
194
194
Original file line number Diff line number Diff line change @@ -456,4 +456,34 @@ class DottyDocParsingTests extends DottyDocTest {
456
456
}
457
457
}
458
458
}
459
+
460
+ @ Test def withExtends = {
461
+ val source =
462
+ """
463
+ |trait Trait1
464
+ |/** Class1 */
465
+ |class Class1 extends Trait1
466
+ """ .stripMargin
467
+
468
+ import dotty .tools .dotc .ast .untpd ._
469
+ checkFrontend(source) {
470
+ case p @ PackageDef (_, Seq (_, c : TypeDef )) =>
471
+ checkDocString(c.rawComment, " /** Class1 */" )
472
+ }
473
+ }
474
+
475
+ @ Test def withAnnotation = {
476
+ val source =
477
+ """
478
+ |/** Class1 */
479
+ |@SerialVersionUID(1)
480
+ |class Class1
481
+ """ .stripMargin
482
+
483
+ import dotty .tools .dotc .ast .untpd ._
484
+ checkFrontend(source) {
485
+ case p @ PackageDef (_, Seq (c : TypeDef )) =>
486
+ checkDocString(c.rawComment, " /** Class1 */" )
487
+ }
488
+ }
459
489
} /* End class */
You can’t perform that action at this time.
0 commit comments