Skip to content

Commit 251e4a5

Browse files
committed
use full path in site and origin strings
1 parent 670a55c commit 251e4a5

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/compiler/scala/tools/nsc/Reporting.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,14 @@ trait Reporting extends internal.Reporting { self: ast.Positions with Compilatio
179179
}
180180
}
181181

182-
private def siteName(s: Symbol) = if (s.exists) s.fullNameString else ""
182+
private def siteName(sym: Symbol) = if (sym.exists) {
183+
// Similar to fullNameString, but don't jump to enclosing class. Keep full chain of symbols.
184+
def impl(s: Symbol): String =
185+
if (s.isRootSymbol || s == NoSymbol) s.nameString
186+
else if (s.owner.isEffectiveRoot) s.nameString
187+
else impl(s.effectiveOwner) + "." + s.nameString
188+
impl(sym)
189+
} else ""
183190

184191
def deprecationWarning(pos: Position, msg: String, since: String, site: String, origin: String): Unit =
185192
checkSuppressedAndIssue(Message.Deprecation(pos, msg, site, origin, Version.fromString(since)))

test/files/neg/nowarnPointPos.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,10 @@ trait T {
8686
}
8787

8888
class K extends T
89+
90+
@nowarn("site=Uh.f.g")
91+
class Uh {
92+
def f = {
93+
def g(c: C) = c.dep
94+
}
95+
}

test/files/neg/nowarnRangePos.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,10 @@ trait T {
8686
}
8787

8888
class K extends T
89+
90+
@nowarn("site=Uh.f.g")
91+
class Uh {
92+
def f = {
93+
def g(c: C) = c.dep
94+
}
95+
}

0 commit comments

Comments
 (0)