diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-20 14:55:02 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-20 14:55:02 -0700 |
commit | cf01182857f7dc47eb865cd904fbb725f2de2e72 (patch) | |
tree | 8ec07af11311fad75e36ae73b2b1dacc6a0064ae /src | |
parent | 15fba6bd2eb45ca47e975ef033aaf20136d71c67 (diff) | |
parent | e0853b3255c5a10793b462c36b62b83963aad17b (diff) | |
download | scala-cf01182857f7dc47eb865cd904fbb725f2de2e72.tar.gz scala-cf01182857f7dc47eb865cd904fbb725f2de2e72.tar.bz2 scala-cf01182857f7dc47eb865cd904fbb725f2de2e72.zip |
Merge pull request #954 from odersky/optimize/outer
Removes redundant outers
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index ab7bbc591b..afbe528b1f 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -46,10 +46,13 @@ abstract class ExplicitOuter extends InfoTransform private def haveSameOuter(parent: Type, clazz: Symbol) = parent match { case TypeRef(pre, sym, _) => val owner = clazz.owner + + //println(s"have same outer $parent $clazz $sym ${sym.owner} $owner $pre") sym.isClass && owner.isClass && - owner == sym.owner && + (owner isSubClass sym.owner) && owner.thisType =:= pre + case _ => false } @@ -480,7 +483,7 @@ abstract class ExplicitOuter extends InfoTransform val vparamss1 = if (isInner(clazz)) { // (4) val outerParam = - sym.newValueParameter(nme.OUTER, sym.pos) setInfo outerField(clazz).info + sym.newValueParameter(nme.OUTER, sym.pos) setInfo clazz.outerClass.thisType ((ValDef(outerParam) setType NoType) :: vparamss.head) :: vparamss.tail } else vparamss super.transform(copyDefDef(tree)(vparamss = vparamss1)) |