JuliaGraphics / ColorTypes.jl

Basic color definitions and traits
Other
77 stars 35 forks source link

Ambiguity in promotion rules #216

Closed kimikage closed 3 years ago

kimikage commented 3 years ago

The ambiguity computation was improved in JuliaLang/julia #36962. Accordingly, we need to rewrite the ambiguity test as follows:

if VERSION >= v"1.6.0-DEV.816" # JuliaLang/julia #36962
    @test isempty(detect_ambiguities(ColorTypes))
else
    @test isempty(detect_ambiguities(ColorTypes, Base, Core))
end

Although the change itself is acceptable, ambiguous methods are detected in _promote_color. https://github.com/JuliaGraphics/ColorTypes.jl/blob/bd31741d162361ebd44ed05ae532266998d9ce9f/src/conversions.jl#L8-L18 line:12 vs. line:9 line:12 vs. line:13 line:12 vs. line:14

I don't yet fully understand why these are ambiguous. In particular, I'm not sure about the line:9 case. :confused: _promote_color is tricky to begin with, so maybe it's better to write if statements instead of using multiple dispatch.

kimikage commented 3 years ago

JuliaLang/julia #36962 was reverted. So, I will close this "for now".