Skip to content

Commit ba4ba5e

Browse files
committed
Fix wrong period for creating nested ctx in TreeTransforms.
`owner` for nestedContext in `TreeTransforms` was assigned using initial period of whole `TreeTransforms` block. That is incorrect as denotation for this owner could have been create by some phase in this block.
1 parent 53caec0 commit ba4ba5e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/dotty/tools/dotc/transform/TreeTransform.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,10 +1130,13 @@ object TreeTransforms {
11301130

11311131
def transform(tree: Tree, info: TransformerInfo, cur: Int)(implicit ctx: Context): Tree = ctx.traceIndented(s"transforming ${tree.show} at ${ctx.phase}", transforms, show = true) {
11321132
if (cur < info.transformers.length) {
1133+
// if cur > 0 then some of the symbols can be created by already performed transformations
1134+
// this means that their denotations could not exists in previous periods
1135+
val pctx = ctx.withPhase(info.transformers(cur))
11331136
tree match {
11341137
//split one big match into 2 smaller ones
1135-
case tree: NameTree => transformNamed(tree, info, cur)
1136-
case tree => transformUnnamed(tree, info, cur)
1138+
case tree: NameTree => transformNamed(tree, info, cur)(pctx)
1139+
case tree => transformUnnamed(tree, info, cur)(pctx)
11371140
}
11381141
} else tree
11391142
}

0 commit comments

Comments
 (0)