diff options
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 10 |
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) || |