Skip to content

feat: Debugging improvements#26

Open
DanielCech wants to merge 2 commits intomasterfrom
dc/feat/debug-improvements
Open

feat: Debugging improvements#26
DanielCech wants to merge 2 commits intomasterfrom
dc/feat/debug-improvements

Conversation

@DanielCech
Copy link
Copy Markdown
Member

Summary

Improve DI debugging by replacing ObjectIdentifier(...) in ResolutionError messages with readable Swift type names, and document that argument matching uses compile-time types.

What Changed

  • made sync and async resolution errors print real dependency and argument type names
  • documented that ConcreteType and any Protocol are different argument registrations, even if ConcreteType conforms to any Protocol.
  • added tests for readable errors and protocol-vs-concrete argument matching

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ObjectIdentifier debug descriptions with readable Swift type names in error messages
  • Added storage for type descriptions in RegistrationIdentifier to support readable error output
  • Added helper function runtimeTypeDescription to 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.

@DanielCech DanielCech requested review from TParizek and ipek April 8, 2026 13:28
Copy link
Copy Markdown
Contributor

@ipek ipek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! One config file from your local environment got added to the repository.

Comment thread .superset/config.json
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove tracking of this file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants