summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/compiler/scala/tools/nsc/ast/DocComments.scala10
-rw-r--r--test/scaladoc/resources/Trac3484.scala27
-rw-r--r--test/scaladoc/scala/html/HtmlFactoryTest.scala24
3 files changed, 58 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala
index 9af43d406f..b0c7bd81cc 100755
--- a/src/compiler/scala/tools/nsc/ast/DocComments.scala
+++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala
@@ -213,14 +213,17 @@ trait DocComments { self: SymbolTable =>
* @param owner The current owner in which variable definitions are searched.
* @param site The class for which doc comments are generated
*/
- def lookupVariable(vble: String, site: Symbol): Option[String] =
+ def lookupVariable(vble: String, site: Symbol): Option[String] = {
+ val WITH_DOLLER = "^\\$(.*)$".r
if (site == NoSymbol)
None
else {
def lookInBaseClasses = mapFind(site.info.baseClasses)(defs(_).get(vble)) match {
case None => lookupVariable(vble, site.owner)
- case someStr => someStr
+ case Some(WITH_DOLLER(str)) => lookupVariable(str, site)
+ case Some(str) => Some(str)
}
+
if (site.isModule)
defs(site).get(vble) match {
case Some(str) => return Some(str)
@@ -228,6 +231,7 @@ trait DocComments { self: SymbolTable =>
}
else lookInBaseClasses
}
+ }
/** Expand variable occurrences in string `str', until a fix point is reached or
* a expandLimit is exceeded.
@@ -437,4 +441,4 @@ trait DocComments { self: SymbolTable =>
}
class ExpansionLimitExceeded(str: String) extends Exception
-} \ No newline at end of file
+}
diff --git a/test/scaladoc/resources/Trac3484.scala b/test/scaladoc/resources/Trac3484.scala
new file mode 100644
index 0000000000..9656ec268d
--- /dev/null
+++ b/test/scaladoc/resources/Trac3484.scala
@@ -0,0 +1,27 @@
+class cbf[A, B, C]
+
+/**
+ * @define Coll Traversable
+ * @define bfreturn $Coll
+ */
+class Collection[A] {
+ /** What map does...
+ *
+ * $bfreturn
+ * @usecase def map[B](f: A => B): $bfreturn[B]
+ *
+ */
+ def map[B, That](f: A => B)(implicit fact: cbf[Collection[A], B, That]) =
+ null
+}
+
+/**
+ * @define b John
+ * @define a Mister $b
+ */
+class SR704 {
+ /**
+ * Hello $a.
+ */
+ def foo = 123
+}
diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala
index ab76cbc7fc..46267bff3f 100644
--- a/test/scaladoc/scala/html/HtmlFactoryTest.scala
+++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala
@@ -154,4 +154,28 @@ object Test extends Properties("HtmlFactory") {
case _ => false
}
}
+
+ property("Trac #3484") = {
+ val files = createTemplates("Trac3484.scala")
+
+ files("Collection.html") match {
+ case node: scala.xml.Node => {
+ val s = node.toString
+ s.contains("""<span class="result">: Traversable[B]</span>""")
+ }
+ case _ => false
+ }
+ }
+
+ property("Trac #3484 - SR704") = {
+ val files = createTemplates("Trac3484.scala")
+
+ files("SR704.html") match {
+ case node: scala.xml.Node => {
+ val s = node.toString
+ s.contains("Hello Mister John.")
+ }
+ case _ => false
+ }
+ }
}