generated from StanfordBDHG/SwiftPackageTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve overload resolution for KnowledgeSource protocols (#16)
# Improve overload resolution for KnowledgeSource protocols ## ♻️ Current situation & Problem A `SharedRepository` typically has multiple overloads for a range of different `KnowledgeSource` protocols. A knowledge source might provide default values or might be computed. Typically, you only adopt a single knowledge source protocol. However, you cannot prevent users from adopting multiple. This PR improves the overload resolution in these scenarios. All of the specialized KnowledgeSource protocols inherit the base `KnowledgeSource` protocol. Therefore, Swift resolution will automatically prefer the more specialized type. Problems arise if you accidentally (or on purpose) conform to a computed KnowledgeSource variant and the `DefaultProvidingKnowledgeSource`. In this case we resolve the conflict and generally prefer the computed knowledge source protocol. We consider a computed knowledge source more specialized than only providing a default value. ## ⚙️ Release Notes * Improve overload resolution for knowledge source protocols in certain situations ## 📚 Documentation -- ## ✅ Testing Added some unit testing to verify overload behavior. ## 📝 Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
- Loading branch information
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters