Skip to content

[Macros] Don't allow types to shadow freestanding macros. #67513

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

Conversation

DougGregor
Copy link
Member

When performing name lookup for freestanding macros (e.g., after the #), don't allow types to shadow macros from imported libraries.

Fixes rdar://110429368.

When performing name lookup for freestanding macros (e.g., after the
`#`), don't allow types to shadow macros from imported libraries.

Fixes rdar://110429368.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

struct stringify<T> { }

func testStringify(a: Int, b: Int) {
_ = #stringify(a + b)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the diagnostic now if there's a type but no macro? I assume just a "cannot find macro..."?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the same as it was before, because everything that isn't a macro gets filtered out.

The former was effectively a copy of the latter.
The implementation was previously finding the wrong macro declaration,
leading to incorrect results recorded as the expected results.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit a0d5234 into swiftlang:main Jul 26, 2023
@DougGregor DougGregor deleted the freestanding-macros-step-into-the-light branch July 26, 2023 03:44
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