From 0c0b48df290e8a1c32b8f8a401f6acbae20d5a28 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 9 Aug 2023 08:59:26 +0200 Subject: [PATCH] Add comment on Template case of TreeMap [Cherry-picked 7dd263d1083a8bd1cc43ba509b0fdb5ee873facb] --- compiler/src/dotty/tools/dotc/ast/Trees.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/src/dotty/tools/dotc/ast/Trees.scala b/compiler/src/dotty/tools/dotc/ast/Trees.scala index b67345f437dc..8d19dfdf6743 100644 --- a/compiler/src/dotty/tools/dotc/ast/Trees.scala +++ b/compiler/src/dotty/tools/dotc/ast/Trees.scala @@ -1574,6 +1574,9 @@ object Trees { case tree @ TypeDef(name, rhs) => cpy.TypeDef(tree)(name, transform(rhs)) case tree @ Template(constr, parents, self, _) if tree.derived.isEmpty => + // Currently we do not have cases where we expect `tree.derived` to contain trees for typed trees. + // If it is the case we will fall in `transformMoreCases` and throw an exception there. + // In the future we might keep the `derived` clause after typing, in that case we might want to start handling it here. cpy.Template(tree)(transformSub(constr), transform(tree.parents), Nil, transformSub(self), transformStats(tree.body, tree.symbol)) case Import(expr, selectors) => cpy.Import(tree)(transform(expr), selectors)