From 24bc239cfecca609a62d30a40ceae745fa8318cf Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 23 Jul 2014 19:04:25 +0200 Subject: Added elimLocals miniphase This phase drops the Local flag from all private[this] and protected[this] members. This allows subsequent code motions where code is moved from a class to its companion object. It invalidates variance checking, which is consequently disabled when retyping. --- src/dotty/tools/dotc/typer/Typer.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/typer/Typer.scala') diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 0ce02d198..d5153bf13 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -844,7 +844,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit checkNoDoubleDefs(cls) val impl1 = cpy.Template(impl, constr1, parents1, self1, body1) .withType(dummy.termRef) - VarianceChecker.check(impl1) + checkVariance(impl1) assignType(cpy.TypeDef(cdef, mods1, name, impl1), cls) // todo later: check that @@ -856,6 +856,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit // 4. Polymorphic type defs override nothing. } + /** Overridden in retyper */ + def checkVariance(tree: Tree)(implicit ctx: Context) = VarianceChecker.check(tree) + def localDummy(cls: ClassSymbol, impl: untpd.Template)(implicit ctx: Context): Symbol = ctx.newLocalDummy(cls, impl.pos) -- cgit v1.2.3