Skip to content

always use the argNames constructor for macro DeclNames #66497

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

Merged
merged 2 commits into from
Jun 12, 2023

Conversation

QuietMisdreavus
Copy link
Contributor

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.

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please smoke test

@QuietMisdreavus
Copy link
Contributor Author

/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.

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please smoke test

@QuietMisdreavus QuietMisdreavus merged commit e45c9df into main Jun 12, 2023
@QuietMisdreavus QuietMisdreavus deleted the QuietMisdreavus/parameterless-macros branch June 12, 2023 15:10
bnbarham added a commit that referenced this pull request Jun 12, 2023
#66497 and
#66482 succeeded separately, then
merged. But after 66497 the error now includes parentheses.

Resolves rdar://110655182.
hjyamauchi pushed a commit to hjyamauchi/swift that referenced this pull request Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants