diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-02-24 17:04:31 +0900 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2017-02-24 17:57:59 +0900 |
commit | 5bb7c976712e8c86898b94d1abea1acedeed3562 (patch) | |
tree | 4711c95cf5f7e86cded4ea521f23b7b56f2b21cf /doc-tool/src/dotty/tools/dottydoc/model | |
parent | a0f47a00131935d85f957a80d0c4472eaa7b5baa (diff) | |
download | dotty-5bb7c976712e8c86898b94d1abea1acedeed3562.tar.gz dotty-5bb7c976712e8c86898b94d1abea1acedeed3562.tar.bz2 dotty-5bb7c976712e8c86898b94d1abea1acedeed3562.zip |
Add type params to type aliases
Diffstat (limited to 'doc-tool/src/dotty/tools/dottydoc/model')
4 files changed, 9 insertions, 13 deletions
diff --git a/doc-tool/src/dotty/tools/dottydoc/model/JavaConverters.scala b/doc-tool/src/dotty/tools/dottydoc/model/JavaConverters.scala index 239656141..4a9bfce0c 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/JavaConverters.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/JavaConverters.scala @@ -189,6 +189,7 @@ object JavaConverters { "name" -> ent.name, "path" -> ent.path.asJava, "alias" -> ent.alias.map(_.asJava).asJava, + "typeParams" -> ent.typeParams.asJava, "comment" -> ent.comment.map(_.asJava).asJava, "hasShortenedDocstring" -> ent.hasShortenedDocstring, "isPrivate" -> ent.isPrivate, diff --git a/doc-tool/src/dotty/tools/dottydoc/model/entities.scala b/doc-tool/src/dotty/tools/dottydoc/model/entities.scala index d35077816..d0f1a82c7 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/entities.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/entities.scala @@ -108,7 +108,7 @@ trait Package extends Entity with Members with SuperTypes { val kind = "package" } -trait TypeAlias extends Entity with Modifiers { +trait TypeAlias extends Entity with Modifiers with TypeParams { val kind = "type" def alias: Option[Reference] def isAbstract: Boolean = !alias.isDefined diff --git a/doc-tool/src/dotty/tools/dottydoc/model/factories.scala b/doc-tool/src/dotty/tools/dottydoc/model/factories.scala index 568b532b7..3e766a990 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/factories.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/factories.scala @@ -4,7 +4,8 @@ package model import comment._ import references._ import dotty.tools.dotc -import dotc.core.Types._ +import dotc.core.Types +import Types._ import dotc.core.TypeApplications._ import dotc.core.Contexts.Context import dotc.core.Symbols.{ Symbol, ClassSymbol } @@ -105,17 +106,8 @@ object factories { case ci: ClassInfo => typeRef(ci.cls.name.show, query = ci.typeSymbol.showFullName) - case tl: PolyType => { - // FIXME: should be handled correctly - // example, in `Option`: - // - // ```scala - // def companion: GenericCompanion[collection.Iterable] - // ``` - // - // Becomes: def companion: [+X0] -> collection.Iterable[X0] - typeRef(tl.show + " (not handled)") - } + case tl: PolyType => + expandTpe(tl.resType) case OrType(left, right) => OrTypeReference(expandTpe(left), expandTpe(right)) @@ -148,6 +140,8 @@ object factories { prefix + tp.name.show.split("\\$").last } .toList + case tp: Types.TypeAlias => + typeParams(tp.alias.typeSymbol) case _ => Nil } diff --git a/doc-tool/src/dotty/tools/dottydoc/model/internal.scala b/doc-tool/src/dotty/tools/dottydoc/model/internal.scala index bf50c0232..b50c93ee5 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/internal.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/internal.scala @@ -31,6 +31,7 @@ object internal { name: String, path: List[String], alias: Option[Reference], + typeParams: List[String] = Nil, var comment: Option[Comment] = None, var parent: Entity = NonEntity ) extends TypeAlias |