Skip to content

Commit eef4d68

Browse files
committed
Refinement to TreeTypeMap
When recursing in a template body, need to update the context's owner, so that `ref` can work correctly.
1 parent 1604976 commit eef4d68

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/dotty/tools/dotc/ast/TreeTypeMap.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ final class TreeTypeMap(
8282
constr = tmap.transformSub(constr),
8383
parents = parents mapconserve transform,
8484
self = tmap.transformSub(self),
85-
body = impl.body mapconserve tmap.transform
85+
body = impl.body mapconserve
86+
(tmap.transform(_)(ctx.withOwner(mapOwner(impl.symbol.owner))))
8687
).withType(tmap.mapType(impl.tpe))
8788
case tree1 =>
89+
println(i"tree type map $tree1, owner = ${ctx.owner}")
8890
tree1.withType(mapType(tree1.tpe)) match {
8991
case id: Ident if tpd.needsSelect(id.tpe) =>
9092
ref(id.tpe.asInstanceOf[TermRef]).withPos(id.pos)

0 commit comments

Comments
 (0)