-
Notifications
You must be signed in to change notification settings - Fork 9
Description
#130 added Aqua tests. Copilot claims that method ambiguities arise from third-party packages rather than AbstractPPL.
Lines 6 to 8 in 6441754
# For now, we skip ambiguities since they come from interactions | |
# with third-party packages rather than issues in AbstractPPL itself | |
Aqua.test_all(AbstractPPL; ambiguities=false) |
This is untrue. The method ambiguities are (at least partially) AbstractPPL's fault, see below. The ambiguity checks should be enabled and the ambiguities fixed.
IMO the easiest way of fixing these ambiguities is to just remove the get
and set
methods on VarNames which to me seem like overreach / overuse of multiple dispatch.
Lines 155 to 163 in 6441754
""" | |
get(obj, vn::VarName{sym}) | |
Alias for `(PropertyLens{sym}() β¨ getoptic(vn))(obj)`. | |
``` | |
""" | |
function Base.get(obj, vn::VarName{sym}) where {sym} | |
return (PropertyLens{sym}() β¨ getoptic(vn))(obj) | |
end |
I don't really see a reason why we need to make get(a, @varname(x))
behave like a.x
. Firstly, this makes some rather strong assumptions about the structure of the first argument. And even if such a method would be useful, it would be more appropriate to give it a different name rather than overloading Base.get
for all types.
4 ambiguities found. To get a list, set `broken = false`.
Ambiguity #1
get(a::DataStructures.MultiDict, args...) @ DataStructures ~/.julia/packages/DataStructures/IrAJn/src/delegate.jl:21
get(obj, vn::AbstractPPL.VarName{sym}) where sym @ AbstractPPL ~/ppl/appl/src/varname.jl:161
Possible fix, define
get(::DataStructures.MultiDict, ::AbstractPPL.VarName{sym}) where sym
Ambiguity #2
get(a::DataStructures.DefaultDict, args...) @ DataStructures ~/.julia/packages/DataStructures/IrAJn/src/delegate.jl:21
get(obj, vn::AbstractPPL.VarName{sym}) where sym @ AbstractPPL ~/ppl/appl/src/varname.jl:161
Possible fix, define
get(::DataStructures.DefaultDict, ::AbstractPPL.VarName{sym}) where sym
Ambiguity #3
get(a::DataStructures.DefaultOrderedDict, args...) @ DataStructures ~/.julia/packages/DataStructures/IrAJn/src/delegate.jl:21
get(obj, vn::AbstractPPL.VarName{sym}) where sym @ AbstractPPL ~/ppl/appl/src/varname.jl:161
Possible fix, define
get(::DataStructures.DefaultOrderedDict, ::AbstractPPL.VarName{sym}) where sym
Ambiguity #4
get(a::DataStructures.DefaultDictBase, args...) @ DataStructures ~/.julia/packages/DataStructures/IrAJn/src/delegate.jl:21
get(obj, vn::AbstractPPL.VarName{sym}) where sym @ AbstractPPL ~/ppl/appl/src/varname.jl:161
Possible fix, define
get(::DataStructures.DefaultDictBase, ::AbstractPPL.VarName{sym}) where sym