scala/scala — pull request #3136 by dotta (2013-11-14 11:11:09+00:00)
Title: SI-7915 Corrected range positions created during default args expansion

The tree created during expansion of default arguments contained trees with the
wrong type of positions. In particular:

* The synthetic $qual should have a transparent position.
* The new Select tree should always have a range position, because `selected`
(i.e., the called method) is always visible in the source.
* The Block that contains the expanded default arguments is transparent.

The only tricky part of the fix is the position assigned to the new Select
tree, which needs to respect the range position's invariants. In the specific
case, we ought to make sure that range positions don't overlap. Therefore, the
position assigned to the new Select tree is computed by intersecting the
original Select position (i.e., `baseFun`'s position) and the original
qualifier's position (i.e., `qual`'s position). Furthermore, calling
`withStart` would turn any position in a range position, which isn't
desiderable in general (and, even worse, this could lead to generation of
invalid - bad offsets - positions). Hence, the computation is only performed
when both `baseFun` and `qual` positions are range positions. I expect this to
be always the case if the compiler is started with -Yrangepos. In fact, I
wonder if I should add an assertion that validates this assumption.