aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-11-25 22:17:54 +0100
committerMartin Odersky <odersky@gmail.com>2013-11-25 22:18:07 +0100
commit537e29676b0706de1855fe763b87732b846931f4 (patch)
treef209c1083213dbdb4cd6e771dc64a7bd25d790b9 /src/dotty/tools/dotc/core/SymDenotations.scala
parente88c9f2f7c7b2095a1f280d3efceee917e209e4a (diff)
downloaddotty-537e29676b0706de1855fe763b87732b846931f4.tar.gz
dotty-537e29676b0706de1855fe763b87732b846931f4.tar.bz2
dotty-537e29676b0706de1855fe763b87732b846931f4.zip
Dropping the Expanded when computing type parameter variances.
Did not look like it was needed, after all; Local alone is enough.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 08e9a407a..2727095cf 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -528,6 +528,8 @@ object SymDenotations {
final def enclosingClass(implicit ctx: Context): Symbol =
if (isClass) symbol else owner.enclosingClass
+ /** The class containing this denotation which has the given name.
+ */
final def enclosingClassNamed(name: Name)(implicit ctx: Context): Symbol = {
val cls = enclosingClass
if (cls.name == name) cls else cls.owner.enclosingClassNamed(name)
@@ -537,16 +539,15 @@ object SymDenotations {
* except for a toplevel module, where its module class is returned.
*/
final def topLevelClass(implicit ctx: Context): Symbol = {
- val sym = topLevelSym
+ def topLevel(d: SymDenotation): Symbol = {
+ if ((d is PackageClass) || (d.owner is PackageClass)) d.symbol
+ else topLevel(d.owner)
+ }
+ val sym = topLevel(this)
if (sym.isClass) sym else sym.moduleClass
}
- /** The top-level symbol containing this denotation. */
- final def topLevelSym(implicit ctx: Context): Symbol =
- if ((this is PackageClass) || (owner is PackageClass)) symbol
- else owner.topLevelSym
-
- /** The package containing this denotation */
+ /** The package class containing this denotation */
final def enclosingPackage(implicit ctx: Context): Symbol =
if (this is PackageClass) symbol else owner.enclosingPackage
@@ -676,14 +677,6 @@ object SymDenotations {
else if (this is Contravariant) -1
else 0
- /** If this is a privatye[this] or protected[this] type parameter or type member,
- * its variance, otherwise 0.
- */
- final def localVariance: Int =
- if (this is LocalCovariant) 1
- else if (this is LocalContravariant) -1
- else 0
-
override def toString = {
val kindString =
if (this is ModuleClass) "module class"