Replace #fileID
, #filePath
, #line
, and #column
with a single macro.
#304
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have a bunch of functions that take separate, defaulted arguments for file ID, column, etc. We'd like to normalize these functions to always take a single
SourceLocation
instance, but until now there hasn't been a way to express such a thing as a default argument without capturing the wrong source location.This PR takes advantage of SE-0422 to create a new
#here
macro that does what we want here. (We can't use#sourceLocation
because the language already reserves that macro name for an unrelated use.)Because this is a new Swift 6 feature, we cannot rely on it until we drop our remaining Swift 5.10 support. Adding
#if compiler(>=5.11)
would require extensive changes and code duplication.Resolves rdar://121883259.
Checklist: