Skip to content
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

[6.0 required] Replace #fileID, #filePath, #line, and #column with a single macro. #304

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on May 22, 2024

  1. 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](https://github.com/apple/swift-evolution/blob/main/proposals/0422-caller-side-default-argument-macro-expression.md)
    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.
    grynspan committed May 22, 2024
    Configuration menu
    Copy the full SHA
    b3c34c4 View commit details
    Browse the repository at this point in the history