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

Improve unchained interop #19

Merged
merged 8 commits into from
Jul 11, 2024
Merged

Improve unchained interop #19

merged 8 commits into from
Jul 11, 2024

Conversation

Vindaar
Copy link
Member

@Vindaar Vindaar commented Jul 11, 2024

Fixes a few issues when working on Unchained types.

IMPORTANT: You need to update to Unchained version v0.4.2, which I just tagged.

* v0.2.8
- add equality of Measurements with "different" types (if aliases)
- improve concept definition, add ~to~ for numbers
- fix ~^~, ~**~ involving a ~UnitLess~ and regular ~float~, due to the
  ~distinct~ nature of the former relative to the latter
- force Nim 1.6 Measurement type to require ~FloatLike~
- fix division involving integer literals
- add some more ~unchained~ related tests

Or any other type that provides a custom `to` conversion that is non
trivial.

Internal type coercions are now done via `toInternal`.
10 / x

where `x` is some non trivial unit (e.g. unchained) did previously
remove the unit accidentally.
The concept definition now requires the types to have a `to`
conversion. For numbers this is provided here.

Also fixes the exponentiation operation if UnitLess and floats are
mixed.
If two types are an effective alias, i.e. same type name defined in a
different place, it converts m2 to m1's type. This can happen in
unchained for locally defined types.

Throws a better error message if two types are to be compared that cannot.
@Vindaar Vindaar merged commit 9db5a0a into master Jul 11, 2024
8 of 12 checks passed
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