swift
swift copied to clipboard
always use the argNames constructor for macro DeclNames
Resolves rdar://110179186
When a macro without parameters is loaded from a built module, its DeclName is different than when it is loaded directly from source code. The deserialized macro is missing the () at the end of its name. This creates an inconsistent representation in symbol graphs, depending on whether the symbol graph is created during a regular compile or via swift-symbolgraph-extract on a previously-built module. This PR updates the deserialization logic for macros to always use the DeclName constructor that accepts a list of argument names, even when there are no argument names to load. This allows parameterless macros to have the same DeclName regardless of whether it was loaded from source code or a compiled module.
@swift-ci Please smoke test
/Users/ec2-user/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/swift/test/SourceKit/Refactoring/shorthand_shadow.swift:35:14: error: BUILTIN: expected string not found in input
// BUILTIN: error: cannot rename system symbol 'file'
^
<stdin>:1:1: note: scanning from here
{
^
<stdin>:14:102: note: possible intended match here
error response (Request Failed): SOURCE_DIR/test/SourceKit/Refactoring/shorthand_shadow.swift:31:10: error: cannot rename system symbol 'file()'
@DougGregor It looks like this also affects the built-in #file/#line/etc in diagnostics like this. Is that acceptable? If so i can update this test too.
@swift-ci Please smoke test