Skip to content

Relax ProtocolType requirement on ProtocolObject#516

Merged
madsmtm merged 3 commits intomasterfrom
protocol-fixes
Dec 3, 2023
Merged

Relax ProtocolType requirement on ProtocolObject#516
madsmtm merged 3 commits intomasterfrom
protocol-fixes

Conversation

@madsmtm
Copy link
Copy Markdown
Owner

@madsmtm madsmtm commented Sep 21, 2023

Relax the ProtocolType requirement on ProtocolObject, which means we can now have protocol objects with auto traits, such as ProtocolObject<dyn NSObjectProtocol + Send>.

Protocols objects with multiple protocols are not yet possible.

Construction of these is still difficult, we'd have to somehow do impl ImplementedBy<T: Any + Combination + Of + Traits> for dyn Any + Combination + Of + Traits. But I suspect construction of these will be exceedingly rare anyhow, and at least it's better that you can use them, if icrate constructs them for you.

TODO:

  • Add changelog and documentation
  • Add tests for new functionality
  • Add UI tests for things that would be unsound

@madsmtm madsmtm added bug Something isn't working A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates A-framework Affects the framework crates and the translator for them labels Sep 21, 2023
@madsmtm madsmtm added this to the Usable icrate milestone Sep 21, 2023
@madsmtm madsmtm modified the milestones: Usable icrate, Polish icrate Dec 3, 2023
These Sized bounds are already added by the extern_protocol! macro
@madsmtm madsmtm changed the title Properly emit ProtocolObject with multiple protocols Relax ProtocolType requirement on ProtocolObject Dec 3, 2023
This allows us to do `ProtocolObject<dyn ProtocolA + ProtocolB>` in the future.
@madsmtm madsmtm marked this pull request as ready for review December 3, 2023 07:58
@madsmtm madsmtm merged commit 1af01ab into master Dec 3, 2023
@madsmtm madsmtm deleted the protocol-fixes branch December 3, 2023 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-framework Affects the framework crates and the translator for them A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant