JuliaMath / Quadmath.jl

Float128 and libquadmath for the Julia language
Other
40 stars 11 forks source link

Method ambiguities of `Float128` constructor suggested by Aqua.jl #61

Closed frankwswang closed 1 year ago

frankwswang commented 1 year ago

I was using Aqua.jl to do a quality test of Quadmath.jl, and I found the following method ambiguities:

julia> using Quadmath

julia> using Aqua

julia> Aqua.test_all(Quadmath)
Skipping Base.active_repl
Skipping Base.active_repl_backend
Skipping Base.Filesystem.JL_O_NOCTTY
Skipping Base.Filesystem.JL_O_SHORT_LIVED
3 ambiguities found
Ambiguity #1
Quadmath.Float128(data) in Quadmath at PathToPackages\Quadmath\Laqi7\src\Quadmath.jl:84
(::Type{T})(x::Base.TwicePrecision) where T<:Number in Base at twiceprecision.jl:266

Possible fix, define
  Quadmath.Float128(::Base.TwicePrecision)

Ambiguity #2
Quadmath.Float128(data) in Quadmath at PathToPackages\Quadmath\Laqi7\src\Quadmath.jl:84
(::Type{T})(z::Complex) where T<:Real in Base at complex.jl:44

Possible fix, define
  Quadmath.Float128(::Complex)

Ambiguity #3
Quadmath.Float128(data) in Quadmath at PathToPackages\Quadmath\Laqi7\src\Quadmath.jl:84
(::Type{T})(x::AbstractChar) where T<:Union{AbstractChar, Number} in Base at char.jl:50

Possible fix, define
  Quadmath.Float128(::AbstractChar)

Ambiguity 2 seems trivial to fix by defining a method that returns InexactError. However, we may need some special handling for ambiguities 1 and 3.

simonbyrne commented 1 year ago

Thanks! I actually think we can address some of these my removing the default constructor.