Skip to content

Fix type promotion #93

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

Merged
merged 7 commits into from
May 15, 2022
Merged

Fix type promotion #93

merged 7 commits into from
May 15, 2022

Conversation

hyrodium
Copy link
Collaborator

@hyrodium hyrodium commented Apr 2, 2022

This PR fixes #86.

julia> using Unitful: m, s

julia> using IntervalSets

julia> x = 1m .. 5m
1 m..5 m

julia> y = 1m .. 2s
ERROR: promotion of types Unitful.Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}} and Unitful.Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}} failed to change any arguments
Stacktrace:
 [1] error(::String, ::String, ::String)
   @ Base ./error.jl:42
 [2] sametype_error(input::Tuple{Unitful.Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}, Unitful.Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}})
   @ Base ./promotion.jl:374
 [3] not_sametype(x::Tuple{Unitful.Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}, Unitful.Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}}, y::Tuple{Unitful.Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}, Unitful.Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}})
   @ Base ./promotion.jl:368
 [4] promote
   @ ./promotion.jl:351 [inlined]
 [5] (ClosedInterval)(left::Unitful.Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}, right::Unitful.Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}})
   @ IntervalSets ~/.julia/dev/IntervalSets/src/interval.jl:30
 [6] ..(x::Unitful.Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}, y::Unitful.Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}})
   @ IntervalSets ~/.julia/dev/IntervalSets/src/interval.jl:85
 [7] top-level scope
   @ REPL[4]:1

Note that we now have a new issue around missing. I'll open it soon.

@JeffFessler
Copy link

Now that #94 and #98 seem done, can you rerun the CI for this PR to see if it works OK?
Or does something else need to be done first?

@codecov
Copy link

codecov bot commented May 15, 2022

Codecov Report

Merging #93 (34ed8a4) into master (02d641f) will decrease coverage by 0.38%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #93      +/-   ##
==========================================
- Coverage   99.26%   98.88%   -0.39%     
==========================================
  Files           3        3              
  Lines         272      268       -4     
==========================================
- Hits          270      265       -5     
- Misses          2        3       +1     
Impacted Files Coverage Δ
src/interval.jl 99.13% <100.00%> (-0.03%) ⬇️
src/IntervalSets.jl 98.40% <0.00%> (-0.80%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 02d641f...34ed8a4. Read the comment docs.

@hyrodium
Copy link
Collaborator Author

hyrodium commented May 15, 2022

I think this is ready to merge. I'll wait for some approvals.

@hyrodium hyrodium merged commit 39b9007 into JuliaMath:master May 15, 2022
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.

Constructing intervals with incompatible endpoint types
2 participants