Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #127: Use unexpanded names #431

Merged
merged 3 commits into from Oct 16, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought @eed3si9n said no Bippys? 😝

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dingos are also available.

}
}
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