Skip to content

Compiler loses position offset of macro diagnostic #80110

@stephencelis

Description

@stephencelis

Description

The compiler is not pointing to the position of a diagnostic embedded in a string literal expression.

See https://forums.swift.org/t/macro-diagnostic-position-ignored/78640 for more details.

Reproduction

MacroPositionDiagnosticBug.zip

Image
main.swift:3:7: warning: This warning should be anchored at the 3rd character (from macro 'test')
1 | import MacroPositionDiagnosticBug
2 | 
3 | #test("hello")
  |       `- warning: This warning should be anchored at the 3rd character (from macro 'test')
4 | 

Expected behavior

I expect the compiler (and Xcode) to point to the diagnostic's given position.

Environment

swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.5 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.swift macroFeature → declarations: Swift `macro` declarations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions