diff options
author | Vlad Ureche <vlad.ureche@epfl.ch> | 2011-12-08 02:14:21 +0100 |
---|---|---|
committer | Vlad Ureche <vlad.ureche@epfl.ch> | 2011-12-08 02:14:21 +0100 |
commit | 4da259b26eb9d3409392fef91d36471cd7ac4354 (patch) | |
tree | 0fdbdc472631374c384be9f37d5848f125cddde1 /src/compiler | |
parent | 332fec96e31840878bed41dd7b5314b97d8da7c2 (diff) | |
download | scala-4da259b26eb9d3409392fef91d36471cd7ac4354.tar.gz scala-4da259b26eb9d3409392fef91d36471cd7ac4354.tar.bz2 scala-4da259b26eb9d3409392fef91d36471cd7ac4354.zip |
Fixed #5054, #5287
The documents with use cases should be restructured like:
/**
* The full definition, either used with an implicit value or with an explicit one.
*
* Some more explanation on implicits...
*
* @param lost a lost parameter
* @return some integer
*
* @usecase def test(): Int
*
* This takes the implicit value in scope.
*
* Example: `test()`
*
* @usecase def test(explicit: Int): Int
*
* This takes the explicit value passed.
*
* Example: `test(3)`
*/
def test(implicit lost: Int): Int
Diffstat (limited to 'src/compiler')
-rwxr-xr-x | src/compiler/scala/tools/nsc/ast/DocComments.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala | 20 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala index 9c598bca41..8d52a7bd2c 100755 --- a/src/compiler/scala/tools/nsc/ast/DocComments.scala +++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala @@ -101,7 +101,7 @@ trait DocComments { self: Global => def getUseCases(dc: DocComment) = { for (uc <- dc.useCases; defn <- uc.expandedDefs(site)) yield (defn, - expandVariables(merge(cookedDocComment(sym), uc.comment.raw, defn, copyFirstPara = true), sym, site), + expandVariables(merge(cookedDocComment(sym), uc.comment.raw, defn), sym, site), uc.pos) } getDocComment(sym) map getUseCases getOrElse List() diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala index a3b4dc4337..1fe96ed447 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -119,14 +119,18 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { else Public() } } - def flags = { - val fgs = mutable.ListBuffer.empty[Paragraph] - if (sym.isImplicit) fgs += Paragraph(Text("implicit")) - if (sym.isSealed) fgs += Paragraph(Text("sealed")) - if (!sym.isTrait && (sym hasFlag Flags.ABSTRACT)) fgs += Paragraph(Text("abstract")) - if (!sym.isTrait && (sym hasFlag Flags.DEFERRED)) fgs += Paragraph(Text("abstract")) - if (!sym.isModule && (sym hasFlag Flags.FINAL)) fgs += Paragraph(Text("final")) - fgs.toList + def flags = this match { + // workaround for uninitialized flags in use cases - see SI-5054 + case m: NonTemplateMemberEntity if (m.useCaseOf.isDefined) => + m.useCaseOf.get.flags + case _ => + val fgs = mutable.ListBuffer.empty[Paragraph] + if (sym.isImplicit) fgs += Paragraph(Text("implicit")) + if (sym.isSealed) fgs += Paragraph(Text("sealed")) + if (!sym.isTrait && (sym hasFlag Flags.ABSTRACT)) fgs += Paragraph(Text("abstract")) + if (!sym.isTrait && (sym hasFlag Flags.DEFERRED)) fgs += Paragraph(Text("abstract")) + if (!sym.isModule && (sym hasFlag Flags.FINAL)) fgs += Paragraph(Text("final")) + fgs.toList } def deprecation = if (sym.isDeprecated) |