summaryrefslogtreecommitdiff
path: root/test/scaladoc
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2013-04-17 13:11:18 -0700
committerSom Snytt <som.snytt@gmail.com>2013-04-17 13:50:42 -0700
commit3f0a90bd53cd1fc85891cf2673318c3a91f713bc (patch)
tree54e7b6b0a14715e104115098730e256a2840862c /test/scaladoc
parent0fde95e6a4c0659a59519399573ece0e684be660 (diff)
downloadscala-3f0a90bd53cd1fc85891cf2673318c3a91f713bc.tar.gz
scala-3f0a90bd53cd1fc85891cf2673318c3a91f713bc.tar.bz2
scala-3f0a90bd53cd1fc85891cf2673318c3a91f713bc.zip
SI-7376 Unmoored doc has correct position
The unmoored DocComment is created more eagerly so that its position is correct despite subsequent line comments. (Previously, skipComment would advance docPos.) It looks like the error caret is still off by one when a doc comment shows up in the middle of an operator, and who doesn't scaladoc the interior of expressions? Another bug fixed by Paul's refactor is that additional comments between the doc and the entity no longer breaks the scaladoc. Test added.
Diffstat (limited to 'test/scaladoc')
-rw-r--r--test/scaladoc/run/t5527.check20
-rw-r--r--test/scaladoc/run/t5527.scala25
2 files changed, 44 insertions, 1 deletions
diff --git a/test/scaladoc/run/t5527.check b/test/scaladoc/run/t5527.check
index 54595652cd..235e73b5c8 100644
--- a/test/scaladoc/run/t5527.check
+++ b/test/scaladoc/run/t5527.check
@@ -1,6 +1,12 @@
newSource1:47: warning: discarding unmoored doc comment
/** Document this crucial constant for posterity.
^
+newSource1:64: warning: discarding unmoored doc comment
+ /*************************\
+ ^
+newSource1:73: warning: discarding unmoored doc comment
+ val i = 10 */** Important!
+ ^
[[syntax trees at end of parser]] // newSource1
package <empty> {
object UselessComments extends scala.AnyRef {
@@ -54,6 +60,14 @@ package <empty> {
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 */
@@ -108,7 +122,11 @@ package <empty> {
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
index af0c1f8d36..60ae23c1a7 100644
--- a/test/scaladoc/run/t5527.scala
+++ b/test/scaladoc/run/t5527.scala
@@ -72,6 +72,24 @@ object Test extends DirectTest {
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 */
@@ -108,6 +126,13 @@ object Test extends DirectTest {
/** 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