GRDB.swift
GRDB.swift copied to clipboard
Conform Database.ColumnType to Sendable
First up, thank you for making this! 🙏🏻 I have used GRDB in quite a few projects throughout my career now and it's a go-to tool for me. Making my first contribution to it a fairly minor improvement :)
This silences a (couple of, due to the static lets) warning when building GRDB with strict concurrency checking enabled. Database.ColumnType is RawRepresentable as a String (which also is Sendable) and its rawValue cannot change, making this a safe conformance.
Please let me know if there are things I have missed or if this can be done in a better way!
Pull Request Checklist
- [x] CONTRIBUTING: You have read https://github.com/groue/GRDB.swift/blob/master/CONTRIBUTING.md
- [x] BRANCH: This pull request is submitted against the
developmentbranch. - [ ] DOCUMENTATION: Inline documentation has been updated.
- [ ] DOCUMENTATION: README.md or another dedicated guide has been updated.
- [x] TESTS: Changes are tested.
- [x] TESTS: The
make smokeTestterminal command runs without failure.
Hello @simba909,
Thank you for this contribution! A big review of sendability is indeed necessary now that Swift concurrency is entering a "serious" phase. I'm far away from any computer, so please wait a few days for a proper answer!
Totally agree that a bigger review is necessary, pardon the potential rudeness of only addressing this initial warning. Let me know of what I can do to help 🙂
Hope you're having a great time off (or at least away from your computer) 👍🏻
Don't worry. I'm glad you could fix a warning in this PR. Some warnings are more challenging to address (https://github.com/groue/GRDB.swift/discussions/1492). Add to that a language that is a moving target, emits false positive warnings, and has bugs and obscure subtleties regarding @preconcurrency... Some time, dedication, discussions on the Swift forums are needed 😅
Thank you @simba909, this will ship in the next release :-)
Shipped in v6.26.0