swiftlang / swiftlang/swift-syntax
ER: Ability to specify the source file containing a diagnostic during macro expansion
Open
Macros
- Dominant language
- Swift
- Stars
- 3.7k
- Forks
- 553
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 16
Description
I've got some use cases for macros where I end up producing an expansion that calls other macros, and those other macros may produce diagnostics. Right now, they end up pointing to the temporary file containing the first macro's expansion rather than to the original source. This makes sense in the general case, however in my case I know exactly where in the original macro expression/declaration the problem lies.
I can specify an `AbsolutePosition` when creating a `Diagnostic`, but I can't specify a filename or file ID. If I could, then I could ensure my diagnostics present correctly at compile time.
Contributor guide
Assessment
This issue has not been assessed yet.