grasph / wrapit

Automatization of C++--Julia wrapper generation
MIT License
98 stars 12 forks source link

Method ambiguities from destructor wrappers #63

Open JamesWrigley opened 1 week ago

JamesWrigley commented 1 week ago

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.

grasph commented 1 week ago

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})

JamesWrigley commented 1 week ago

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