diff options
author | Martin Odersky <odersky@gmail.com> | 2015-05-05 10:49:56 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-05-05 10:49:56 +0200 |
commit | 3edf285a48f4208b209571580f8aa418ca8a794f (patch) | |
tree | 501eae90bbf5fb5d82ed538e0f6984fafde655ea /src/dotty/tools/dotc/core/Types.scala | |
parent | 6780dbd0a66fdaec6a7be2faac78620e8922cbd4 (diff) | |
download | dotty-3edf285a48f4208b209571580f8aa418ca8a794f.tar.gz dotty-3edf285a48f4208b209571580f8aa418ca8a794f.tar.bz2 dotty-3edf285a48f4208b209571580f8aa418ca8a794f.zip |
Rename isWeakRef -> isTightPrefix
isWeakRef was confusing because this has nothing to do with
weak pointers.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 97e3f0390..f7abbf14c 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -126,14 +126,16 @@ object Types { false } - /** Same as `isRef`, but follows more types: all type proxies as well as and- and or-types */ - private[Types] def isWeakRef(sym: Symbol)(implicit ctx: Context): Boolean = stripTypeVar match { - case tp: NamedType => tp.info.isWeakRef(sym) + /** Does this type refer exactly to class symbol `sym`, instead of to a subclass of `sym`? + * Implemented like `isRef`, but follows more types: all type proxies as well as and- and or-types + */ + private[Types] def isTightPrefix(sym: Symbol)(implicit ctx: Context): Boolean = stripTypeVar match { + case tp: NamedType => tp.info.isTightPrefix(sym) case tp: ClassInfo => tp.cls eq sym case tp: Types.ThisType => tp.cls eq sym - case tp: TypeProxy => tp.underlying.isWeakRef(sym) - case tp: AndType => tp.tp1.isWeakRef(sym) && tp.tp2.isWeakRef(sym) - case tp: OrType => tp.tp1.isWeakRef(sym) || tp.tp2.isWeakRef(sym) + case tp: TypeProxy => tp.underlying.isTightPrefix(sym) + case tp: AndType => tp.tp1.isTightPrefix(sym) && tp.tp2.isTightPrefix(sym) + case tp: OrType => tp.tp1.isTightPrefix(sym) || tp.tp2.isTightPrefix(sym) case _ => false } @@ -1229,7 +1231,7 @@ object Types { case d: SymDenotation => if (this.isInstanceOf[WithFixedSym]) d.current else if (d.validFor.runId == ctx.runId || ctx.stillValid(d)) - if (prefix.isWeakRef(d.owner) || d.isConstructor) d.current + if (prefix.isTightPrefix(d.owner) || d.isConstructor) d.current else recomputeMember(d) // symbol could have been overridden, recompute membership else { val newd = loadDenot |