scala/scala — pull request #1615 by retronym (2012-11-13 18:46:35+00:00)
Title: SI-6448 copyAttrs must preserve TypeTree#wasEmpty

This field tracks whether the type is an inferred
on, subject to removal in `resetAttrs`, or an explicit
type, which must remain.

In ae5ff662, `ResetAttrs` was modified to duplicate
trees, rather than mutate trees in place. But the
tree copier didn't pass `wasEmpty` on to the new tree,
which in turn meant that the subsequent typing run
on the tree would not re-infer the types. If the
type refers to a local class, e.g. the anonymous
function in the enclosed test case, the reference
to the old symbol would persist.

This commit overrides `copyAttrs` in TypeTree to
copy `wasEmpty`.

We might consider representing this as a tree
attachment, but this would need to be validated
for the performance impact.

Review by @lrytz