Skip to content

Commit 1f503e7

Browse files
authored
Merge pull request #12070 from BarkingBad/scaladoc/java-lookups
Fix Java lookups
2 parents 090b1b1 + a2e2a3d commit 1f503e7

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

scaladoc-testcases/src/tests/lookupInheritedMembers.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ package lookupInheritedMembers {
1515
* [[tests.lookupInheritedMembers.pack2.B.x]]
1616
* [[tests.lookupInheritedMembers.pack2.B.y]]
1717
* [[tests.lookupInheritedMembers.pack2.B.MyType]]
18+
*
1819
*/
1920
class LookupInheritedMembers
21+
22+
/**
23+
* This look up is problematic, because is lazyloaded by dotty.
24+
*
25+
* [[java.util.Formatter]]
26+
*/
27+
class JavaInheritedMembers
2028
}
29+

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,15 @@ trait MemberLookup {
103103
members.asInstanceOf[Iterator[Symbol]]
104104
}
105105

106-
private def hackIsNotAbsent(using Quotes)(rsym: quotes.reflect.Symbol) = {
106+
private def hackIsNotAbsent(using Quotes)(rsym: quotes.reflect.Symbol) =
107107
import dotty.tools.dotc
108108
given dotc.core.Contexts.Context = quotes.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx
109109
val sym = rsym.asInstanceOf[dotc.core.Symbols.Symbol]
110110
// note: Predef has .info = NoType for some reason
111-
sym.isCompleted && sym.info.exists
112-
}
111+
val iorc = sym.infoOrCompleter
112+
iorc match
113+
case _: dotc.core.SymDenotations.ModuleCompleter | dotc.core.SymDenotations.NoCompleter | dotc.core.Types.NoType | _: dotc.core.NoLoader => false
114+
case _ => true
113115

114116
private def localLookup(using Quotes)(
115117
sel: MemberLookup.Selector,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ class LookupTestCases[Q <: Quotes](val q: Quotes) {
3838

3939
"java.util.AbstractCollection" -> cls("java.util.AbstractCollection"),
4040
"java.lang.String" -> cls("java.lang.String"),
41+
"java.util.Formatter" -> cls("java.util.Formatter"),
42+
"java.io.Flushable" -> cls("java.io.Flushable"),
43+
"java.util.List" -> cls("java.util.List"),
4144

4245
"tests.lookupInheritedMembers.pack1.A.x" ->
4346
cls("tests.lookupInheritedMembers.pack1.A").fun("x"),

0 commit comments

Comments
 (0)