Let me try to answer that: As you know, trees that have a direct
correspondence in the source code have a RangePosition, and compiler-generated
trees have an OffsetPosition. By INV1 in Position.scala, "a tree with an offset
position never contains a child with a range position". The problem is that
there are ASTs that don't have a source-code correspondence but still have
children that are visible in the source. So that's where the
TransparentPositions come into play, for example:
"abc".charAt _
is represented as a Function tree, where the Function, the parameter ValDef
and the Apply all have a TransparentPosition, and the Select(Literal(""),
"charAt") has a RangePosition.
I hope this helps,
Mirko
--
Mirko Stocker | m...@misto.ch
Work: http://ifs.hsr.ch | http://infoq.com
Personal: http://misto.ch | http://twitter.com/m_st
The doc comment to scala.tools.nsc.util.Position is really required
reading for anyone dealing with positions.
Cheers
- Martin
Mirko is correct. One more point: Trees with range positions may not
overlap. So If you want to create two Range position trees that do
have subtrees with interleaving range positions, one of them must be a
transparent position.
The doc comment to scala.tools.nsc.util.Position is really required
reading for anyone dealing with positions.
Cheers
- Martin
I meant opaque range positions may not overlap, where an opaque range
position is a range position that is not also a transparent range
position. See INV 3 in the doc comment.
Cheers
- Martin
> Cheers
>
> - Martin
>
>
>
> ---------------
> Mirco Dotta
> Typesafe - The software stack for applications that scale
> PSE-D, 1015 Lausanne, Switzerland
> Work: +41 (0)21 691 49 65
> Twitter: @mircodotta
>
>
>
>
>
>
>
>
--
Martin Odersky
Prof., EPFL and Chairman, Typesafe
PSED, 1015 Lausanne, Switzerland
Tel. EPFL: +41 21 693 6863
Tel. Typesafe: +41 21 691 4967