diff options
author | Martin Odersky <odersky@gmail.com> | 2014-04-03 17:57:23 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-04-08 16:56:18 +0200 |
commit | 3486eb0088f78e8ca93c0bc8f883c2af53ee7d3d (patch) | |
tree | dabec550963a84d9f6c72feb800117661aab6e36 /src/dotty/tools/dotc/typer/Typer.scala | |
parent | 879a0b25f2129a1f723953f3cd8f8c82d8ff7f62 (diff) | |
download | dotty-3486eb0088f78e8ca93c0bc8f883c2af53ee7d3d.tar.gz dotty-3486eb0088f78e8ca93c0bc8f883c2af53ee7d3d.tar.bz2 dotty-3486eb0088f78e8ca93c0bc8f883c2af53ee7d3d.zip |
Avoid creating a local dummy when retyping.
Retyping should not create new symbols and that includes local dummys.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 60acda4b7..6e613975b 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -809,11 +809,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val parents1 = ensureConstrCall(ensureFirstIsClass( parents mapconserve typedParent, cdef.pos.toSynthetic)) val self1 = typed(self)(ctx.outer).asInstanceOf[ValDef] // outer context where class memebers are not visible - val localDummy = ctx.newLocalDummy(cls, impl.pos) - val body1 = typedStats(body, localDummy)(inClassContext(self1.symbol)) + val dummy = localDummy(cls, impl) + val body1 = typedStats(body, dummy)(inClassContext(self1.symbol)) checkNoDoubleDefs(cls) val impl1 = cpy.Template(impl, constr1, parents1, self1, body1) - .withType(localDummy.termRef) + .withType(dummy.termRef) assignType(cpy.TypeDef(cdef, mods1, name, impl1), cls) // todo later: check that @@ -825,6 +825,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit // 4. Polymorphic type defs override nothing. } + def localDummy(cls: ClassSymbol, impl: untpd.Template)(implicit ctx: Context): Symbol = + ctx.newLocalDummy(cls, impl.pos) + def typedImport(imp: untpd.Import, sym: Symbol)(implicit ctx: Context): Import = track("typedImport") { val expr1 = typedExpr(imp.expr, AnySelectionProto) checkStable(expr1.tpe, imp.expr.pos) |