Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves debugging for the Dependency Injection framework by enhancing error messages with readable Swift type names instead of internal ObjectIdentifier representations. It also documents and tests the compile-time type matching behavior for arguments.
Changes:
- Replaced internal
ObjectIdentifierdebug descriptions with readable Swift type names in error messages - Added storage for type descriptions in
RegistrationIdentifierto support readable error output - Added helper function
runtimeTypeDescriptionto format runtime argument types - Documented compile-time argument type matching behavior across protocol files, container implementations, and README
- Added comprehensive tests verifying readable error messages and protocol-vs-concrete type distinction
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/Models/RegistrationIdentifier.swift | Added type description storage and updated description property to show readable type names; added helper function for runtime type formatting |
| Sources/Models/Sync/Registration.swift | Updated error message to use readable type descriptions via runtimeTypeDescription |
| Sources/Models/Async/AsyncRegistration.swift | Updated error message to use readable type descriptions via runtimeTypeDescription |
| Sources/Protocols/Resolution/Sync/DependencyResolving.swift | Added documentation about compile-time type matching |
| Sources/Protocols/Resolution/Async/AsyncDependencyResolving.swift | Added documentation about compile-time type matching |
| Sources/Protocols/Registration/Sync/DependencyRegistering.swift | Added documentation about compile-time type matching |
| Sources/Protocols/Registration/Async/AsyncDependencyRegistering.swift | Added documentation about compile-time type matching |
| Sources/Container/Sync/Container.swift | Added documentation about compile-time type matching |
| Sources/Container/Async/AsyncContainer.swift | Added documentation about compile-time type matching |
| Tests/Common/Dependencies.swift | Added new DependencyWithProtocolParameter test dependency |
| Tests/Container/Sync/BaseTests.swift | Added assertions verifying readable error messages contain type names |
| Tests/Container/Sync/ArgumentTests.swift | Added assertions verifying readable error messages and new test for compile-time type matching |
| Tests/Container/Async/AsyncBaseTests.swift | Added assertions verifying readable error messages contain type names |
| Tests/Container/Async/AsyncArgumentTests.swift | Added assertions verifying readable error messages and new test for compile-time type matching |
| README.md | Added example demonstrating compile-time type matching behavior |
| CHANGELOG.md | Added version 2.0.0 section documenting new features |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ipek
approved these changes
Apr 10, 2026
Contributor
ipek
left a comment
There was a problem hiding this comment.
Good job! One config file from your local environment got added to the repository.
Contributor
There was a problem hiding this comment.
Can you please remove tracking of this file?
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improve DI debugging by replacing
ObjectIdentifier(...)inResolutionErrormessages with readable Swift type names, and document that argument matching uses compile-time types.What Changed
ConcreteTypeandany Protocolare different argument registrations, even ifConcreteTypeconforms toany Protocol.Why
Resolution failures were hard to debug because the errors showed internal identifiers instead of actual types. The compile-time argument-matching rule also existed but was not explicit in the docs.