aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-09-04 08:51:27 +0200
committerMartin Odersky <odersky@gmail.com>2014-09-04 08:51:27 +0200
commit652a7e5d5a1db429a7270049d51ca63f494ee64b (patch)
tree659e750c7596ea697a1f17d750e9f0592cff426e /src/dotty/tools/dotc/core
parent431288d105c6fc581eb3cb32f8b9eb53b65a11c8 (diff)
downloaddotty-652a7e5d5a1db429a7270049d51ca63f494ee64b.tar.gz
dotty-652a7e5d5a1db429a7270049d51ca63f494ee64b.tar.bz2
dotty-652a7e5d5a1db429a7270049d51ca63f494ee64b.zip
Enclosing class skips classes from inSuperCall definitions
Syntactically enclosing class is not accessible from such definitions, so should be skipped.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 2aff7fd45..487103213 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -469,7 +469,7 @@ object SymDenotations {
// for not doing this outright is speed. We would like to avoid
// creating a new context object each time we call accessWithin.
// Note that the exception should be thrown only infrequently.
- case ex: NotDefinedHere => test(ctx.withMode(Mode.FutureDefsOK))
+ case ex: NotDefinedHere => test(ctx.addMode(Mode.FutureDefsOK))
}
}
@@ -637,8 +637,12 @@ object SymDenotations {
/** The class containing this denotation.
* If this denotation is already a class, return itself
*/
- final def enclosingClass(implicit ctx: Context): Symbol =
- if (isClass || !exists) symbol else owner.enclosingClass
+ final def enclosingClass(implicit ctx: Context): Symbol = {
+ def enclClass(d: SymDenotation): Symbol =
+ if (d.isClass || !d.exists) d.symbol else enclClass(d.owner)
+ val cls = enclClass(this)
+ if (this is InSuperCall) cls.owner.enclosingClass else cls
+ }
final def isEffectivelyFinal(implicit ctx: Context): Boolean = {
(this.flags is Flags.PrivateOrFinal) || (!this.owner.isClass) ||