From 2280b8e3d5472be2df69bb0531486c25cf10edc4 Mon Sep 17 00:00:00 2001 From: Vlad Ureche Date: Thu, 11 Oct 2012 03:04:23 +0200 Subject: SI-6155 Scaladoc @template diagrms --- .../scala/tools/nsc/doc/model/ModelFactory.scala | 3 ++- test/scaladoc/resources/SI-6511.scala | 24 ++++++++++++++++++++++ test/scaladoc/run/SI-6511.check | 1 + test/scaladoc/run/SI-6511.scala | 22 ++++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 test/scaladoc/resources/SI-6511.scala create mode 100644 test/scaladoc/run/SI-6511.check create mode 100644 test/scaladoc/run/SI-6511.scala diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala index 3b1f0587a1..32e113bbb0 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -292,7 +292,8 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { val tps = (this match { case a: AliasType => sym.tpe.dealias.parents case a: AbstractType => sym.info.bounds match { - case TypeBounds(lo, hi) => List(hi) + case TypeBounds(lo, RefinedType(parents, decls)) => parents + case TypeBounds(lo, hi) => hi :: Nil case _ => Nil } case _ => sym.tpe.parents diff --git a/test/scaladoc/resources/SI-6511.scala b/test/scaladoc/resources/SI-6511.scala new file mode 100644 index 0000000000..1f153caeb0 --- /dev/null +++ b/test/scaladoc/resources/SI-6511.scala @@ -0,0 +1,24 @@ +package test.scaladoc.template.diagrams + +/** @contentDiagram hideNodes "*Api" */ +trait X { + /** @template */ + type Symbol >: Null <: SymbolApi + + /** @template */ + type TypeSymbol >: Null <: Symbol with TypeSymbolApi + + /** @template */ + type TermSymbol >: Null <: Symbol with TermSymbolApi + + /** @template */ + type MethodSymbol >: Null <: TermSymbol with MethodSymbolApi + + trait SymbolApi { this: Symbol => def x: Int} + trait TermSymbolApi extends SymbolApi { this: TermSymbol => def y: Int} + trait TypeSymbolApi extends SymbolApi { this: TypeSymbol => def z: Int} + trait MethodSymbolApi extends TermSymbolApi { this: MethodSymbol => def t: Int } +} + +/** @contentDiagram hideNodes "*Api" */ +trait Y extends X diff --git a/test/scaladoc/run/SI-6511.check b/test/scaladoc/run/SI-6511.check new file mode 100644 index 0000000000..3925a0d464 --- /dev/null +++ b/test/scaladoc/run/SI-6511.check @@ -0,0 +1 @@ +Done. \ No newline at end of file diff --git a/test/scaladoc/run/SI-6511.scala b/test/scaladoc/run/SI-6511.scala new file mode 100644 index 0000000000..cc950a98d6 --- /dev/null +++ b/test/scaladoc/run/SI-6511.scala @@ -0,0 +1,22 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + override def resourceFile: String = "SI-6511.scala" + + // no need for special settings + def scaladocSettings = "-diagrams" + + def testModel(rootPackage: Package) = { + // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) + import access._ + + val main = rootPackage._package("test")._package("scaladoc")._package("template")._package("diagrams") + val X = main._trait("X") + val Y = main._trait("Y") + + testDiagram(X, X.contentDiagram, nodes = 4, edges = 3) + testDiagram(Y, Y.contentDiagram, nodes = 4, edges = 3) + } +} \ No newline at end of file -- cgit v1.2.3