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

Named types for type level operators (error improvement 2) #14

Merged
merged 3 commits into from
Jul 5, 2024

Conversation

sufferiing
Copy link
Member

In the previous error improvement, the units system was changed to generate named classes for quantities that can be used interchangeably with the structural Quantity<> type. This PR allows type level quantity manipulations such as Multiplied<Q1, Q2>, Divided<Q1, Q2>, Exponentiated<Q, N> and Rooted<Q, N> to return the named classes (if possible) rather than the generic Quantity<> class.

It does this by generating a "compile time type function" from the corresponding Quantity<> class to it's named counterpart when the NEW_UNIT macro is invoked. Then with this function we can created a wrapper Named<Q> that will produce the named version of a quantity type if it exists.

For example this offending code:
offending_code

previously generated this error:
old_error_2

with this change, it now generates this error:
new_error_2

@sufferiing sufferiing requested a review from Aang099 July 5, 2024 03:59
Copy link
Member

@Aang099 Aang099 left a comment

Choose a reason for hiding this comment

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

All looks good!

@Aang099 Aang099 merged commit 6d06b87 into LemLib:main Jul 5, 2024
2 checks passed
@sufferiing sufferiing deleted the better-errors branch December 30, 2024 00:59
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.

2 participants