A major source of bugs in macros and compiler plugins is failure to
preserve mutable information when transforming global.Tree
instances.
A major source of bugs in macros and compiler plugins is failure to
preserve mutable information when transforming global.Tree
instances.
Copying a global.Tree will result in the pos, symbol and
tpe fields being reset.
The global.treeCopy._ methods should be used instead of copy on
global.Tree implementations.
Note that the Modifiers.withAnnotations method adds to existing
methods instead of replacing, so we provide a more cananocial form
here in copyWithAnns.
A major source of bugs in macros and compiler plugins is failure to preserve mutable information when transforming
global.Tree
instances.Copying a
global.Tree
will result in thepos
,symbol
andtpe
fields being reset.The
global.treeCopy._
methods should be used instead ofcopy
onglobal.Tree
implementations.Note that the
Modifiers.withAnnotations
method adds to existing methods instead of replacing, so we provide a more cananocial form here incopyWithAnns
.http://docs.scala-lang.org/overviews/reflection/symbols-trees-types#trees