wrapit icon indicating copy to clipboard operation
wrapit copied to clipboard

Method ambiguities from destructor wrappers

Open JamesWrigley opened this issue 1 year ago • 2 comments

When running Aqua.jl on my package with Aqua.test_all(ImGuiTestEngine) I get a bazillion method ambiguity warnings like this:

Ambiguity #11169                                                                                                                                                                                                                               
__delete(arg1::Union{Ptr{Nothing}, CxxWrap.CxxWrapCore.CxxPtr{<:ImGuiTestEngine.lib.ImGuiTestItemInfo}}) @ ImGuiTestEngine.lib ~/.julia/packages/CxxWrap/eWADG/src/CxxWrap.jl:668                                                              
__delete(arg1::Union{Ptr{Nothing}, CxxWrap.CxxWrapCore.CxxPtr{<:CxxWrap.StdLib.StdUnorderedMultiset{UInt8}}}) @ CxxWrap.StdLib ~/.julia/packages/CxxWrap/eWADG/src/CxxWrap.jl:668                                                              
                                                                                                                                                                                                                                               
Possible fix, define                                                                                                                                                                                                                           
  __delete(::Union{Ptr{Nothing}, CxxWrap.CxxWrapCore.CxxPtr{Union{}}})

Unfortunately the package (https://github.com/JuliaImGui/ImGuiTestEngine.jl) is not easily installable right now because it requires an unmerged JLL, so I don't have an easy reproducer :smiling_face_with_tear: Anyway, it's not particularly urgent for me.

JamesWrigley avatar Jun 25 '24 10:06 JamesWrigley

I'm including @barche, as it looks like an issue with CxxWrap.

I don't get where the ambiguity is. Looking at imgui_te_engine.h L295, I understand ImGuiTestEngine.lib.ImGuiTestItemInfo is a struct and has therefore no relation with StdUnorderedMultiset. @JamesWrigley do you have more insights on what can make the choice between the two methods ambiguous? Maybe, if you can explicitly call CxxWrap.CxxWrapCore.__delete with ImGuiTestItemInfo you will get a Julia error message giving more information. (I missed the union with Ptr{Nothing})

grasph avatar Jun 25 '24 11:06 grasph

BTW, here are the generated wrappers: https://github.com/Gnimuc/CImGui.jl/tree/1.90.8/cimgui-pack/test_engine/src

JamesWrigley avatar Jun 25 '24 11:06 JamesWrigley

Closing the issue, since it is related to CxxWrap. @JamesWrigley , @barche, I let you open an issue in CxxWrap, it it is still relevant.

grasph avatar Feb 14 '25 16:02 grasph

Sorry, I completely missed this. @JamesWrigley if you are still having this problem, please create an issue with a small test that reproduces the problem in CxxWrap.jl.

barche avatar Feb 18 '25 06:02 barche