-
Notifications
You must be signed in to change notification settings - Fork 465
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
From my forums forums topic https://forums.swift.org/t/macro-expansion-failing-involving-sourcelocation/83250:
The code I used at one place is:
context.location(
of: declaration.body!.statements,
at: .beforeLeadingTrivia,
filePathMode: .filePath
)The file path on Windows involves backslashes, I am guessing that this leads to the file path being written as #"..."# in the outer macro expansion which in turn leads to the described error. The compilation errors in the above package (you have to build including the tests: swift build --build-tests) are absent if I use the following code (with .fileID instead of .filePath):
context.location(
of: declaration.body!.statements,
at: .beforeLeadingTrivia,
filePathMode: .fileID
)But with .fileID the relocation of errors does not work, so the .filePath seems to be needed and a correction of the described problem is important.
Steps to Reproduce
- Check out https://github.com/stefanspringer1/Pipeline.git at commit number a8445b6ac3b5ecb8185647528ba4ce96e6784247 (tag: 1.0.12).
- Building including the tests (
swift build --build-test) is successful on macOS - Building including the tests on Windows results in the errors
macro expansion @Step:3:5: error: '#sourceLocation' cannot be an extended escaping string literal
...
macro expansion @Step:10:5: error: parameterless closing #sourceLocation() directive without prior opening #sourceLocation(file:,line:) directive
...
Environment
- Swift 6.2.1 on Windows (x86_64 and ARM) and macOS.
- swift-syntax 602.0.0.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working