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 ambiguous convert #7

Merged
merged 1 commit into from
Jun 6, 2020
Merged

Conversation

omus
Copy link
Contributor

@omus omus commented Jun 3, 2020

julia> using Infinity
[ Info: Precompiling Infinity [a303e19e-6eb4-11e9-3b09-cd9505f79100]

julia> convert(Infinite, InfExtended{Int64}(∞))
ERROR: MethodError: convert(::Type{Infinite}, ::InfExtended{Int64}) is ambiguous. Candidates:
  convert(::Type{Infinite}, x::Real) in Infinity at /Users/omus/.julia/dev/Infinity/src/conversion.jl:15
  convert(::Type{T}, x::InfExtended{S}) where {T<:Real, S<:Real} in Infinity at /Users/omus/.julia/dev/Infinity/src/conversion.jl:14
Possible fix, define
  convert(::Type{Infinite}, ::InfExtended{S<:Real})
Stacktrace:
 [1] top-level scope at REPL[2]:1

e.g. `convert(Infinite, InfExtended{Int64}(∞))`
Copy link

@nickrobinson251 nickrobinson251 left a comment

Choose a reason for hiding this comment

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

lgtm

@testset "conversions" begin
@test convert(Infinite, InfExtended{Int}(∞)) === ∞

Choose a reason for hiding this comment

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

we may as well test we didn't forget the signbit?

Suggested change
@test convert(Infinite, InfExtended{Int}(∞)) ===
@test convert(Infinite, InfExtended{Int}(∞)) ===
@test convert(Infinite, InfExtended{Int}(-∞)) === -

@cjdoris cjdoris merged commit bdcdf28 into cjdoris:master Jun 6, 2020
@cjdoris
Copy link
Owner

cjdoris commented Jun 6, 2020

Thanks!

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.

3 participants