A few things about rangepos:
- if you try to run any code with 'scalac -Ybrowse:typer -Yrangepos
FILE.scala' you will see that most of the trees have range positions.
- some don't, yes, that's a bit unfortunate but we are trying to improve
on that - actually whenever you find such in Yrangepos mode it is
possible that it is a bug. The situation has improved dramatically from
2.9 to 2.10.0-snapshots.
- syntactic trees are often assigned offset positions (this is something
you might be experiencing but I would have to see an example)
- for the compiler we only care if range positions are valid up to (and
including) typer. after that, we don't care. You are running your tool
after refchecks from what I can see, this can interfere with a couple of
transformations that happen in refchecks which can manipulate/assign
range- or offset- positions.
- if you haven't done so already, have a look at the top comments in
https://github.com/scala/scala/blob/master/src/compiler/scala/tools/nsc/interactive/RangePositions.scala
for more info on range positions.
That said, I would be happy to have look at any code examples that you
think should have range positions and they don't.
Thanks,
hubert
You might want to look at
https://github.com/paulp/scala/branches/topic/positions
where among other things I added a sourceCode method to Position.