From d34a9e3d89a8e205e23a6d59e02ccf736dd572f4 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 11 Mar 2016 10:48:33 +0100 Subject: Refinement to TreeTypeMap When recursing in a template body, need to update the context's owner, so that `ref` can work correctly. --- src/dotty/tools/dotc/ast/TreeTypeMap.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/dotty/tools/dotc/ast/TreeTypeMap.scala b/src/dotty/tools/dotc/ast/TreeTypeMap.scala index d714a3d21..856a471dd 100644 --- a/src/dotty/tools/dotc/ast/TreeTypeMap.scala +++ b/src/dotty/tools/dotc/ast/TreeTypeMap.scala @@ -82,9 +82,11 @@ final class TreeTypeMap( constr = tmap.transformSub(constr), parents = parents mapconserve transform, self = tmap.transformSub(self), - body = impl.body mapconserve tmap.transform + body = impl.body mapconserve + (tmap.transform(_)(ctx.withOwner(mapOwner(impl.symbol.owner)))) ).withType(tmap.mapType(impl.tpe)) case tree1 => + println(i"tree type map $tree1, owner = ${ctx.owner}") tree1.withType(mapType(tree1.tpe)) match { case id: Ident if tpd.needsSelect(id.tpe) => ref(id.tpe.asInstanceOf[TermRef]).withPos(id.pos) -- cgit v1.2.3