aboutsummaryrefslogtreecommitdiff
path: root/dottydoc
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-06-24 11:32:09 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-08-19 15:37:27 +0200
commit76413f003945140e5b502e6ad7b8fb058e6e6ade (patch)
tree2629af097c4b39ef7f7c292495b75f3fcd153bda /dottydoc
parentf1c88d7aac3df093b2912f6905b5fa852cf50e7d (diff)
downloaddotty-76413f003945140e5b502e6ad7b8fb058e6e6ade.tar.gz
dotty-76413f003945140e5b502e6ad7b8fb058e6e6ade.tar.bz2
dotty-76413f003945140e5b502e6ad7b8fb058e6e6ade.zip
Cleanup return types and type parameters from dollar signs
Diffstat (limited to 'dottydoc')
-rw-r--r--dottydoc/jvm/src/dotty/tools/dottydoc/core/AddImplicitsPhase.scala3
-rw-r--r--dottydoc/jvm/src/dotty/tools/dottydoc/core/DocPhase.scala4
-rw-r--r--dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/factories.scala31
3 files changed, 22 insertions, 16 deletions
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/core/AddImplicitsPhase.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/core/AddImplicitsPhase.scala
index 3ee6082b6..15994ee28 100644
--- a/dottydoc/jvm/src/dotty/tools/dottydoc/core/AddImplicitsPhase.scala
+++ b/dottydoc/jvm/src/dotty/tools/dottydoc/core/AddImplicitsPhase.scala
@@ -19,9 +19,6 @@ class AddImplicitsPhase extends MiniPhaseTransform { thisTransformer =>
tree.vparamss(0).length == 1 // should only take one arg, since it has to be a transformation
) {
val convertee = tree.vparamss(0)(0).symbol.info.widenDealias.finalResultType.typeSymbol//denot.typeRef // the pimped type (i.e. `class`)
- println(s"Adding methods from ${tree.symbol.info.widenDealias.finalResultType.typeSymbol} to ${convertee}")
- //println(s" ${tree.denot.info} ${tree.vparamss(0)(0).denot.info}")
- //ImplicitlyAdded.addDef(convertee, tree)
ImplicitlyAdded.addDef(convertee, tree.symbol.info.widenDealias.finalResultType.typeSymbol)
}
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/core/DocPhase.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/core/DocPhase.scala
index 2c07befc9..71d33950e 100644
--- a/dottydoc/jvm/src/dotty/tools/dottydoc/core/DocPhase.scala
+++ b/dottydoc/jvm/src/dotty/tools/dottydoc/core/DocPhase.scala
@@ -58,13 +58,13 @@ class DocPhase extends Phase {
def addedFromSymbol(sym: Symbol): List[Entity] = {
val defs = sym.info.membersBasedOnFlags(Flags.Method, Flags.Synthetic | Flags.Private).map { meth =>
- track(sym, ctx) {
+ track(meth.symbol, ctx) {
DefImpl(meth.symbol.name.decode.toString, Nil, path(meth.symbol), returnType(meth.info), typeParams(meth.symbol), Nil/*paramLists(???)*/)
}
}.toList
val vals = sym.info.fields.map { value =>
- track(sym, ctx) {
+ track(value.symbol, ctx) {
ValImpl(value.symbol.name.decode.toString, Nil, path(value.symbol), returnType(value.info))
}
}
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 bb415aed7..eb0f54480 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
@@ -49,22 +49,24 @@ object factories {
}
def returnType(t: Type)(implicit ctx: Context): Reference = {
- def typeRef(name: String, params: List[MaterializableLink] = Nil) =
- TypeReference(name, UnsetLink(Text(name), name), params)
+ def typeRef(name: String, query: String = "", params: List[MaterializableLink] = Nil) = {
+ val realQuery = if (query != "") query else name
+ TypeReference(name, UnsetLink(Text(name), realQuery), params)
+ }
def expandTpe(t: Type, params: List[MaterializableLink] = Nil): Reference = t match {
case ref @ RefinedType(parent, rn) => {
- val paramName = ref.refinedInfo match {
+ val paramName = (ref.refinedInfo match {
case ta: TypeAlias if ta.alias.isInstanceOf[NamedType] =>
- ta.alias.asInstanceOf[NamedType].name.decode.toString
- case _ =>
- rn.decode.toString.split("\\$").last
- }
+ ta.alias.asInstanceOf[NamedType].name.show
+ case _ => rn.show
+ }).split("\\$").last
val param = UnsetLink(Text(paramName), paramName)
expandTpe(parent, param :: params)
}
- case TypeRef(_, name) =>
- typeRef(name.decode.toString, params)
+ case TypeRef(_, n) =>
+ val name = n.decode.toString.split("\\$").last
+ typeRef(name, params = params)
case OrType(left, right) =>
OrTypeReference(expandTpe(left), expandTpe(right))
case AndType(left, right) =>
@@ -86,7 +88,13 @@ object factories {
case pt: PolyType =>
expandTpe(pt.resultType)
case pp: PolyParam =>
- typeRef(pp.paramName.decode.toString)
+ val paramName = pp.paramName.show
+ val name =
+ if (paramName.contains('$'))
+ paramName.split("\\$\\$").last
+ else paramName
+
+ typeRef(name)
}
expandTpe(t)
@@ -94,7 +102,8 @@ object factories {
def typeParams(sym: Symbol)(implicit ctx: Context): List[String] =
sym.denot.info match {
- case pt: PolyType => pt.paramNames.map(_.decode.toString)
+ case pt: PolyType =>
+ pt.paramNames.map(_.show.split("\\$").last)
case _ => Nil
}