You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Aqua.jl reports method ambiguities for InlineStrings.jl methods #64
I was considering adding InlineStrings.jl to a package I'm developing that uses Aqua.jl for automated testing, but during the CI run I found this in the report:
3 ambiguities found
Ambiguity #1
unsafe_convert(::Type{Ptr{UInt8}}, x::Ref{T}) where T<:InlineStrings.InlineString in InlineStrings at /home/runner/.julia/packages/InlineStrings/rlLZO/src/InlineStrings.jl:167
unsafe_convert(::Type{P}, x::Ptr) where P<:Ptr in Base at essentials.jl:416
Possible fix, define
unsafe_convert(::Type{Ptr{UInt8}}, ::Ptr{T}) where T<:InlineStrings.InlineString
Ambiguity #2
unsafe_convert(::Type{Ptr{Int8}}, x::Ref{T}) where T<:InlineStrings.InlineString in InlineStrings at /home/runner/.julia/packages/InlineStrings/rlLZO/src/InlineStrings.jl:169
unsafe_convert(::Type{P}, x::Ptr) where P<:Ptr in Base at essentials.jl:416
Possible fix, define
unsafe_convert(::Type{Ptr{Int8}}, ::Ptr{T}) where T<:InlineStrings.InlineString
Ambiguity #3
defalg(::AbstractArray{<:Union{Missing, InlineStrings.String1, InlineStrings.String15, InlineStrings.String3, InlineStrings.String7}}) in InlineStrings at /home/runner/.julia/packages/InlineStrings/rlLZO/src/InlineStrings.jl:942
defalg(v::AbstractArray{<:Union{Missing, Number}}) in Base.Sort at sort.jl:655
Possible fix, define
defalg(::AbstractArray{<:Missing})
Method ambiguity: Test Failed at /home/runner/.julia/packages/Aqua/utObL/src/ambiguities.jl:117
Expression: success(pipeline(cmd; stdout = stdout, stderr = stderr))
This is going to cause any package that uses Aqua.jl for testing to fail tests if they include InlineStrings as a dependency.
There may be some ambiguities that are issues with Julia Base instead of this package. Julia 1.6 reports the following ambiguity:
getindex(s::InlineStrings.InlineString, r::AbstractUnitRange{T} where T<:Integer) in InlineStrings
getindex(s::AbstractString, r::UnitRange{T} where T<:Integer) in Base at strings/substring.jl:255
I also have stumbled upon this. The proposed solution for #1 is already implemented in Base, so I wonder why it is still raised as a suggested solution.
Would there be an issue if Missing is removed from the Union in InlineStrings.jl's version?
Moreover, the other ambiguities seem to disappear in 1.11-rc. New ones pop up, though:
Ambiguity #2
unsafe_convert(::Type{Ptr{UInt8}}, x::Ref{T}) where T<:InlineString @ InlineStrings C:\Users\jeanf\.julia\packages\InlineStrings\79NvI\src\InlineStrings.jl:165
unsafe_convert(::Type{Ptr{T}}, a::GenericMemoryRef) where T @ Base pointer.jl:90
Possible fix, define
unsafe_convert(::Type{Ptr{UInt8}}, ::GenericMemoryRef{isatomic, T} where isatomic) where T<:InlineStrings.InlineString
Ambiguity #3
unsafe_convert(::Type{Ptr{Int8}}, x::Ref{T}) where T<:InlineString @ InlineStrings C:\Users\jeanf\.julia\packages\InlineStrings\79NvI\src\InlineStrings.jl:167
unsafe_convert(::Type{Ptr{T}}, a::GenericMemoryRef) where T @ Base pointer.jl:90
Possible fix, define
unsafe_convert(::Type{Ptr{Int8}}, ::GenericMemoryRef{isatomic, T} where isatomic) where T<:InlineStrings.InlineString
Ambiguity #4
write(io::IO, x::T) where T<:InlineString @ InlineStrings C:\Users\jeanf\.julia\packages\InlineStrings\79NvI\src\InlineStrings.jl:362
write(io::Base.AnnotatedIOBuffer, x::AbstractString) @ Base strings\annotated.jl:505
Possible fix, define
write(::Base.AnnotatedIOBuffer, ::T) where T<:InlineStrings.InlineString
Activity
brainandforce commentedon Oct 19, 2023
There may be some ambiguities that are issues with Julia Base instead of this package. Julia 1.6 reports the following ambiguity:
This is not present in Julia 1.9; this pull request fixed the issue. Similarly, the first method ambiguity for
Base.Sort.defalgseems to exist because there is no definition ofBase.Sort.defalg(::AbstractArray{Missing}), but this was fixed late last year and should make it into Julia 1.10.I've gone ahead and filed a PR that should fix the
Base.unsafe_convertambiguities (#70).prbzrg commentedon Dec 27, 2023
New report for Julia v1.10 issued in #71
KristofferC commentedon Jul 23, 2024
The ambiguities are now:
I don't think it is really reasonable to define any of the suggested methods.
Azzaare commentedon Jul 28, 2024
I also have stumbled upon this. The proposed solution for
#1is already implemented in Base, so I wonder why it is still raised as a suggested solution.Would there be an issue if
Missingis removed from theUnionin InlineStrings.jl's version?Moreover, the other ambiguities seem to disappear in 1.11-rc. New ones pop up, though:
InlineStrings 2.0: C-compatible layout, safe codeunits, Base radix so…
quinnj commentedon Sep 4, 2026
The remaining ambiguities are fixed in #94.