Skip to content

Commit

Permalink
Fixed method ambiguities for Base.unsafe_convert()
Browse files Browse the repository at this point in the history
  • Loading branch information
brainandforce committed Oct 19, 2023
1 parent bca08b0 commit 9354ca9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/InlineStrings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ Base.unsafe_convert(::Type{Ptr{UInt8}}, x::Ref{T}) where {T <: InlineString} =
Ptr{UInt8}(pointer_from_objref(x))
Base.unsafe_convert(::Type{Ptr{Int8}}, x::Ref{T}) where {T <: InlineString} =
Ptr{Int8}(pointer_from_objref(x))
# Resolve method ambiguities
Base.unsafe_convert(P::Type{Ptr{UInt8}}, x::Ptr{<:InlineString}) = convert(P, x)
Base.unsafe_convert(P::Type{Ptr{Int8}}, x::Ptr{<:InlineString}) = convert(P, x)

Base.unsafe_convert(::Type{Cstring}, s::Ref{T}) where {T <: InlineString} =
Cstring(Base.unsafe_convert(Ptr{Cchar}, s))

Expand Down

0 comments on commit 9354ca9

Please sign in to comment.