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

Use the concrete RefValue type to avoid method ambiguities #474

Merged
merged 2 commits into from Mar 7, 2024

Conversation

JamesWrigley
Copy link
Member

On 1.11 there's a new unsafe_convert(::Type{Ptr{T}}, a::GenericMemoryRef) method which causes ambiguity errors with just Ref in the unsafe_convert() methods we define, so now we use the concrete RefValue.

This fixes ambiguity warnings from Aqua.jl, e.g:

2 ambiguities found
Ambiguity #1
unsafe_convert(::Type{Ptr{LibSSH.lib.__JL_sftp_packet_struct}}, x::Ref{LibSSH.lib.sftp_packet_struct}) @ LibSSH.lib ~/work/LibSSH.jl/LibSSH.jl/src/bindings.jl:2685
unsafe_convert(::Type{Ptr{T}}, a::GenericMemoryRef) where T @ Base pointer.jl:90

Possible fix, define
  unsafe_convert(::Type{Ptr{LibSSH.lib.__JL_sftp_packet_struct}}, ::GenericMemoryRef{isatomic, LibSSH.lib.sftp_packet_struct} where isatomic)

I also renamed the partial_nodes field to partially_emitted_nodes for clarity in ab0b3d5.

On 1.11 there's a new `unsafe_convert(::Type{Ptr{T}}, a::GenericMemoryRef)`
method which causes ambiguity errors with just Ref, so now we use the concrete
RefValue.
@Gnimuc Gnimuc merged commit 8517106 into JuliaInterop:master Mar 7, 2024
11 checks passed
@Gnimuc
Copy link
Member

Gnimuc commented Mar 7, 2024

LGTM

@JamesWrigley JamesWrigley deleted the method-ambiguities branch March 7, 2024 10:53
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.

None yet

2 participants