-
Notifications
You must be signed in to change notification settings - Fork 33
Add default-value macros, deterministic enum handling, and CI #27
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
Conversation
This reverts commit aa7b067.
This was exactly my motivation as well.
I was experiencing some issues with testing on Linux, I've now fixed those issues and restored testing on Linux.
That's fine. In that case I suggest you bump the Package.swift version to 6.0 as well. Since Apple is no longer supporting Swift 5.x officially it's fair to bump. I've committed the bump too.
Good point. I've added those.
I'm not sure about this one. I think one might want to have different default values especially if generating a memberwise init e.g. for stubbing. Although rare, this could be a legitimate use case. And |
|
@davdroman Only one question left: I can not build test target, I've tried different computers, different versions of XCode, and clearing the cache, but it still fails. I found that if I comment out the entire content of I haven't deeply explored macro expansion testing yet. The few test cases I'd appreciate your insights on this. |
|
Let's ignore the compilation issues with the test target for now, merge this PR first, and then decide whether to introduce MacroTesting based on actual usage. |
|
Sorry it took me so long to respond.
It's fixed here. #29 It's some sort of Swift Syntax error caused by the new prebuilts feature. Very annoying, but easy to fix.
I believe MacroTesting to be such an improvement over the bare SwiftSyntaxMacrosTestSupport that it should be part of every macro test suite everywhere. You can read more about the benefits here: https://www.pointfree.co/blog/posts/114-a-new-tool-for-testing-macros-in-swift (tldr: much better developer experience when writing macro expansion tests). Point-Free have an impeccable track record shipping key libraries that fill massive gaps in the Swift ecosystem. I swear by their work and use one or multiple of their libraries in all my open source projects and at work. |
|
I've read the blog about MacroTesting, surprisingly, it can automatically complete the expansion!!! It is truly an amazing framework. But I have temporarily removed MacroTesting for the following reason:
Later, if there is a need for a large number of macro expansion tests, I will consider referencing MacroTesting. Additionally, I found that SPM could previously set Point-Free is really great. I'll try some of their libraries in the future. |


@DecodingDefault,@EncodingDefault, and@CodingDefaultpeer macros (Sources/ReerCodable/MacroDeclarations/DefaultValue.swift) with runtime + macro-expansion coverage (Tests/ReerCodableTests/DefaultValueTests.swift,MacroExpandTests.swift) and wired them throughPropertyInfo/TypeInfoso synthesized decoders/encoders automatically apply explicit fallbacks across base64/custom/flat code paths.main:.editorconfig, a refreshed CI workflow (matrixed Linux builds, skip support, weekly runs), and expandedPackage.swift/Package.resolvedwithswift-macro-testing+ compatibleswift-syntaxconstraints so we can exercise macro expansions with MacroTesting.@CodingCaseoutput by tracking per-casematchOrder, updatedprocessEnumCasesto return ordered arrays, and ensured the decoder walks non-string matchers before string ones—macro expansion snapshots now match deterministically.