Skip to content

[5.9][Macros] Don't visit macro-generated extensions in visitAuxiliaryDecls. #66956

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

hborla
Copy link
Member

@hborla hborla commented Jun 27, 2023

hborla added 2 commits June 27, 2023 09:05
…ls'.

Macro-generated extensions are hoisted to file scope, because extensions are
not valid in nested scopes. Callers of 'visitAuxiliaryDecls' assume that the
auxiliary decls are in the same decl context as the original, which is clearly
not the case for extensions, and it leads to issues like visiting extension at
the wrong time during SILGen. The extensions are already added to the top-level
decls, so we don't need to visit them as auxiliary decls, and we can type-check
macro-expanded decls at the end of visitation in TypeCheckDeclPrimary.

(cherry picked from commit 83030a9)
…s of

the synthesized source file instead of a separate API to gather the
extensions.

This is how macro-generated extensions are visited everywhere else.

(cherry picked from commit 3ecfb53)
@hborla
Copy link
Member Author

hborla commented Jun 27, 2023

swiftlang/swift-syntax#1856

@swift-ci please test

@hborla hborla merged commit 094dda6 into swiftlang:release/5.9 Jun 27, 2023
@hborla hborla deleted the 5.9-conformance-macro-in-extension branch June 27, 2023 22:04
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.

2 participants