diff --git a/compiler/src/dotty/tools/dotc/ast/Trees.scala b/compiler/src/dotty/tools/dotc/ast/Trees.scala index 137864570330..464ad0967719 100644 --- a/compiler/src/dotty/tools/dotc/ast/Trees.scala +++ b/compiler/src/dotty/tools/dotc/ast/Trees.scala @@ -376,7 +376,8 @@ object Trees { val point = span.point if (rawMods.is(Synthetic) || span.isSynthetic || name.toTermName == nme.ERROR) Span(point) else { - val realName = name.stripModuleClassSuffix.lastPart + val srcName = if symbol.isPackageObject then symbol.owner.name else name + val realName = srcName.stripModuleClassSuffix.lastPart Span(point, point + realName.length, point) } } diff --git a/tests/semanticdb/expect/EndMarkers2.expect.scala b/tests/semanticdb/expect/EndMarkers2.expect.scala index c6d5d6937c30..61b8f8093a8e 100644 --- a/tests/semanticdb/expect/EndMarkers2.expect.scala +++ b/tests/semanticdb/expect/EndMarkers2.expect.scala @@ -1,4 +1,4 @@ -package object endmark/*<-endmarkers2::package.*/ers2: +package object endmarkers2/*<-endmarkers2::package.*/: type Foo/*<-endmarkers2::package.Foo#*/ = Unit/*->scala::Unit#*/ diff --git a/tests/semanticdb/expect/semanticdb-Flags.expect.scala b/tests/semanticdb/expect/semanticdb-Flags.expect.scala index fe920433e231..b64732665c25 100644 --- a/tests/semanticdb/expect/semanticdb-Flags.expect.scala +++ b/tests/semanticdb/expect/semanticdb-Flags.expect.scala @@ -2,8 +2,8 @@ package flags import scala.language/*->scala::language.*/.experimental/*->scala::language.experimental.*/.macros/*->scala::language.experimental.macros.*/ -package object p { - p/*<-flags::p::package.*/rivate lazy val x/*<-flags::p::package.x.*/ = 1 +package object p/*<-flags::p::package.*/ { + private lazy val x/*<-flags::p::package.x.*/ = 1 protected implicit var y/*<-flags::p::package.y().*/: Int/*->scala::Int#*/ = 2 def z/*<-flags::p::package.z().*/(pp/*<-flags::p::package.z().(pp)*/: Int/*->scala::Int#*/) = 3 def m/*<-flags::p::package.m().*/[TT/*<-flags::p::package.m().[TT]*/]: Int/*->scala::Int#*/ = macro ???/*->scala::Predef.`???`().*/ diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index 7ad6be73fe13..3b33445d1eff 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -756,7 +756,7 @@ endmarkers2/package. => final package object endmarkers2 endmarkers2/package.Foo# => type Foo Occurrences: -[0:15..0:22): endmark <- endmarkers2/package. +[0:15..0:26): endmarkers2 <- endmarkers2/package. [2:7..2:10): Foo <- endmarkers2/package.Foo# [3:4..3:8): Unit -> scala/Unit# [4:6..4:9): Foo -> endmarkers2/package.Foo# @@ -3833,7 +3833,7 @@ Occurrences: [2:13..2:21): language -> scala/language. [2:22..2:34): experimental -> scala/language.experimental. [2:35..2:41): macros -> scala/language.experimental.macros. -[4:15..5:3): <- flags/p/package. +[4:15..4:16): p <- flags/p/package. [5:2..5:3): p -> flags/p/ [5:19..5:20): x <- flags/p/package.x. [6:25..6:26): y <- flags/p/package.y().