Skip to content

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

@grynspan

Description

@grynspan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MacrosIssues in the SwiftSyntaxMacro… modules

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions