From aae71e7e37761aa159b0d00f7b98a388be9a40cf Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 18 Aug 2014 13:31:21 +0200 Subject: Make local dummy a non-member type. Local dummys in templates are not members of their enclosing classes. --- src/dotty/tools/dotc/ast/tpd.scala | 2 +- src/dotty/tools/dotc/typer/Typer.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/dotty') diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index 87cbbc249..f6940f635 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -237,7 +237,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { val localDummy = ((NoSymbol: Symbol) /: body)(findLocalDummy) .orElse(ctx.newLocalDummy(cls)) val impl = untpd.Template(constr, parents, selfType, newTypeParams ++ body) - .withType(localDummy.termRef) + .withType(localDummy.nonMemberTermRef) ta.assignType(untpd.TypeDef(Modifiers(cls), cls.name, impl), cls) } diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 7473e76f6..7d8eb7f98 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -840,12 +840,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val constr1 = typed(constr).asInstanceOf[DefDef] 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 self1 = typed(self)(ctx.outer).asInstanceOf[ValDef] // outer context where class members are not visible 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(dummy.termRef) + .withType(dummy.nonMemberTermRef) checkVariance(impl1) assignType(cpy.TypeDef(cdef)(mods1, name, impl1, Nil), cls) -- cgit v1.2.3