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

SI-8868 Fix unpickling of local dummy symbols #4013

Merged
merged 1 commit into from
Sep 30, 2014
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 10 additions & 2 deletions src/reflect/scala/reflect/internal/pickling/UnPickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,14 @@ abstract class UnPickler {
} getOrElse "")
}

def localDummy = {
if (nme.isLocalDummyName(name))
owner.newLocalDummy(NoPosition)
else NoSymbol
}

// (1) Try name.
fromName(name) orElse {
localDummy orElse fromName(name) orElse {
// (2) Try with expanded name. Can happen if references to private
// symbols are read from outside: for instance when checking the children
// of a class. See #1722.
Expand Down Expand Up @@ -298,6 +304,7 @@ abstract class UnPickler {
* (.) ...
* (1) `local child` represents local child classes, see comment in Pickler.putSymbol.
* Since it is not a member, it should not be entered in the owner's scope.
* (2) Similarly, we ignore local dummy symbols, as seen in SI-8868
*/
def shouldEnterInOwnerScope = {
sym.owner.isClass &&
Expand All @@ -307,7 +314,8 @@ abstract class UnPickler {
!sym.isRefinementClass &&
!sym.isTypeParameter &&
!sym.isExistentiallyBound &&
sym.rawname != tpnme.LOCAL_CHILD // (1)
sym.rawname != tpnme.LOCAL_CHILD && // (1)
!nme.isLocalDummyName(sym.rawname) // (2)
}

markFlagsCompleted(sym)(mask = AllFlags)
Expand Down
1 change: 1 addition & 0 deletions test/files/pos/t8868a/Sub_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class Sub extends T
6 changes: 6 additions & 0 deletions test/files/pos/t8868a/T_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class C

trait T {
@deprecated(since = "", message = "")
class X
}
2 changes: 2 additions & 0 deletions test/files/pos/t8868b/Sub_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Sub extends T

4 changes: 4 additions & 0 deletions test/files/pos/t8868b/T_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@deprecated(since = "2.4.0", message = "")
trait T {
class X
}
2 changes: 2 additions & 0 deletions test/files/pos/t8868c/Sub_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Sub extends T

9 changes: 9 additions & 0 deletions test/files/pos/t8868c/T_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class C(a: Any) extends annotation.StaticAnnotation

@C({val x = 0; x})
trait T {
class X

@C({val x = 0; x})
def foo = 42
}