Skip to content
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

Add reflection API for projecting into any enum value #103

Merged
merged 6 commits into from Mar 7, 2023
Merged

Conversation

stephencelis
Copy link
Member

@stephencelis stephencelis commented Mar 7, 2023

This PR reworks some of the extraction logic for case paths and exposes a @_spi(Reflection) helper for projecting the associated value of any enum into an existential Any. We can eliminate a bunch of work we're currently doing by always projecting into the field type described by the runtime and then we can further attempt to cast to the extracted payload.

Fixes #83.

There are probably some performance improvements that can be made, but the benchmarks appear to perform as well as they do on main.

/cc @mayoff

@stephencelis stephencelis merged commit 68787a1 into main Mar 7, 2023
@stephencelis stephencelis deleted the projection branch March 7, 2023 21:28
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.

Failed to extract enum with AnyHashable associated value
2 participants