diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-01-16 20:29:25 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2017-01-31 14:32:37 +0100 |
commit | 9a581bc15aa300f665428c804611453609955f60 (patch) | |
tree | 122c3ae291a6d277e02a4545852a798deecf7181 /doc-tool/src/dotty/tools/dottydoc/util/MemberLookup.scala | |
parent | 72720f0780e95b6b341f46679d20b56fcef8b85a (diff) | |
download | dotty-9a581bc15aa300f665428c804611453609955f60.tar.gz dotty-9a581bc15aa300f665428c804611453609955f60.tar.bz2 dotty-9a581bc15aa300f665428c804611453609955f60.zip |
Improve member lookup
Diffstat (limited to 'doc-tool/src/dotty/tools/dottydoc/util/MemberLookup.scala')
-rw-r--r-- | doc-tool/src/dotty/tools/dottydoc/util/MemberLookup.scala | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/doc-tool/src/dotty/tools/dottydoc/util/MemberLookup.scala b/doc-tool/src/dotty/tools/dottydoc/util/MemberLookup.scala index 52b18f70c..ad73ad008 100644 --- a/doc-tool/src/dotty/tools/dottydoc/util/MemberLookup.scala +++ b/doc-tool/src/dotty/tools/dottydoc/util/MemberLookup.scala @@ -7,7 +7,6 @@ import dotc.core.Contexts.Context import dotc.core.Flags import dotc.core.Names._ import dotc.core.Symbols._ -import dotc.core.Types._ import dotc.core.Names._ import dotc.util.Positions._ import model.internal._ @@ -31,7 +30,13 @@ trait MemberLookup { .collect { case x if x.name == searchStr => x } .sortBy(_.path.last) .headOption - .fold(notFound)(e => LinkToEntity(e)) + .fold(notFound) { + case e: TypeAlias => + // TODO: will explode once type aliases are fixed + if (e.alias.isDefined) ??? + else notFound + case e => LinkToEntity(e) + } /** Looks for an entity down in the structure, if the search list is Nil, * the search stops @@ -44,7 +49,10 @@ trait MemberLookup { case x :: xs => ent .members - .collect { case e: Entity with Members if e.name == x => e } + .collect { + case e: Entity with Members if e.name == x => e + case e: Entity with Members if e.name == x.init && x.last == '$' => e + } .headOption .fold(notFound)(e => downwardLookup(e, xs)) } @@ -54,7 +62,7 @@ trait MemberLookup { */ def globalLookup: LinkTo = { def longestMatch(list: List[String]): List[String] = - if (list == Nil) Nil + if (list eq Nil) Nil else packages .get(list.mkString(".")) |