File tree Expand file tree Collapse file tree 2 files changed +49
-1
lines changed
compiler/src/dotty/tools/dotc/ast
presentation-compiler/test/dotty/tools/pc/tests/hover Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ object NavigateAST {
141141 case _ =>
142142 val iterator = p match
143143 case defdef : DefTree [? ] =>
144- p.productIterator ++ defdef.mods.productIterator
144+ p.productIterator ++ defdef.symbol.annotations.map(_.tree).iterator
145145 case _ =>
146146 p.productIterator
147147 childPath(iterator, p :: path)
Original file line number Diff line number Diff line change @@ -279,3 +279,51 @@ class HoverDefnSuite extends BaseHoverSuite:
279279 |```
280280 |""" .stripMargin
281281 )
282+
283+ @ Test def `annotation` =
284+ check(
285+ """ |
286+ |@ma@@in
287+ |def example() =
288+ | println("ELO")
289+ |""" .stripMargin,
290+ """ |```scala
291+ |def this(): main
292+ |```""" .stripMargin.hover
293+ )
294+
295+ @ Test def `annotation-2` =
296+ check(
297+ """ |
298+ |@ma@@in
299+ |def example() =
300+ | List("ELO")
301+ |""" .stripMargin,
302+ """ |```scala
303+ |def this(): main
304+ |```""" .stripMargin.hover
305+ )
306+
307+ @ Test def `annotation-3` =
308+ check(
309+ """ |
310+ |@ma@@in
311+ |def example() =
312+ | Array("ELO")
313+ |""" .stripMargin,
314+ """ |```scala
315+ |def this(): main
316+ |```""" .stripMargin.hover
317+ )
318+
319+ @ Test def `annotation-4` =
320+ check(
321+ """ |
322+ |@ma@@in
323+ |def example() =
324+ | Array(1, 2)
325+ |""" .stripMargin,
326+ """ |```scala
327+ |def this(): main
328+ |```""" .stripMargin.hover
329+ )
You can’t perform that action at this time.
0 commit comments