From ba8d9ea2e4b887fc0faa1f636aade84c45292144 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 10 Mar 2014 11:06:49 +0100 Subject: Fix for t1002 Need to compile the self type of a class not in the context of the class members but one context further out. Reason: self type should not be able to see the members. --- src/dotty/tools/dotc/typer/Typer.scala | 2 +- 1 file changed, 1 insertion(+), 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 51eba3b02..6a1d279df 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -786,7 +786,7 @@ 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).asInstanceOf[ValDef] + 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)) checkNoDoubleDefs(cls) -- cgit v1.2.3