summaryrefslogtreecommitdiff
path: root/test/scaladoc/run
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-05-17 17:01:20 +0200
committerPaul Phillips <paulp@improving.org>2013-05-17 11:16:39 -0700
commitb7c352a57f65458c66c78a368f75aaaa4a08e443 (patch)
tree4b2b7fcea439948c5de65b05a392091a66eea0a4 /test/scaladoc/run
parent4f8c306aca703c63282295c9f74f0cb35f9f85d4 (diff)
parentbe405eed9bef9736f0142d6ddf53b6bf8af08696 (diff)
downloadscala-b7c352a57f65458c66c78a368f75aaaa4a08e443.tar.gz
scala-b7c352a57f65458c66c78a368f75aaaa4a08e443.tar.bz2
scala-b7c352a57f65458c66c78a368f75aaaa4a08e443.zip
Merge v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-master
================================================================ Merge commit 'v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-master Conflicts: src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala src/reflect/scala/reflect/runtime/JavaMirrors.scala ================================================================ Merge -s ours 4e64a27 ([nomaster commit range]) ================================================================ Merge commit '0ae7e55' into merge/v2.10.1-326-g4f8c306-to-master Conflicts: src/compiler/scala/tools/nsc/typechecker/Macros.scala
Diffstat (limited to 'test/scaladoc/run')
-rwxr-xr-xtest/scaladoc/run/SI-191-deprecated.check1
-rwxr-xr-xtest/scaladoc/run/SI-191-deprecated.scala72
-rw-r--r--test/scaladoc/run/SI-6812.scala24
-rw-r--r--test/scaladoc/run/implicits-base.scala148
-rw-r--r--test/scaladoc/run/links.scala2
-rw-r--r--test/scaladoc/run/t5527.check132
-rw-r--r--test/scaladoc/run/t5527.scala155
7 files changed, 362 insertions, 172 deletions
diff --git a/test/scaladoc/run/SI-191-deprecated.check b/test/scaladoc/run/SI-191-deprecated.check
deleted file mode 100755
index 3925a0d464..0000000000
--- a/test/scaladoc/run/SI-191-deprecated.check
+++ /dev/null
@@ -1 +0,0 @@
-Done. \ No newline at end of file
diff --git a/test/scaladoc/run/SI-191-deprecated.scala b/test/scaladoc/run/SI-191-deprecated.scala
deleted file mode 100755
index 4ed24ff8d1..0000000000
--- a/test/scaladoc/run/SI-191-deprecated.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-import scala.tools.nsc.doc.model._
-import scala.tools.nsc.doc.base._
-import scala.tools.nsc.doc.base.comment._
-import scala.tools.partest.ScaladocModelTest
-import java.net.{URI, URL}
-import java.io.File
-
-object Test extends ScaladocModelTest {
-
- override def code =
- """
- /** See:
- * - [[scala.collection.Map]] Simple linking
- * - [[scala.collection.immutable.::]] Linking with symbolic name
- * - [[scala.Int]].toLong Linking to a class
- * - [[scala.Predef]] Linking to an object
- * - [[scala.Int.toLong]] Linking to a method
- * - [[scala]] Linking to a package
- * - [[scala.AbstractMethodError]] Linking to a member in the package object
- * - [[scala.Predef.String]] Linking to a member in an object
- *
- * Don't look at:
- * - [[scala.NoLink]] Not linking :)
- */
- object Test {
- def foo(param: Any) {}
- def barr(l: scala.collection.immutable.List[Any]) {}
- def bar(l: List[String]) {} // TODO: Should be able to link to type aliases
- def baz(d: java.util.Date) {} // Should not be resolved
- }
- """
-
- def scalaURL = "http://bog.us"
-
- override def scaladocSettings = "-no-link-warnings -external-urls scala=" + scalaURL
-
- def testModel(rootPackage: Package) {
- import access._
- val test = rootPackage._object("Test")
-
- def check(memberDef: Def, expected: Int) {
- val externals = memberDef.valueParams(0)(0).resultType.refEntity collect {
- case (_, (LinkToExternal(name, url), _)) => assert(url.contains(scalaURL)); name
- }
- assert(externals.size == expected)
- }
-
- check(test._method("foo"), 1)
- check(test._method("bar"), 0)
- check(test._method("barr"), 2)
- check(test._method("baz"), 0)
-
- val expectedUrls = collection.mutable.Set[String](
- "scala.collection.Map",
- "scala.collection.immutable.::",
- "scala.Int",
- "scala.Predef$",
- "scala.Int@toLong:Long",
- "scala.package",
- "scala.package@AbstractMethodError=AbstractMethodError",
- "scala.Predef$@String=String"
- ).map(scalaURL + "/index.html#" + _)
-
- def isExpectedExternalLink(l: EntityLink) = l.link match {
- case LinkToExternal(name, url) => assert(expectedUrls contains url, url); true
- case _ => false
- }
-
- assert(countLinks(test.comment.get, isExpectedExternalLink) == 8,
- countLinks(test.comment.get, isExpectedExternalLink) + " == 8")
- }
-}
diff --git a/test/scaladoc/run/SI-6812.scala b/test/scaladoc/run/SI-6812.scala
deleted file mode 100644
index fbd9588ede..0000000000
--- a/test/scaladoc/run/SI-6812.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-import scala.tools.nsc.doc.model._
-import scala.tools.partest.ScaladocModelTest
-import language._
-
-object Test extends ScaladocModelTest {
-
- override def code = """
- import scala.reflect.macros.Context
- import language.experimental.macros
-
- object Macros {
- def impl(c: Context) = c.literalUnit
- def foo = macro impl
- }
-
- class C {
- def bar = Macros.foo
- }
- """
-
- def scaladocSettings = ""
- override def extraSettings = super.extraSettings + " -Ymacro-no-expand"
- def testModel(root: Package) = ()
-}
diff --git a/test/scaladoc/run/implicits-base.scala b/test/scaladoc/run/implicits-base.scala
index 3d57306f5d..8f8652cdb3 100644
--- a/test/scaladoc/run/implicits-base.scala
+++ b/test/scaladoc/run/implicits-base.scala
@@ -25,54 +25,54 @@ object Test extends ScaladocModelTest {
val A = base._class("A")
- // def convToPimpedA(x: T) // pimpA0: with no constraints, SHADOWED
- conv = A._conversion(A.qualifiedName + ".pimpA0")
+ // def convToEnrichedA(x: T) // enrichA0: with no constraints, SHADOWED
+ conv = A._conversion(A.qualifiedName + ".enrichA0")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "T")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "T")
- // def convToNumericA: T // pimpA1: with a constraint that there is x: Numeric[T] implicit in scope
- conv = A._conversion(A.qualifiedName + ".pimpA1")
+ // def convToNumericA: T // enrichA1: with a constraint that there is x: Numeric[T] implicit in scope
+ conv = A._conversion(A.qualifiedName + ".enrichA1")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToNumericA").resultType.name == "T")
- // def convToIntA: Int // pimpA2: with a constraint that T = Int
- conv = A._conversion(A.qualifiedName + ".pimpA2")
+ // def convToIntA: Int // enrichA2: with a constraint that T = Int
+ conv = A._conversion(A.qualifiedName + ".enrichA2")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToIntA").resultType.name == "Int")
- // def convToGtColonDoubleA: Double // pimpA3: with a constraint that T <: Double
- conv = A._conversion(A.qualifiedName + ".pimpA3")
+ // def convToGtColonDoubleA: Double // enrichA3: with a constraint that T <: Double
+ conv = A._conversion(A.qualifiedName + ".enrichA3")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToGtColonDoubleA").resultType.name == "Double")
- // def convToPimpedA: S // pimpA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar
- conv = A._conversion(A.qualifiedName + ".pimpA4")
+ // def convToEnrichedA: S // enrichA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar
+ conv = A._conversion(A.qualifiedName + ".enrichA4")
assert(conv.members.length == 1)
assert(conv.constraints.length == 3)
- assert(conv._member("convToPimpedA").resultType.name == "S")
+ assert(conv._member("convToEnrichedA").resultType.name == "S")
- // def convToPimpedA: Bar[Foo[T]] // pimpA5: no constraints
- conv = A._conversion(A.qualifiedName + ".pimpA5")
+ // def convToEnrichedA: Bar[Foo[T]] // enrichA5: no constraints
+ conv = A._conversion(A.qualifiedName + ".enrichA5")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[T]]")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[T]]")
- // def convToMyNumericA: T // pimpA6: with a constraint that there is x: MyNumeric[T] implicit in scope
- conv = A._conversion(A.qualifiedName + ".pimpA6")
+ // def convToMyNumericA: T // enrichA6: with a constraint that there is x: MyNumeric[T] implicit in scope
+ conv = A._conversion(A.qualifiedName + ".enrichA6")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToMyNumericA").resultType.name == "T")
- // def convToManifestA: T // pimpA7: with 2 constraints: T: Manifest and T <: Double
- // def convToTraversableOps: T // pimpA7: with 2 constraints: T: Manifest and T <: Double
+ // def convToManifestA: T // enrichA7: with 2 constraints: T: Manifest and T <: Double
+ // def convToTraversableOps: T // enrichA7: with 2 constraints: T: Manifest and T <: Double
// should not be abstract!
- conv = A._conversion(A.qualifiedName + ".pimpA7")
+ conv = A._conversion(A.qualifiedName + ".enrichA7")
assert(conv.members.length == 2)
assert(conv.constraints.length == 2)
assert(conv._member("convToManifestA").resultType.name == "T")
@@ -84,45 +84,45 @@ object Test extends ScaladocModelTest {
val B = base._class("B")
// these conversions should not affect B
- assert(B._conversions(A.qualifiedName + ".pimpA2").isEmpty)
- assert(B._conversions(A.qualifiedName + ".pimpA4").isEmpty)
+ assert(B._conversions(A.qualifiedName + ".enrichA2").isEmpty)
+ assert(B._conversions(A.qualifiedName + ".enrichA4").isEmpty)
- // def convToPimpedA(x: Double) // pimpA0: no constraints, SHADOWED
- conv = B._conversion(A.qualifiedName + ".pimpA0")
+ // def convToEnrichedA(x: Double) // enrichA0: no constraints, SHADOWED
+ conv = B._conversion(A.qualifiedName + ".enrichA0")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Double")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Double")
- // def convToNumericA: Double // pimpA1: no constraintsd
- conv = B._conversion(A.qualifiedName + ".pimpA1")
+ // def convToNumericA: Double // enrichA1: no constraintsd
+ conv = B._conversion(A.qualifiedName + ".enrichA1")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
assert(conv._member("convToNumericA").resultType.name == "Double")
- // def convToGtColonDoubleA: Double // pimpA3: no constraints
- conv = B._conversion(A.qualifiedName + ".pimpA3")
+ // def convToGtColonDoubleA: Double // enrichA3: no constraints
+ conv = B._conversion(A.qualifiedName + ".enrichA3")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
assert(conv._member("convToGtColonDoubleA").resultType.name == "Double")
- // def convToPimpedA: Bar[Foo[Double]] // pimpA5: no constraints
- conv = B._conversion(A.qualifiedName + ".pimpA5")
+ // def convToEnrichedA: Bar[Foo[Double]] // enrichA5: no constraints
+ conv = B._conversion(A.qualifiedName + ".enrichA5")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[Double]]")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[Double]]")
- // def convToMyNumericA: Double // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope
- conv = B._conversion(A.qualifiedName + ".pimpA6")
+ // def convToMyNumericA: Double // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope
+ conv = B._conversion(A.qualifiedName + ".enrichA6")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToMyNumericA").resultType.name == "Double")
- // def convToManifestA: Double // pimpA7: no constraints
- // def convToTraversableOps: Double // pimpA7: no constraints
+ // def convToManifestA: Double // enrichA7: no constraints
+ // def convToTraversableOps: Double // enrichA7: no constraints
// // should not be abstract!
- conv = B._conversion(A.qualifiedName + ".pimpA7")
+ conv = B._conversion(A.qualifiedName + ".enrichA7")
assert(conv.members.length == 2)
assert(conv.constraints.length == 0)
assert(conv._member("convToManifestA").resultType.name == "Double")
@@ -134,38 +134,38 @@ object Test extends ScaladocModelTest {
val C = base._class("C")
// these conversions should not affect C
- assert(C._conversions(A.qualifiedName + ".pimpA3").isEmpty)
- assert(C._conversions(A.qualifiedName + ".pimpA4").isEmpty)
- assert(C._conversions(A.qualifiedName + ".pimpA7").isEmpty)
+ assert(C._conversions(A.qualifiedName + ".enrichA3").isEmpty)
+ assert(C._conversions(A.qualifiedName + ".enrichA4").isEmpty)
+ assert(C._conversions(A.qualifiedName + ".enrichA7").isEmpty)
- // def convToPimpedA(x: Int) // pimpA0: no constraints, SHADOWED
- conv = C._conversion(A.qualifiedName + ".pimpA0")
+ // def convToEnrichedA(x: Int) // enrichA0: no constraints, SHADOWED
+ conv = C._conversion(A.qualifiedName + ".enrichA0")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Int")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Int")
- // def convToNumericA: Int // pimpA1: no constraints
- conv = C._conversion(A.qualifiedName + ".pimpA1")
+ // def convToNumericA: Int // enrichA1: no constraints
+ conv = C._conversion(A.qualifiedName + ".enrichA1")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
assert(conv._member("convToNumericA").resultType.name == "Int")
- // def convToIntA: Int // pimpA2: no constraints
- conv = C._conversion(A.qualifiedName + ".pimpA2")
+ // def convToIntA: Int // enrichA2: no constraints
+ conv = C._conversion(A.qualifiedName + ".enrichA2")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
assert(conv._member("convToIntA").resultType.name == "Int")
- // def convToPimpedA: Bar[Foo[Int]] // pimpA5: no constraints
- conv = C._conversion(A.qualifiedName + ".pimpA5")
+ // def convToEnrichedA: Bar[Foo[Int]] // enrichA5: no constraints
+ conv = C._conversion(A.qualifiedName + ".enrichA5")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[Int]]")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[Int]]")
- // def convToMyNumericA: Int // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope
- conv = C._conversion(A.qualifiedName + ".pimpA6")
+ // def convToMyNumericA: Int // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope
+ conv = C._conversion(A.qualifiedName + ".enrichA6")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToMyNumericA").resultType.name == "Int")
@@ -175,33 +175,33 @@ object Test extends ScaladocModelTest {
val D = base._class("D")
// these conversions should not affect D
- assert(D._conversions(A.qualifiedName + ".pimpA2").isEmpty)
- assert(D._conversions(A.qualifiedName + ".pimpA3").isEmpty)
- assert(D._conversions(A.qualifiedName + ".pimpA4").isEmpty)
- assert(D._conversions(A.qualifiedName + ".pimpA7").isEmpty)
+ assert(D._conversions(A.qualifiedName + ".enrichA2").isEmpty)
+ assert(D._conversions(A.qualifiedName + ".enrichA3").isEmpty)
+ assert(D._conversions(A.qualifiedName + ".enrichA4").isEmpty)
+ assert(D._conversions(A.qualifiedName + ".enrichA7").isEmpty)
- // def convToPimpedA(x: String) // pimpA0: no constraints, SHADOWED
- conv = D._conversion(A.qualifiedName + ".pimpA0")
+ // def convToEnrichedA(x: String) // enrichA0: no constraints, SHADOWED
+ conv = D._conversion(A.qualifiedName + ".enrichA0")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "String")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "String")
- // def convToNumericA: String // pimpA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope
- conv = D._conversion(A.qualifiedName + ".pimpA1")
+ // def convToNumericA: String // enrichA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope
+ conv = D._conversion(A.qualifiedName + ".enrichA1")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToNumericA").resultType.name == "String")
- // def convToPimpedA: Bar[Foo[String]] // pimpA5: no constraints
- conv = D._conversion(A.qualifiedName + ".pimpA5")
+ // def convToEnrichedA: Bar[Foo[String]] // enrichA5: no constraints
+ conv = D._conversion(A.qualifiedName + ".enrichA5")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[String]]")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[String]]")
- // def convToMyNumericA: String // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope
- conv = D._conversion(A.qualifiedName + ".pimpA6")
+ // def convToMyNumericA: String // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope
+ conv = D._conversion(A.qualifiedName + ".enrichA6")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToMyNumericA").resultType.name == "String")
diff --git a/test/scaladoc/run/links.scala b/test/scaladoc/run/links.scala
index fde24edb2a..64441c2d95 100644
--- a/test/scaladoc/run/links.scala
+++ b/test/scaladoc/run/links.scala
@@ -26,7 +26,7 @@ object Test extends ScaladocModelTest {
val memberLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToMember[_, _]])
val templateLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToTpl[_]])
- assert(memberLinks == 17, memberLinks + " == 17 (the member links in object TEST)")
+ assert(memberLinks == 18, memberLinks + " == 18 (the member links in object TEST)")
assert(templateLinks == 6, templateLinks + " == 6 (the template links in object TEST)")
}
}
diff --git a/test/scaladoc/run/t5527.check b/test/scaladoc/run/t5527.check
new file mode 100644
index 0000000000..bfaa4ad0ed
--- /dev/null
+++ b/test/scaladoc/run/t5527.check
@@ -0,0 +1,132 @@
+newSource1.scala:47: warning: discarding unmoored doc comment
+ /** Document this crucial constant for posterity.
+ ^
+newSource1.scala:64: warning: discarding unmoored doc comment
+ /*************************\
+ ^
+newSource1.scala:73: warning: discarding unmoored doc comment
+ val i = 10 */** Important!
+ ^
+[[syntax trees at end of parser]] // newSource1.scala
+package <empty> {
+ object UselessComments extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ var z = 0;
+ def test1 = {
+ object Maybe extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ /** Some comment inside */
+ def nothing() = ()
+ };
+ ()
+ };
+ def test2 = {
+ var x = 4;
+ if (true)
+ {
+ x = 5;
+ val y = 6;
+ ()
+ }
+ else
+ ()
+ };
+ def test3 = {
+ if (true)
+ z = 3
+ else
+ ();
+ val t = 4;
+ 0.to(4).foreach(((i) => println(i)))
+ };
+ val test4 = 'a' match {
+ case ('0'| '1'| '2'| '3'| '4'| '5'| '6'| '7'| '8'| '9') => true
+ case _ => false
+ };
+ def test5: scala.Unit = if (true)
+ $qmark$qmark$qmark
+ else
+ ();
+ def test6 = {
+ val u = 4;
+ 0.to(u).foreach(((i) => println(i)))
+ };
+ def test7 = {
+ val u = 4;
+ 0.to(u).foreach(((i) => println(i)))
+ };
+ def test8 = {
+ val z = "fancy";
+ z.replace("fanc", "arts")
+ };
+ def test9 = {
+ val i = 10.$times(10);
+ assert(i.$eq$eq(100))
+ }
+ };
+ /** comments that we should keep */
+ object UsefulComments extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ /** class A */
+ class A extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ /** f */
+ def f(i: Int) = i;
+ /** v */
+ val v = 1;
+ /** u */
+ var u = 2
+ };
+ /** trait B */
+ abstract trait B extends scala.AnyRef {
+ def $init$() = {
+ ()
+ };
+ /** T */
+ type T;
+ /** f */
+ def f(i: Int): scala.Unit;
+ /** v */
+ val v = 1;
+ /** u */
+ var u = 2
+ };
+ /** object C */
+ object C extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ /** f */
+ def f(i: Int) = i;
+ /** v */
+ val v = 1;
+ /** u */
+ var u = 2
+ };
+ /** class D */
+ @new deprecated("use ... instead", "2.10.0") class D extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ }
+ };
+ /** Get the simple value.
+ * @return the default value
+ */
+ def value: Int = 7
+ }
+}
+
diff --git a/test/scaladoc/run/t5527.scala b/test/scaladoc/run/t5527.scala
new file mode 100644
index 0000000000..60ae23c1a7
--- /dev/null
+++ b/test/scaladoc/run/t5527.scala
@@ -0,0 +1,155 @@
+import scala.tools.partest._
+import java.io._
+import scala.tools.nsc._
+import scala.tools.nsc.util.CommandLineParser
+import scala.tools.nsc.doc.{Settings, DocFactory}
+import scala.tools.nsc.reporters.ConsoleReporter
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -Xprint:parser -Yrangepos -Ystop-after:parser -d " + testOutput.path
+
+ override def code = """
+ // SI-5527
+ object UselessComments {
+
+ var z = 0
+
+ def test1 = {
+ /** Some comment here */
+ object Maybe {
+ /** Some comment inside */
+ def nothing() = ()
+ }
+ }
+
+ def test2 = {
+ var x = 4
+ if (true) {
+ /** Testing 123 */
+ x = 5
+ val y = 6
+ }
+ }
+
+ def test3 = {
+ if (true)
+ z = 3
+
+ /** Calculate this result. */
+ val t = 4
+ for (i <- 0 to 4)
+ println(i)
+ }
+
+ val test4 = ('a') match {
+ /** Another digit is a giveaway. */
+ case '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' =>
+ true
+ case _ =>
+ false
+ }
+
+ def test5 {
+ /** @martin is this right? It shouldn't flag me as scaladoc. */
+ if (true) ???
+ }
+
+ def test6 = {
+ /** Document this crucial constant for posterity.
+ * Don't forget to dedoc this comment if you refactor to a local.
+ * @author Paul Phillips
+ */
+ val u = 4
+ for (i <- 0 to u)
+ println(i)
+ }
+ def test7 = {
+ /** Some standard tags are tolerated locally and shouldn't trigger a warning.
+ * @note Don't change this unless you know what you're doing. This means you.
+ */
+ val u = 4
+ for (i <- 0 to u)
+ println(i)
+ }
+ def test8 = {
+ /*************************\
+ * Fancy ASCII Art Block *
+ * @author som-snytt *
+ \*************************/
+ // this is just a local
+ val z = "fancy"
+ z replace ("fanc", "arts")
+ }
+ def test9 = {
+ val i = 10 */** Important!
+ * We have to multiply here!
+ * @author community
+ * @see SI-1234
+ */
+ 10
+ assert(i == 100)
+ }
+ }
+
+ /** comments that we should keep */
+ object UsefulComments {
+ /** class A */
+ class A {
+ /** f */
+ def f(i: Int) = i
+ /** v */
+ val v = 1
+ /** u */
+ var u = 2
+ }
+ /** trait B */
+ trait B {
+ /** T */
+ type T
+ /** f */
+ def f(i: Int)
+ /** v */
+ val v = 1
+ /** u */
+ var u = 2
+ }
+ /** object C */
+ object C {
+ /** f */
+ def f(i: Int) = i
+ /** v */
+ val v = 1
+ /** u */
+ var u = 2
+ }
+ /** class D */
+ @deprecated("use ... instead", "2.10.0")
+ class D
+
+ /** Get the simple value.
+ * @return the default value
+ */
+ // an intervening line comment
+ /* I had more to say, but didn't want to pollute the scaladoc. */
+ def value: Int = 7
+ }
+ """.trim
+
+ override def show(): Unit = {
+ // redirect err to out, for logging
+ val prevErr = System.err
+ System.setErr(System.out)
+ compile()
+ System.setErr(prevErr)
+ }
+
+ override def newCompiler(args: String*): Global = {
+ // we want the Scaladoc compiler here, because it keeps DocDef nodes in the tree
+ val settings = new Settings(_ => ())
+ val command = new ScalaDoc.Command((CommandLineParser tokenize extraSettings) ++ args.toList, settings)
+ new DocFactory(new ConsoleReporter(settings), settings).compiler
+ }
+
+ override def isDebug = false // so we don't get the newSettings warning
+}