From 3352ffc97f3577fd6de5c22a22c7c7c887e9b1f9 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 24 May 2015 13:50:32 +0200 Subject: 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). --- src/dotty/tools/dotc/core/Types.scala | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src/dotty/tools/dotc/core/Types.scala') 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. -- cgit v1.2.3