Skip to content

Commit

Permalink
use package name for pkg object namespan
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed May 20, 2021
1 parent 2f87059 commit 4ae44d6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/semanticdb/expect/EndMarkers2.expect.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package object endmark/*<-endmarkers2::package.*/ers2:
package object endmarkers2/*<-endmarkers2::package.*/:

type Foo/*<-endmarkers2::package.Foo#*/ =
Unit/*->scala::Unit#*/
Expand Down
4 changes: 2 additions & 2 deletions tests/semanticdb/expect/semanticdb-Flags.expect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.`???`().*/
Expand Down
4 changes: 2 additions & 2 deletions tests/semanticdb/metac.expect
Original file line number Diff line number Diff line change
Expand Up @@ -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#
Expand Down Expand Up @@ -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().
Expand Down

0 comments on commit 4ae44d6

Please sign in to comment.