diff options
author | Vlad Ureche <vlad.ureche@gmail.com> | 2012-07-16 23:12:35 +0200 |
---|---|---|
committer | Vlad Ureche <vlad.ureche@gmail.com> | 2012-07-17 14:20:13 +0200 |
commit | dac4e8f543a8e2e3bacf447d327fc8a7e99acb49 (patch) | |
tree | 31c720a63ef9edd1608b7ed6511d2a6dfa77964d /test/scaladoc/resources | |
parent | 17f745d33cbda90aa552c95bc5456ed793180333 (diff) | |
download | scala-dac4e8f543a8e2e3bacf447d327fc8a7e99acb49.tar.gz scala-dac4e8f543a8e2e3bacf447d327fc8a7e99acb49.tar.bz2 scala-dac4e8f543a8e2e3bacf447d327fc8a7e99acb49.zip |
SI-5784 Scaladoc: {Abstract,Alias} type templates
Normally scaladoc won't generate template pages for anything other than
packages, classes, traits and objects. But using the @template
annotation on {abstract,alias} types, they get their own page and take
part as full members in the diagrams. Furthermore, when looking for the
companion object, if a value of type T is in scope, T will be taken as
the companion object (even though it might be a class)
All templates, including types are listed on the left navigation pane,
so now adding @template to String can get scaladoc to generate (a
no-comments) page for java.lang.String.
The {abstract, alias} type icons need to be updated -- I just took the
class icons and added a small x to them -- but they shoud be something
else (maybe an underscore?)i
TO USE THIS PATCH:
<pre>
/** @contentDiagram */ // tells scaladoc to create a diagram of the
// templates contained in trait Base
trait Base {
/** @template */ // tells scaladoc to create a page for Foo
type T < Foo
trait Foo { def foo: Int }
}
/** @contentDiagram */
trait Api extends Base {
/** @template */
override type T <: FooApi
trait FooApi extends Foo { def bar: String }
}
</pre>
Diffstat (limited to 'test/scaladoc/resources')
-rw-r--r-- | test/scaladoc/resources/SI-5784.scala | 28 | ||||
-rw-r--r-- | test/scaladoc/resources/doc-root/AnyRef.scala | 1 |
2 files changed, 29 insertions, 0 deletions
diff --git a/test/scaladoc/resources/SI-5784.scala b/test/scaladoc/resources/SI-5784.scala new file mode 100644 index 0000000000..175cc3cf33 --- /dev/null +++ b/test/scaladoc/resources/SI-5784.scala @@ -0,0 +1,28 @@ +package test.templates { + object `package` { + /** @template */ + type String = java.lang.String + val String = new StringCompanion + class StringCompanion { def boo = ??? } + } + + /** @contentDiagram */ + trait Base { + /** @template */ + type String = test.templates.String + /** @template + * @inheritanceDiagram */ + type T <: Foo + val T: FooExtractor + trait Foo { def foo: Int } + trait FooExtractor { def apply(foo: Int); def unapply(t: Foo): Option[Int] } + } + + /** @contentDiagram */ + trait Api extends Base { + /** @template + * @inheritanceDiagram */ + override type T <: FooApi + trait FooApi extends Foo { def bar: String } + } +} diff --git a/test/scaladoc/resources/doc-root/AnyRef.scala b/test/scaladoc/resources/doc-root/AnyRef.scala index 1eefb0c806..7d8b9f9e76 100644 --- a/test/scaladoc/resources/doc-root/AnyRef.scala +++ b/test/scaladoc/resources/doc-root/AnyRef.scala @@ -10,6 +10,7 @@ package scala /** Class `AnyRef` is the root class of all ''reference types''. * All types except the value types descend from this class. + * @template */ trait AnyRef extends Any { |