aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-02-21 14:08:39 +0100
committerMartin Odersky <odersky@gmail.com>2013-02-21 14:08:39 +0100
commit58b7b61fb8ffda09dbec4427476a47b4e3a505bc (patch)
tree10179fe6510d9d059cd8767f05ea0e4fe7f60e70 /src/dotty/tools/dotc/core/SymDenotations.scala
parent3c2d0d752dcb690bd37622cf8593bc359d6b35aa (diff)
downloaddotty-58b7b61fb8ffda09dbec4427476a47b4e3a505bc.tar.gz
dotty-58b7b61fb8ffda09dbec4427476a47b4e3a505bc.tar.bz2
dotty-58b7b61fb8ffda09dbec4427476a47b4e3a505bc.zip
More utility methods and split up filter
More utility methods in types. Also replaced Denotation#filter with a set of more useful operations.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 73d14141c..2bafb7732 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -198,12 +198,13 @@ object SymDenotations {
|| (this.sourceFile.canonicalPath == that.sourceFile.canonicalPath)
)
- /** Is this a denotation of a stable term? */
- final def isStable(implicit ctx: Context) = !(
- isTerm &&
- this.is(UnstableValue, butNot = Stable) ||
- info.isVolatile && !hasAnnotation(defn.uncheckedStableClass)
- )
+ /** Is this a denotation of a stable term (or an arbitrary type)? */
+ final def isStable(implicit ctx: Context) = {
+ val isUnstable =
+ this.is(UnstableValue, butNot = Stable) ||
+ info.isVolatile && !hasAnnotation(defn.uncheckedStableClass)
+ !(isTerm && isUnstable)
+ }
/** Is this a subclass of the given class `base`? */
def isSubClass(base: Symbol)(implicit ctx: Context) = false
@@ -382,7 +383,7 @@ object SymDenotations {
*/
def companionModule(implicit ctx: Context): Symbol = {
owner.info.decl(name.toTermName)
- .filter(sym => sym.isModule && sym.isCoDefinedWith(symbol))
+ .suchThat(sym => sym.isModule && sym.isCoDefinedWith(symbol))
.symbol
}
@@ -392,7 +393,7 @@ object SymDenotations {
*/
def companionClass(implicit ctx: Context): Symbol =
owner.info.decl(name.toTypeName)
- .filter(sym => sym.isClass && sym.isCoDefinedWith(symbol))
+ .suchThat(sym => sym.isClass && sym.isCoDefinedWith(symbol))
.symbol
/** If this is a class, the module class of its companion object.