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

Fix conversion to unitless Quantity #724

Merged
merged 4 commits into from
Dec 30, 2024

Conversation

sostock
Copy link
Collaborator

@sostock sostock commented May 22, 2024

Unitless Quantitys can be created by calling the appropriate constructor, but a convert call currently fails:

julia> Quantity{Int, NoDims, typeof(NoUnits)}(5)
5

julia> typeof(ans)
Quantity{Int64, NoDims, Unitful.FreeUnits{(), NoDims, nothing}}

julia> convert(Quantity{Int, NoDims, typeof(NoUnits)}, 5)
ERROR: type Int64 has no field val
[]

This PR fixes the convert implementation to allow conversion to Quantity{T, NoDims, typeof(NoUnits)}.

@sostock sostock force-pushed the convert_to_unitless branch from 4528b2c to e8e905b Compare December 30, 2024 21:19
@sostock sostock merged commit 3c5ec20 into PainterQubits:master Dec 30, 2024
15 of 16 checks passed
@sostock sostock deleted the convert_to_unitless branch December 30, 2024 22:11
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