diff options
author | Martin Odersky <odersky@gmail.com> | 2013-03-12 11:58:32 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-03-12 11:58:32 +0100 |
commit | d1794c15f5a5743763adeb8f8e248f9ca5f53869 (patch) | |
tree | 0e86cc90d49b8e81b49f13ee7ae71647066ceced /src/dotty/tools/dotc/core/Denotations.scala | |
parent | 54400119585ca41c28baae1cbfbeefb76b5c912a (diff) | |
download | dotty-d1794c15f5a5743763adeb8f8e248f9ca5f53869.tar.gz dotty-d1794c15f5a5743763adeb8f8e248f9ca5f53869.tar.bz2 dotty-d1794c15f5a5743763adeb8f8e248f9ca5f53869.zip |
Revising of Denotation#exists
exists now is only false for NoDenotation. A denotation with NoType as info counts as existing, but it is not accessible from any prefix.
Also, renamed binary exists, forall or existsPart, forallParts to avoid ambiguities.
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 02b1550d5..170233ee2 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -140,12 +140,7 @@ object Denotations { /** The variant of this denotation that's current in the given context. */ def current(implicit ctx: Context): Denotation - /** Does this denotation exist? - * A denotation does not exist if it has NoType as an info. - * This is the case for NoDenotation, and also for SymDenotations - * that come from package members (classes or modules) where no - * corresponding symbol was found in a classfile or source. - */ + /** Is this denotation different from NoDenotation? */ def exists: Boolean = true /** If this denotation does not exist, fallback to alternative */ @@ -184,7 +179,7 @@ object Denotations { */ def requiredSymbol(p: Symbol => Boolean, name: Name, source: AbstractFile = null)(implicit ctx: Context): Symbol = { val sym = disambiguate(p).symbol - if (sym != NoSymbol) sym // note would like to ask sym.exists instead, but this would force too much + if (sym.exists) sym else { val firstSym = ((NoSymbol: Symbol) /: alternatives.map(_.symbol)) (_ orElse _) val owner = if (firstSym.exists) firstSym.owner else NoSymbol |