File tree Expand file tree Collapse file tree 3 files changed +67
-3
lines changed
src/compiler/scala/tools/nsc/ast/parser Expand file tree Collapse file tree 3 files changed +67
-3
lines changed Original file line number Diff line number Diff line change @@ -2967,10 +2967,10 @@ self =>
2967
2967
val annots = annotations(true )
2968
2968
val pos = in.offset
2969
2969
val mods = (localModifiers() | implicitMod) withAnnotations annots
2970
- val defs =
2970
+ val defs = joinComment( // for SI-5527
2971
2971
if (! (mods hasFlag ~ (Flags .IMPLICIT | Flags .LAZY ))) defOrDcl(pos, mods)
2972
- else List (tmplDef(pos, mods))
2973
-
2972
+ else List (tmplDef(pos, mods)))
2973
+
2974
2974
in.token match {
2975
2975
case RBRACE | CASE => defs :+ (Literal (Constant ()) setPos o2p(in.offset))
2976
2976
case _ => defs
Original file line number Diff line number Diff line change
1
+ [[syntax trees at end of parser]]// Scala source: newSource1
2
+ package <empty> {
3
+ abstract trait Test extends scala.ScalaObject {
4
+ def $init$() = {
5
+ ()
6
+ };
7
+ def sth: scala.Unit = {
8
+ /** Some comment here */
9
+ object Maybe extends scala.ScalaObject {
10
+ def <init>() = {
11
+ super.<init>();
12
+ ()
13
+ };
14
+ /** Some comment inside */
15
+ def nothing() = ()
16
+ };
17
+ ()
18
+ }
19
+ }
20
+ }
21
+
Original file line number Diff line number Diff line change
1
+ import scala .tools .partest ._
2
+ import java .io ._
3
+ import scala .tools .nsc ._
4
+ import scala .tools .nsc .util .CommandLineParser
5
+ import scala .tools .nsc .doc .{Settings , DocFactory }
6
+ import scala .tools .nsc .reporters .ConsoleReporter
7
+
8
+ object Test extends DirectTest {
9
+
10
+ override def extraSettings : String = " -usejavacp -Xprint:parser -Yrangepos -Ystop-after:parser -d " + testOutput.path
11
+
12
+ override def code = """
13
+ // SI-5527
14
+ trait Test {
15
+ def sth {
16
+ /** Some comment here */
17
+ object Maybe {
18
+ /** Some comment inside */
19
+ def nothing() = ()
20
+ }
21
+ }
22
+ }
23
+ """
24
+
25
+ override def show (): Unit = {
26
+ // redirect err to out, for logging
27
+ val prevErr = System .err
28
+ System .setErr(System .out)
29
+ compile()
30
+ System .setErr(prevErr)
31
+ }
32
+
33
+ override def newCompiler (args : String * ): Global = {
34
+ // we want the Scaladoc compiler here, because it keeps DocDef nodes in the tree
35
+ val settings = new Settings (_ => ())
36
+ val command = new ScalaDoc .Command ((CommandLineParser tokenize extraSettings) ++ args.toList, settings)
37
+ new DocFactory (new ConsoleReporter (settings), settings).compiler
38
+ }
39
+
40
+ override def isDebug = false // so we don't get the newSettings warning
41
+ }
42
+
43
+
You can’t perform that action at this time.
0 commit comments