-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add primary associated type for MarkupVisitor #135
Conversation
I think there's a broader discussion to be had about upgrading the minimum Swift version for Swift-DocC and its dependencies. This could probably be a Documentation Workgroup topic, IMO. |
If we can upgrade min-supported version to Swift 5.7. I think this PR is fairly easy to be merged. If we decide to maintain a Swift version lower than Swift 5.7, it looks like we need to maintain such huge duplication of code to get PAT support. Do you think this PR is generally fine even if we still need to target a swift version lower than 5.7? |
2f7960c
to
de4959a
Compare
@swift-ci please test |
The Swift 5.7 bump was discussed and got approved at last week's meeting. I think this PR is now ready for review. @QuietMisdreavus |
de4959a
to
84a2048
Compare
For PAT support, it unlocks more usage for the downstream user. Basically the same as Combine add PAT for Publisher protocol Publisher<Output, Failure> var vistor: some MarkupVisitor = EmptyWalker()
let result = vistor.visit(Text(""))
// Can't do anything on result After the PR, we can unlock something very interesting for the downstream user. See the latest test case. 84a2048 You may also have a check here https://www.swiftbysundell.com/articles/opaque-return-types-primary-associated-types/ which has a great explanation for PAT. |
@swift-ci please test |
84a2048
to
9482a3a
Compare
@swift-ci please test |
@swift-ci please test |
Bug/issue #, if applicable:
Summary
Add primary associated type for
MarkupVisitor
Update: Bump the minimal supported Swift version to Swift 5.7
Alternatives
The current implementation of PAT support forMarkupVisitor
has a lot of duplicated code since PAT was introduced by Swift 5.7.We could drop such duplication if we can update this Package's min supported Swift version to Swift 5.7.See #78
Testing
See
MarkupVisitorTests.swift
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded