Skip to content

Commit 9a028cd

Browse files
committed
fix: don't show incorrect docs for inner methods
1 parent 6187ac0 commit 9a028cd

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

presentation-compiler/src/main/dotty/tools/pc/utils/InteractiveEnrichments.scala

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package dotty.tools.pc.utils
22

3+
import java.util.Optional
4+
35
import scala.annotation.tailrec
46
import scala.meta.internal.jdk.CollectionConverters.*
57
import scala.meta.internal.mtags.CommonMtagsEnrichments
@@ -272,11 +274,14 @@ object InteractiveEnrichments extends CommonMtagsEnrichments:
272274
symbol.maybeOwner.companion,
273275
).filter(_ != NoSymbol) ++ symbol.allOverriddenSymbols
274276
else symbol.allOverriddenSymbols
275-
val documentation = search.documentation(
276-
sym,
277-
() => parentSymbols.iterator.map(toSemanticdbSymbol).toList.asJava,
278-
contentType,
279-
)
277+
val documentation =
278+
if symbol.isLocal then Optional.empty
279+
else
280+
search.documentation(
281+
sym,
282+
() => parentSymbols.iterator.map(toSemanticdbSymbol).toList.asJava,
283+
contentType,
284+
)
280285
documentation.nn.toScala
281286
end symbolDocumentation
282287
end extension

presentation-compiler/test/dotty/tools/pc/tests/hover/HoverDocSuite.scala

+12
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,15 @@ class HoverDocSuite extends BaseHoverSuite:
254254
|Found documentation for _empty_/Alpha#
255255
|""".stripMargin,
256256
)
257+
258+
@Test def `i7093` =
259+
check(
260+
"""|object O:
261+
| /** Ooopsie daisy */
262+
| val computeLogicOwners: Unit =
263+
| /** This is a comment */
264+
| <<def logi@@cOwners = ???>>
265+
| ???
266+
|""".stripMargin,
267+
"""def logicOwners: Nothing""".hover.stripMargin
268+
)

0 commit comments

Comments
 (0)