-
Notifications
You must be signed in to change notification settings - Fork 354
Track end line numbers and column information #2499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Are there any maintainers available for review? Perhaps @hfmehmed or @ting-yuan? |
|
We really need that. Please review |
|
Thank you for the review @hfmehmed. As I don't have write access to this repository, could you please merge this PR as well? |
|
Apologies for the delay. The PR looked good to me but I will check with @ting-yuan as well about it before merging. Bear with us on this one. Thank you |
|
Thank you @hfmehmed. This hopefully shouldn't preclude merging this change, but I would appreciate it if you and @ting-yuan could share your thoughts on the |
|
@hfmehmed / @ting-yuan any updates? |
95f0581 to
9f80315
Compare
|
FWIW, I resolved the conflicts (removal of support for KSP 1). I had build failures locally in tests related to Android, none of them seem related to my changes, however. |
|
Thanks a lot for the patch and opening the discussion! Unfortunately, as you already mentioned, this patch would break the binary compatibility, meaning that processors would be required to be recompiled and re-released. I'm sorry that it was actually a bad design choice back in the early days of KSP. Instead of changing the |
|
@ting-yuan thanks for the response! Back when I was making this change, I assumed that I'm not familiar with the binary compatibility guarantees/requirements of ksp. Would you consider this PR breaking even if downstream users only read |
This change aims to improve source location tracking for purposes of error reporting. I deliberately maintained backwards compatibility, however the (original) choice of
textOffsetfor determining the line number is questionable, as it typically points to the node's identifier rather than to the actual start of the node in the source code.For example, in the test for
f1, the reportedFileLocationpoints to the start of the identifierf1rather than to the keywordvoid.I would argue a more correct implementation would use
startOffsetrather thantextOffset, perhaps exposingtextOffsetvia another property ofFileLocation. I'm happy to make changes here but went with the backwards-compatible default.One more thing that occurred to me is that these line & column coordinates could be tracked in smaller classes still and exposed as two (or more) pairs in
FileLocation, e.g. something likemight be a better model. Such a backwards-incompatible API change might be rejected outright or take too long to incorporate and I'd personally prefer some column information rather than none. I'm happy to propose the necessary changes if maintainers are willing.