Repository: scalameta/scalameta (scala)
Issue: Deprecated pointing to empty when using empty package
`deprecated => _empty_/` instead of `deprecated => scala/deprecated#` for:

```
@deprecated(since = "123")
class CLS(name: String) {
  def this(name2: Int) = this(name = name2.toString)
}
```

This only happens for Scala 2.13.x
Pull request description: Fixes #4136.

Patch:
diff --git a/semanticdb/scalac/library/src/main/scala/scala/meta/internal/semanticdb/scalac/TextDocumentOps.scala b/semanticdb/scalac/library/src/main/scala/scala/meta/internal/semanticdb/scalac/TextDocumentOps.scala
index 66e179c91d..497268ae70 100644
--- a/semanticdb/scalac/library/src/main/scala/scala/meta/internal/semanticdb/scalac/TextDocumentOps.scala
+++ b/semanticdb/scalac/library/src/main/scala/scala/meta/internal/semanticdb/scalac/TextDocumentOps.scala
@@ -595,6 +595,10 @@ trait TextDocumentOps {
                 }
                 processMemberDef(t)
               case t: g.MemberDef => processMemberDef(t)
+              case t: g.Ident => t.pos match {
+                  case p: gu.RangePosition if p.start >= p.end => // do nothing, empty identifier (such as empty package)
+                  case _ => tryFindMtree(t)
+                }
               case _: g.GenericApply =>
                 tryFindSynthetic(gtree)
                 gtree.pos match {


Test patch:
diff --git a/tests-semanticdb/src/test/scala/scala/meta/tests/semanticdb/TargetedSuite.scala b/tests-semanticdb/src/test/scala/scala/meta/tests/semanticdb/TargetedSuite.scala
index 073eb015c1..3e0ebd4ac2 100644
--- a/tests-semanticdb/src/test/scala/scala/meta/tests/semanticdb/TargetedSuite.scala
+++ b/tests-semanticdb/src/test/scala/scala/meta/tests/semanticdb/TargetedSuite.scala
@@ -272,7 +272,7 @@ class TargetedSuite extends SemanticdbSuite {
                       |  String => scala/Predef.String#
                       |
                       |Occurrences:
-                      |[0:1..0:11): deprecated => _empty_/
+                      |[0:1..0:11): deprecated => scala/deprecated#
                       |[0:11..0:11):  => scala/deprecated#`<init>`().
                       |[0:12..0:17): since => scala/deprecated#`<init>`().(since)
                       |[1:6..1:9): CLS <= _empty_/CLS#
@@ -293,14 +293,14 @@ class TargetedSuite extends SemanticdbSuite {
       else expected
         .replace("Occurrences => 14 entries", "Occurrences => 14 entries\nDiagnostics => 1 entries")
         .replace(
-          "local0 => val local x$1: \"123\"",
+          """|local0 => val local x$1: "123"
+             |""".stripMargin,
           """|local0 => val local x$1: String
-             |  String => java/lang/String#""".stripMargin
-        ).replace(
-          "[0:1..0:11): deprecated => _empty_/",
-          "[0:1..0:11): deprecated => scala/deprecated#" // TODO https://github.com/scalameta/scalameta/issues/4136
-        ) + "\n" +
-        """|Diagnostics:
+             |  String => java/lang/String#
+             |""".stripMargin
+        ) +
+        """|
+           |Diagnostics:
            |[0:1..0:26) [warning] Usage of named or default arguments transformed this annotation
            |constructor call into a block. The corresponding AnnotationInfo
            |will contain references to local values and default getters instead