Skip to content

Commit

Permalink
Merge pull request #4013 from retronym/ticket/8868
Browse files Browse the repository at this point in the history
SI-8868 Fix unpickling of local dummy symbols
  • Loading branch information
lrytz committed Sep 30, 2014
2 parents 2cfac1a + bcd1e4f commit b413ee3
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 2 deletions.
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
}

0 comments on commit b413ee3

Please sign in to comment.