Typed trees not being dropped by erasure

Hi,
I found a bit of confusion related to Typed tree nodes. Comment in Trees claims that Typed nodes are being eliminated by erasure:
https://github.com/scala/scala/blob/master/src/library/scala/reflect/api/Trees.scala#L1374
However, if you check erasure it never drops Typed nodes and in one case it introduces a new one:
https://github.com/scala/scala/blob/master/src/compiler/scala/tools/nsc/transform/Erasure.scala#L938
Typed node is being introduced by erasure in a case of upcast.
I'm wondering what would be preferred way to resolve this. Either fixing erasure to really drop Typed nodes and not introduced any new ones or fix the comment in Trees.
Fixing erasure has this advantage that others (genicode, scala+gwt) doesn't need to bother with Typed nodes down the pipeline anymore. However, I don't know if dropping Typed nodes and simply setting tpe in case of upcast is a good idea.
Any advice?

-- Best regards,
Grzegorz Kossakowski

Re: Typed trees not being dropped by erasure



On Mon, Jan 16, 2012 at 3:49 AM, Grzegorz Kossakowski <grzegorz [dot] kossakowski [at] gmail [dot] com> wrote:
However, if you check erasure it never drops Typed nodes and in one case it introduces a new one:
https://github.com/scala/scala/blob/master/src/compiler/scala/tools/nsc/transform/Erasure.scala#L938
Typed node is being introduced by erasure in a case of upcast.

You can see more introduced after erasure as well (all the way to Cleanup at least) because it's the only way to generate a catch block.  Typed isn't always a type ascription, it is also used for type tests.  That has to change if we want to eliminate them in erasure.

Copyright © 2013 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland