aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-03-12 11:58:32 +0100
committerMartin Odersky <odersky@gmail.com>2013-03-12 11:58:32 +0100
commitd1794c15f5a5743763adeb8f8e248f9ca5f53869 (patch)
tree0e86cc90d49b8e81b49f13ee7ae71647066ceced /src/dotty/tools/dotc/core/SymDenotations.scala
parent54400119585ca41c28baae1cbfbeefb76b5c912a (diff)
downloaddotty-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/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 3e1af6c9a..68aa2f0fa 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -181,13 +181,6 @@ object SymDenotations {
/** is this symbol the result of an erroneous definition? */
def isError: Boolean = false
- /** Does this denotation refer to an existing definition?
- * @return `false` if denotation is either `NoDenotation` or it
- * refers to a toplevel class or object that has no
- * definition in the source or classfile from which it is loaded.
- */
- override final def exists: Boolean = info ne NoType
-
/** Make denotation not exist */
final def markAbsent(): Unit =
_info = NoType
@@ -305,6 +298,8 @@ object SymDenotations {
/** Is this definition accessible as a member of tree with type `pre`?
* @param pre The type of the tree from which the selection is made
* @param superAccess Access is via super
+ * Everything is accessible if `pre` is `NoPrefix`.
+ * A symbol with type `NoType` is not accessible for any other prefix.
*/
final def isAccessibleFrom(pre: Type, superAccess: Boolean = false)(implicit ctx: Context): Boolean = {
@@ -354,7 +349,9 @@ object SymDenotations {
else true
}
- (pre == NoPrefix) || {
+ if (pre eq NoPrefix) true
+ else if (info eq NoType) false
+ else {
val boundary = accessBoundary(owner)
( boundary.isTerm
@@ -896,6 +893,7 @@ object SymDenotations {
object NoDenotation extends SymDenotation(
NoSymbol, NoSymbol, "<none>".toTermName, EmptyFlags, NoType) {
+ override def exists = false
override def isTerm = false
override def isType = false
override def owner: Symbol = throw new AssertionError("NoDenotation.owner")