diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-07-19 15:17:23 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-08-19 15:37:30 +0200 |
commit | a284cad4e58d48dd6fbaa0219bf00a2fd90e3d9d (patch) | |
tree | 41dbffde7690fea19cb81d34eba26a0a800f1589 /dottydoc | |
parent | 00ea4fc5f46ebc984ac68a463b3a87d553a2c2f4 (diff) | |
download | dotty-a284cad4e58d48dd6fbaa0219bf00a2fd90e3d9d.tar.gz dotty-a284cad4e58d48dd6fbaa0219bf00a2fd90e3d9d.tar.bz2 dotty-a284cad4e58d48dd6fbaa0219bf00a2fd90e3d9d.zip |
Change TypeReference#paramLinks' type from `MaterializableLink` to `Reference`
Diffstat (limited to 'dottydoc')
4 files changed, 7 insertions, 12 deletions
diff --git a/dottydoc/js/src/model/references.scala b/dottydoc/js/src/model/references.scala index 3fab228af..b0e8a8674 100644 --- a/dottydoc/js/src/model/references.scala +++ b/dottydoc/js/src/model/references.scala @@ -16,7 +16,7 @@ sealed trait Reference extends sjs.Object { trait TypeReference extends Reference { val title: String val tpeLink: MaterializableLink - val paramLinks: sjs.Array[MaterializableLink] + val paramLinks: sjs.Array[Reference] } @ScalaJSDefined diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala index c1ad520ff..a6d474c8f 100644 --- a/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala +++ b/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala @@ -51,13 +51,7 @@ trait TypeLinker extends MemberLookup { } val target = handleEntityLink(title, makeEntityLink(ent, packs, Text(t), NoPosition, query).link) - - val tpTargets = tps.map { - case UnsetLink(t, query) => - handleEntityLink(t, makeEntityLink(ent, packs, Text(t), NoPosition, query).link) - case x => x - } - + val tpTargets = tps.map(linkReference(ent, _, packs)) rv.copy(tpeLink = target, paramLinks = tpTargets) case rv @ OrTypeReference(left, right) => rv.copy(left = linkReference(ent, left, packs), right = linkReference(ent, right, packs)) diff --git a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/comment/BodyEntities.scala b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/comment/BodyEntities.scala index d7ad4de71..691661ac5 100644 --- a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/comment/BodyEntities.scala +++ b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/comment/BodyEntities.scala @@ -100,7 +100,7 @@ final case class MaterializedLink(title: String, target: String) extends Materia final case class NoLink(title: String, target: String) extends MaterializableLink sealed trait Reference -final case class TypeReference(title: String, tpeLink: MaterializableLink, paramLinks: List[MaterializableLink]) extends Reference +final case class TypeReference(title: String, tpeLink: MaterializableLink, paramLinks: List[Reference]) extends Reference final case class OrTypeReference(left: Reference, right: Reference) extends Reference final case class AndTypeReference(left: Reference, right: Reference) extends Reference final case class NamedReference(title: String, ref: Reference, isByName: Boolean = false) extends Reference diff --git a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/factories.scala b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/factories.scala index ef4854979..8453b528f 100644 --- a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/factories.scala +++ b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/factories.scala @@ -4,6 +4,7 @@ package model import comment._ import dotty.tools.dotc import dotc.core.Types._ +import dotc.core.TypeApplications._ import dotc.core.Flags import dotc.core.Contexts.Context import dotc.core.Symbols.Symbol @@ -49,7 +50,7 @@ object factories { } def returnType(t: Type)(implicit ctx: Context): Reference = { - def typeRef(name: String, query: String = "", params: List[MaterializableLink] = Nil) = { + def typeRef(name: String, query: String = "", params: List[Reference] = Nil) = { val realQuery = if (query != "") query else name TypeReference(name, UnsetLink(name, realQuery), params) } @@ -76,6 +77,8 @@ object factories { case TypeRef(_, n) => val name = n.decode.toString.split("\\$").last typeRef(name, params = params) + case ta: TypeAlias => + expandTpe(ta.alias.widenDealias) case OrType(left, right) => OrTypeReference(expandTpe(left), expandTpe(right)) case AndType(left, right) => @@ -90,8 +93,6 @@ object factories { expandTpe(tt.underlying) case ci: ClassInfo => typeRef(ci.cls.show) - case ta: TypeAlias => - expandTpe(ta.alias.widenDealias) case mt: MethodType => expandTpe(mt.resultType) case pt: PolyType => |