Skip to content

Commit

Permalink
Merge pull request #431 from scalacenter/issue-127
Browse files Browse the repository at this point in the history
Fix #127: Use unexpanded names
  • Loading branch information
jvican committed Oct 16, 2017
2 parents 1a7dc5d + 797855f commit aa1a628
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/compiler-bridge/src/main/scala/xsbt/ClassName.scala
Expand Up @@ -68,15 +68,19 @@ trait ClassName extends Compat {
*
* If `s` represents a package object `pkg3`, then the returned name will be `pkg1.pkg2.pkg3.package`.
* If `s` represents a class `Foo` nested in package object `pkg3` then the returned name is `pkg1.pkg2.pk3.Foo`.
*
* Note that some objects with special access rights are encoded in names
* (like qualified privates `private[qualifier]`). In order to get the right
* original names, we need to use `unexpandedName`.
*/
protected def classNameAsSeenIn(in: Symbol, s: Symbol): String =
enteringPhase(currentRun.picklerPhase.next) {
if (in.isRoot || in.isRootPackage || in == NoSymbol || in.isEffectiveRoot)
s.simpleName.toString
else if (in.isPackageObjectOrClass)
in.owner.fullName + "." + s.name
in.owner.fullName + "." + s.unexpandedName
else
in.fullName + "." + s.name
in.fullName + "." + s.unexpandedName
}

private def pickledName(s: Symbol): Name =
Expand Down
19 changes: 19 additions & 0 deletions zinc/src/sbt-test/source-dependencies/unexpanded-names/Foo.scala
@@ -0,0 +1,19 @@
class Fooo {
// This one is problematic because of expanded names
private[Fooo] object Bar
}

package issue127 {
class Foo {
private[Foo] object Bar
class Baz {
private[Baz] object Bazz
}
}

object Foo {
private[issue127] class Bippy
// This one is problematic because of expanded names
private[issue127] object Bippy
}
}
2 changes: 2 additions & 0 deletions zinc/src/sbt-test/source-dependencies/unexpanded-names/test
@@ -0,0 +1,2 @@
# See https://github.com/sbt/zinc/issues/127
> compile

0 comments on commit aa1a628

Please sign in to comment.