aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Denotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-13 09:47:11 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-13 09:47:11 +0200
commit606df6573f0d0323ba58d06e8af3c1aaf844b708 (patch)
treec6e8e55b7ccc758ecb21e6a59948e65014d53e74 /src/dotty/tools/dotc/core/Denotations.scala
parent401d2012f4c99b170dec99c1f7c4251dda0b20fd (diff)
downloaddotty-606df6573f0d0323ba58d06e8af3c1aaf844b708.tar.gz
dotty-606df6573f0d0323ba58d06e8af3c1aaf844b708.tar.bz2
dotty-606df6573f0d0323ba58d06e8af3c1aaf844b708.zip
Fixing validity checking of denotations.
To get this to work, we need to store the name of a scope netry irectly in the entry. This is arguably the right model anyway. A symbol can have different denotations with different names, and it might exist under different names in different scopes. In the previous model once a symbol's name changed in some phase, all scopes referring to that symbol from previous phases would become invalid. Now, the symbol is still visible under its original name.
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/Denotations.scala9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala
index 8b5dcc5dc..e551c8af2 100644
--- a/src/dotty/tools/dotc/core/Denotations.scala
+++ b/src/dotty/tools/dotc/core/Denotations.scala
@@ -454,11 +454,10 @@ object Denotations {
def current(implicit ctx: Context): SingleDenotation = {
val currentPeriod = ctx.period
val valid = myValidFor
- def stillValid(denot: SymDenotation) =
- !denot.exists || {
- val top = denot.topLevelSym
- top.owner.info.decl(top.name).symbol eq top
- }
+ def stillValid(denot: SymDenotation): Boolean =
+ if (!denot.exists || (denot.flags is PackageClass)) true
+ else if (denot.owner is PackageClass) denot.owner.decls.lookup(denot.name) eq symbol
+ else stillValid(denot.owner)
def bringForward(): SingleDenotation = this match {
case denot: SymDenotation if stillValid(denot) =>
var d: SingleDenotation = denot