swift-syntax icon indicating copy to clipboard operation
swift-syntax copied to clipboard

ER: Ability to specify the source file containing a diagnostic during macro expansion

Open grynspan opened this issue 9 months ago • 1 comments

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.

grynspan avatar May 26 '25 02:05 grynspan

Tracked by Apple as rdar://152019216.

grynspan avatar Jun 14 '25 14:06 grynspan