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
[Macros] Reproduce issue with peer+extension macro extension's methods not being checked as witnesses #71717
Conversation
…etect extension macros Both `PotentialMacroExpansionsInContextRequest` and `populateLookupTableEntryFromMacroExpansions` expected extension macros only on extensions synthesized by macros. That is not the same in practice and such attached macros could appear on types as well.
28136f6
to
a6d53aa
Compare
@swift-ci please smoke test |
nominal = container.getBaseNominal(); | ||
|
||
if (nominal) | ||
forEachPotentialAttachedMacro(nominal, MacroRole::Extension, nameTracker); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks Pavel :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thank you @xedin !
resolves rdar://123012943 |
@swift-ci please smoke test Linux |
@swift-ci please smoke test Linux |
This narrows down and reproduces rdar://123012943
This is blocking the
@_DistributedProtocol
macro from working entirely since the methods introduced by the extension macro are not seen as witnesses.It happens when a macro is both peer and extension;
extension
names: arbitrary
because we don't know statically what method names we'll introduce -- it depends on the protocol we're attached tonames: prefixed('$')
... that seems to break things and the methods in the extension don't get "noticed" as witnesses'peer' macros are not allowed to introduce arbitrary names at global scope
So this is somewhat blocked -- this looks like a bug in handling the names in the extension macro role, and not looking for the witnesses.
If a macro is made to be just extension the macro's introduced methods do properly witness the requirement.