aboutsummaryrefslogtreecommitdiff
path: root/dottydoc
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-08-27 00:30:07 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-10-06 17:45:12 +0200
commit5463b7a9d42ece31409526ce192d263f7f55e047 (patch)
treebbdacab4ef724e42a45f3e59c0fa8acdf3ba3b3e /dottydoc
parentea24c55fdc7b3310a7f9911b408647701b5799fa (diff)
downloaddotty-5463b7a9d42ece31409526ce192d263f7f55e047.tar.gz
dotty-5463b7a9d42ece31409526ce192d263f7f55e047.tar.bz2
dotty-5463b7a9d42ece31409526ce192d263f7f55e047.zip
Fix cooking of docstrings
Diffstat (limited to 'dottydoc')
-rw-r--r--dottydoc/src/dotty/tools/dottydoc/DottyDoc.scala2
-rw-r--r--dottydoc/src/dotty/tools/dottydoc/model/comment/CommentExpander.scala2
-rw-r--r--dottydoc/test/BaseTest.scala2
-rw-r--r--dottydoc/test/UsecaseTest.scala43
4 files changed, 46 insertions, 3 deletions
diff --git a/dottydoc/src/dotty/tools/dottydoc/DottyDoc.scala b/dottydoc/src/dotty/tools/dottydoc/DottyDoc.scala
index dd0bb0ec4..dc051279a 100644
--- a/dottydoc/src/dotty/tools/dottydoc/DottyDoc.scala
+++ b/dottydoc/src/dotty/tools/dottydoc/DottyDoc.scala
@@ -54,7 +54,7 @@ abstract class DocDriver extends Driver {
val summary = CompilerCommand.distill(args)(ctx)
ctx.setSettings(summary.sstate)
- ctx.setSetting(ctx.settings.YkeepComments, true)
+ ctx.setSetting(ctx.settings.Ydocrun, true)
val fileNames = CompilerCommand.checkUsage(summary, sourcesRequired)(ctx)
(fileNames, ctx)
diff --git a/dottydoc/src/dotty/tools/dottydoc/model/comment/CommentExpander.scala b/dottydoc/src/dotty/tools/dottydoc/model/comment/CommentExpander.scala
index 7e213c2f3..ece0d1018 100644
--- a/dottydoc/src/dotty/tools/dottydoc/model/comment/CommentExpander.scala
+++ b/dottydoc/src/dotty/tools/dottydoc/model/comment/CommentExpander.scala
@@ -47,7 +47,7 @@ trait CommentExpander {
val defines = sections filter { startsWithTag(raw, _, "@define") }
val usecases = sections filter { startsWithTag(raw, _, "@usecase") }
- val end = startTag(raw, (defines ::: usecases).sortBy(_._1))
+ val end = startTag(raw, (defines /*::: usecases*/).sortBy(_._1))
if (end == raw.length - 2) raw else raw.substring(0, end) + "*/"
}
diff --git a/dottydoc/test/BaseTest.scala b/dottydoc/test/BaseTest.scala
index 46a24c579..fa8e5d1e6 100644
--- a/dottydoc/test/BaseTest.scala
+++ b/dottydoc/test/BaseTest.scala
@@ -17,8 +17,8 @@ trait DottyTest {
import base.settings._
val ctx = base.initialCtx.fresh
ctx.setSetting(ctx.settings.language, List("Scala2"))
- ctx.setSetting(ctx.settings.YkeepComments, true)
ctx.setSetting(ctx.settings.YnoInline, true)
+ ctx.setSetting(ctx.settings.Ydocrun, true)
base.initialize()(ctx)
ctx
}
diff --git a/dottydoc/test/UsecaseTest.scala b/dottydoc/test/UsecaseTest.scala
index 2effb77fa..05bc8663f 100644
--- a/dottydoc/test/UsecaseTest.scala
+++ b/dottydoc/test/UsecaseTest.scala
@@ -141,6 +141,49 @@ class UsecaseTest extends DottyTest {
}
}
+ @Test def expandColl = {
+ val source = new SourceFile(
+ "ExpandColl.scala",
+ """
+ |package scala
+ |
+ |/** The trait $Coll
+ | *
+ | * @define Coll Iterable
+ | */
+ |trait Iterable[A] {
+ | /** Definition with a "disturbing" signature
+ | *
+ | * @usecase def map[B](f: A => B): $Coll[B]
+ | */
+ | def map[B, M[B]](f: A => B): M[B] = ???
+ |}
+ """.stripMargin
+ )
+
+ checkSources(source :: Nil) { packages =>
+ packages("scala") match {
+ case PackageImpl(_, _, List(trt: Trait), _, _) =>
+ val List(map: Def) = trt.members
+
+ val returnValue = map.returnValue match {
+ case ref: TypeReference => ref.title
+ case _ =>
+ assert(
+ false,
+ "Incorrect return value after usecase transformation"
+ )
+ ""
+ }
+
+ assert(
+ returnValue == "Iterable",
+ "Incorrect return type after usecase transformation"
+ )
+ }
+ }
+ }
+
@Test def checkIterator =
checkFiles("./scala-scala/src/library/scala/collection/Iterator.scala" :: Nil) { _ =>
// success if typer throws no errors! :)