Skip to content

Replace uses of presumed locations where they do not make sense #36807

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

Merged
merged 1 commit into from
Apr 12, 2021

Conversation

bnbarham
Copy link
Contributor

@bnbarham bnbarham commented Apr 8, 2021

Various uses of getPresumedLineAndColumnForLoc were likely added when
that function was the very misleading name getLineAndColumn. Change
these to use getLineAndColumnForBuffer instead where appropriate, ie.
we want the underlying file rather than the location to display to the
user.

There were also some cases where the buffer identifier had been swapped
to use the display name instead, under the assumption that the presumed
location was needed. Updated those as well.

SingleRawComment: Lines are only used when merging comments, where the
original location is fine to use.

Index: Doesn't store the file set in #sourceLocation, so using the
presumed line would end up pointing to a location that makes no sense.

Editor functionality: Formatting, refactoring, and live diagnostics are
all for the current file. Using the presumed location would either
result in incorrect refactorings or missing errors.

@bnbarham
Copy link
Contributor Author

bnbarham commented Apr 8, 2021

@swift-ci please test

@bnbarham bnbarham force-pushed the use-original-locs branch from 40e88b5 to df3b08f Compare April 8, 2021 06:13
@bnbarham bnbarham changed the title Use original locations rather than presumed where presumed isn't actually handled properly Replace uses of presumed locations where they do not make sense Apr 8, 2021
@bnbarham
Copy link
Contributor Author

bnbarham commented Apr 8, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Apr 8, 2021

Build failed
Swift Test Linux Platform
Git Sha - df3b08f6d2a4a67751cac7a232188269303ad019

@swift-ci
Copy link
Contributor

swift-ci commented Apr 8, 2021

Build failed
Swift Test OS X Platform
Git Sha - df3b08f6d2a4a67751cac7a232188269303ad019

@swift-ci
Copy link
Contributor

swift-ci commented Apr 8, 2021

Build failed
Swift Test OS X Platform
Git Sha - df3b08f6d2a4a67751cac7a232188269303ad019

@bnbarham bnbarham force-pushed the use-original-locs branch from df3b08f to 4815034 Compare April 8, 2021 21:08
@bnbarham
Copy link
Contributor Author

bnbarham commented Apr 8, 2021

@swift-ci please test

@bnbarham bnbarham force-pushed the use-original-locs branch 2 times, most recently from f93f4cc to 925bc33 Compare April 9, 2021 23:07
@bnbarham
Copy link
Contributor Author

bnbarham commented Apr 9, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Apr 9, 2021

Build failed
Swift Test Linux Platform
Git Sha - 925bc3330aa8da4b73cf13fe847f70af2af8b06d

Various uses of `getPresumedLineAndColumnForLoc` were likely added when
that function was the very misleading name `getLineAndColumn`. Change
these to use `getLineAndColumnForBuffer` instead where appropriate, ie.
we want the underlying file rather than the location to display to the
user.

There were also some cases where the buffer identifier had been swapped
to use the display name instead, under the assumption that the presumed
location was needed. Updated those as well.

SingleRawComment: Lines are only used when merging comments, where the
original location is fine to use.

Index: Doesn't store the file set in #sourceLocation, so using the
presumed line would end up pointing to a location that makes no sense.

Editor functionality: Formatting and refactoring are on the current
file. Using the presumed location would result in incorrect
replacements.
@bnbarham bnbarham force-pushed the use-original-locs branch from 925bc33 to 20f45ec Compare April 10, 2021 00:09
@bnbarham
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 20f45ec

@bnbarham
Copy link
Contributor Author

@swift-ci please test Linux platform

@bnbarham bnbarham merged commit 299df93 into swiftlang:main Apr 12, 2021
@bnbarham bnbarham deleted the use-original-locs branch April 12, 2021 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants