-
Notifications
You must be signed in to change notification settings - Fork 405
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
assertMacroExpansion
passes 0 protocols to ExtensionMacro
.
#2723
Comments
Synced to Apple’s issue tracker as rdar://131441049 |
Hey there! Thanks for bringing this up. There's a bit of a mismatch between what your test is doing and how the macro actually behaves in real code–since the unit tests expansion is based on a totally different expansion system than source code (compiler) expansion. If you want to cover Here's the documentation for this argument: swift-syntax/Sources/SwiftSyntaxMacrosTestSupport/Assertions.swift Lines 88 to 91 in 70e3741
Basically, there's this |
Thanks @Matejkob However I'm on a client's project where we have to support iOS16 and Swift 5. Is there any way to address this without Swift 6? |
Ok, I updated to use the main branch and now I can interrogate the protocols. |
Description
I've been writing at attached extension macro to apply some protocols to certain types which looks something like this:
With an implementation of:
Obviously this is not a finished macro as I''m still working out what it will do. However it does show the number of
protocols
passed which I eventually intend to use in generating extensions.The bug is that when I debug this macro using this unit test code:
and breakpoint inside the macro, the
protocols
array argument is always zero length. However when I run this macro on a live source code file, I seelet x = 3
in the generated extension indicating that the 3 protocols were passed as expected.Any I correct? Is this a missed bug?
Or have I missed something in my test code?
Steps to Reproduce
No response
The text was updated successfully, but these errors were encountered: