Skip to content

Commit 9b34d29

Browse files
committed
change mods to annotations
1 parent 5f50490 commit 9b34d29

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

compiler/src/dotty/tools/dotc/ast/NavigateAST.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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)

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff 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("test")
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("test")
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("test")
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+
)

0 commit comments

Comments
 (0)