-
Notifications
You must be signed in to change notification settings - Fork 82
Description
There are some actions you can perform on a loc variable which makes it point to an entirely different file — like appending a string to it or doing .parent (possibly many others, these two were just the source of the bug in my Rascal program that we spent some time catching this week). However, as it is now, these actions inherit offset and all the other trailing things from the original location.
As a result, you can have situations when you have constructed a new location in your code to point to something like another file in the same folder, but if you do readFile on it, it will read whatever the selected span was in the original file, which makes no sense. Fixing it with .top is easy, but catching and debugging is not, especially if you have something that must run across several OSs and entry points. Besides, it's probably not the semantics you want anyway.
I still have the push rights and am willing to adjust this (especially if pointed towards the modules which cover it), just didn't feel comfortable doing it without proper explicit discussion. This change would not be backward compatible. Yet, it is hard to think of code that was written in good conscience which would be harmed by this.
Let me know what you think.