Skip to content

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

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

Open
grynspan opened this issue May 26, 2025 · 0 comments
Labels
Macros Issues in the SwiftSyntaxMacro… modules

Comments

@grynspan
Copy link
Contributor

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 grynspan added the Macros Issues in the SwiftSyntaxMacro… modules label May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Macros Issues in the SwiftSyntaxMacro… modules
Projects
None yet
Development

No branches or pull requests

1 participant