aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-05-24 13:50:32 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-06 11:04:53 +0200
commit3352ffc97f3577fd6de5c22a22c7c7c887e9b1f9 (patch)
treec2b31cca0fe9f6f05769c2dd6298f0d20c403257 /src/dotty/tools/dotc/core/Types.scala
parentc8a479255745d7de391f386bbf8946233ff46f7d (diff)
downloaddotty-3352ffc97f3577fd6de5c22a22c7c7c887e9b1f9.tar.gz
dotty-3352ffc97f3577fd6de5c22a22c7c7c887e9b1f9.tar.bz2
dotty-3352ffc97f3577fd6de5c22a22c7c7c887e9b1f9.zip
Tighten isStable predicate
A term ref is stable only if its prefix is also stable. At the same time, we drop stability requirements where they no longer make sense (e.g. in isLegalPrefix).
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index ae9088f00..8825f396d 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -90,7 +90,7 @@ object Types {
/** Does this type denote a stable reference (i.e. singleton type)? */
final def isStable(implicit ctx: Context): Boolean = this match {
- case tp: TermRef => tp.termSymbol.isStable
+ case tp: TermRef => tp.termSymbol.isStable && tp.prefix.isStable
case _: SingletonType => true
case NoPrefix => true
case _ => false
@@ -154,18 +154,6 @@ object Types {
false
}
- /** A type T is a legal prefix in a type selection T#A if
- * T is stable or T contains no abstract types except possibly A.
- * !!! Todo: What about non-final vals that contain abstract types?
- */
- final def isLegalPrefixFor(selector: Name)(implicit ctx: Context): Boolean =
- isStable || {
- val absTypeNames = memberNames(abstractTypeNameFilter)
- if (absTypeNames.nonEmpty) typr.println(s"abstract type members of ${this.showWithUnderlying()}: $absTypeNames")
- absTypeNames.isEmpty ||
- absTypeNames.head == selector && absTypeNames.tail.isEmpty
- }
-
/** Is this type guaranteed not to have `null` as a value?
* For the moment this is only true for modules, but it could
* be refined later.