diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-24 17:32:27 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-24 17:50:52 +0200 |
commit | bdefca99bc8a7ef6c1d895aecad66b81a18fa9e7 (patch) | |
tree | 49e519fb8a9bc45959f00e558e82a9655d0063b7 /src/dotty/tools/dotc/typer/TypeAssigner.scala | |
parent | 412fc2ce472acf8b59dba05ee96d3c09a6bb2d41 (diff) | |
download | dotty-bdefca99bc8a7ef6c1d895aecad66b81a18fa9e7.tar.gz dotty-bdefca99bc8a7ef6c1d895aecad66b81a18fa9e7.tar.bz2 dotty-bdefca99bc8a7ef6c1d895aecad66b81a18fa9e7.zip |
Fix context for super calls
Super calls need to have special contexts, going beyond super-mode.
It's explained in detail in Context#superCallContext.
this(...) calls also need special contexts, but this is not enabled yet
(some tests fail, need to track down why).
Diffstat (limited to 'src/dotty/tools/dotc/typer/TypeAssigner.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/TypeAssigner.scala | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala index 50b0fe8c1..7bb6fccc3 100644 --- a/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -12,20 +12,12 @@ import config.Printers._ trait TypeAssigner { import tpd._ - /** The enclosing class, except if we are in a super call, in which case - * it is the next outer one. - */ - def effectiveEnclosingClass(implicit ctx: Context) = { - val enclClass = ctx.owner.enclosingClass - if ((ctx.mode is Mode.InSuperCall) && enclClass.exists) enclClass.owner.enclosingClass - else enclClass - } - /** The qualifying class of a this or super with prefix `qual` (which might be empty). * @param packageOk The qualifier may refer to a package. */ def qualifyingClass(tree: untpd.Tree, qual: Name, packageOK: Boolean)(implicit ctx: Context): Symbol = { - effectiveEnclosingClass.ownersIterator.find(o => qual.isEmpty || o.isClass && o.name == qual) match { + def qualifies(sym: Symbol) = sym.isClass && (qual.isEmpty || sym.name == qual) + ctx.outersIterator.map(_.owner).find(qualifies) match { case Some(c) if packageOK || !(c is Package) => c case _ => |