Skip to content

Commit ebdbdc4

Browse files
committed
Scaladoc: look up inherited definitions as well
1 parent 640eb20 commit ebdbdc4

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

scaladoc-testcases/src/tests/tests.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ class B extends A {
131131
class BB
132132
}
133133

134+
class BModule {
135+
def foo = "foo"
136+
}
137+
134138
/** Companion object to test linking.
135139
*
136140
* This is my member: [[B$.Z]]
@@ -141,7 +145,7 @@ class B extends A {
141145
*
142146
* And this is my term member, addressed differently: [[this.Z$]]
143147
*/
144-
object B {
148+
object B extends BModule {
145149
type Z = Int
146150
val Z: Int = 0
147151
}

scaladoc/src/dotty/tools/scaladoc/tasty/comments/MemberLookup.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ trait MemberLookup {
8888
import dotty.tools.dotc
8989
given dotc.core.Contexts.Context = quotes.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx
9090
val sym = rsym.asInstanceOf[dotc.core.Symbols.Symbol]
91-
val members = sym.info.decls.iterator.filter(s => hackIsNotAbsent(s.asInstanceOf[Symbol]))
91+
val members =
92+
sym.info.allMembers.iterator.map(_.symbol).filter(
93+
s => hackIsNotAbsent(s.asInstanceOf[Symbol])
94+
)
9295
// println(s"members of ${sym.show} : ${members.map(_.show).mkString(", ")}")
9396
members.asInstanceOf[Iterator[Symbol]]
9497
}
@@ -144,8 +147,6 @@ trait MemberLookup {
144147
})
145148
else
146149
owner.tree match {
147-
case tree: ClassDef =>
148-
findMatch(tree.body.iterator.collect { case t: Definition if hackIsNotAbsent(t.symbol) => t.symbol })
149150
case tree: TypeDef =>
150151
val tpe =
151152
tree.rhs match {

scaladoc/test/dotty/tools/scaladoc/tasty/comments/MemberLookupTests.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class LookupTestCases[Q <: Quotes](val q: Quotes) {
2828
"???" -> cls("scala.Predef$").fun("???"),
2929
"scala.List" -> cls("scala.package$").tpe("List"),
3030

31+
"scala.List.lift" -> cls("scala.PartialFunction").fun("lift"),
32+
3133
"tests.A" -> cls("tests.A"),
3234
"tests.A$" -> cls("tests.A$"),
3335
"tests.Methods.simple" -> cls("tests.Methods").fun("simple"),
@@ -91,6 +93,8 @@ class LookupTestCases[Q <: Quotes](val q: Quotes) {
9193

9294
cls("tests.inner.B") -> "A" -> cls("tests.inner.A$"),
9395

96+
cls("tests.B$") -> "foo" -> cls("tests.BModule").fun("foo"),
97+
9498
cls("tests.D") -> "foo" -> cls("tests.package$").fld("foo"),
9599
cls("tests.D") -> "bar" -> cls("tests.tests$package$").fld("bar"),
96100
cls("tests.inner.A$") -> "foo" -> cls("tests.package$").fld("foo"),

0 commit comments

Comments
 (0)