swift-testing
swift-testing copied to clipboard
Replace `#fileID`, `#filePath`, `#line`, and `#column` with a single macro.
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:
- [x] Code and documentation should follow the style of the Style Guide.
- [x] If public symbols are renamed or modified, DocC references should be updated.
@swift-ci please test
@swift-ci please test
@swift-ci please test Windows
@swift-ci please test
@swift-ci please test
@swift-ci please test Linux