Skip to content

Add Transitive casting and testing code #1252

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BenFordTytherington
Copy link
Collaborator

Currently WIP

Any impl of MainCast<Base=QObject> seems to cause a conflict with the blanket implementation and the generated implementation of Upcast, which is perplexing given the trait bounds, but it does seem to only be QObject.

Testing with QAbstractListModel shows that lib types can work with this code.

Additionally, with one trait impl, it is only possible to combine 2 levels, e.g. A->B ^ B->C => A->C, and additional impls would be needed to extend this to the desired 5 or 6 levels of casting.

Code in cargo_without_cmake example shows the functionality of the transitive casting.

Copy link

codecov bot commented Apr 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (a662b2e) to head (3da5070).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1252   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           73        73           
  Lines        12634     12634           
=========================================
  Hits         12634     12634           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@BenFordTytherington BenFordTytherington force-pushed the add-transitive-casting branch 2 times, most recently from 07b2321 to 2cea6c4 Compare April 25, 2025 17:07
@BenFordTytherington
Copy link
Collaborator Author

Macro now written in example for testing purposes, I wasn't sure where to put it / export it publically. This will implement casting to all the types written after the first one, provided there is casting between each type, e.g chain_cast(A, B, C, D, E) will, provided A -> B, B -> C, C -> D and D -> can cast, generate A -> C, A -> D, A -> E.

In a future commit, could maybe add more recursion so that this also generates B -> D, B -> E, etc... Also probably needs some testing.

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.

1 participant