Aqua.jl icon indicating copy to clipboard operation
Aqua.jl copied to clipboard

`test_ambiguities` suggests invalid method types

Open cscherrer opened this issue 2 years ago • 1 comments

I'm not sure if this is really an Aqua issue - it might be a bug in Julia itself. I often get results like

Ambiguity #1
logdensity_def(s::S, β, x) where {A, B, S<:MeasureBase.SuperpositionMeasure{Tuple{A, B}}} in MeasureBase at /home/chad/git/MeasureBase.jl/src/combinators/superpose.jl:102
logdensity_def(s, β::S, x) where {A, B, S<:MeasureBase.SuperpositionMeasure{Tuple{A, B}}} in MeasureBase at /home/chad/git/MeasureBase.jl/src/combinators/superpose.jl:123

Possible fix, define
  logdensity_def(::Union{S, S, S, S}, ::S, ::Any) where {A, A, B, S<:MeasureBase.SuperpositionMeasure{Tuple{A, B}}, B, B, S<:MeasureBase.SuperpositionMeasure{Tuple{B, B}}, B, S<:MeasureBase.SuperpositionMeasure{Tuple{B, B}}, S<:MeasureBase.SuperpositionMeasure{Tuple{B, B}}, B, S<:MeasureBase.SuperpositionMeasure{Tuple{A, B}}}

Union{S, S, S, S} is just S, but as I understand it's illegal to have repeated type parameters as in where {A, A, ...}

cscherrer avatar Jun 20 '22 21:06 cscherrer

After some fiddling around I managed to construct a smaller example and backtraced it back into julia base. This now gets tracked in https://github.com/JuliaLang/julia/issues/50246.

lgoettgens avatar Jun 21 '23 12:06 lgoettgens