JuliaGraphics / ColorTypes.jl

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

Preemptively fix tests that are about to break #286

Closed apaz-cli closed 2 months ago

apaz-cli commented 1 year ago

Apply these changes if https://github.com/JuliaLang/julia/pull/47369 gets merged.

The error message for MethodError currently applies to both calls to functions and invoke(), but did not specify which the error came from. Fixing this will break some tests, hence this PR.

kimikage commented 2 months ago

Please make sure to keep the tests robust, as this package will also be compatible with the older julia.

apaz-cli commented 2 months ago

The PR mentioned was merged last February. If the tests aren't failing for newer versions, you can close the PR.

kimikage commented 2 months ago
julia> versioninfo()
Julia Version 1.12.0-DEV.391
Commit 715c476d6a (2024-04-23 08:12 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, tigerlake)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

julia> using ColorTypes

julia> Gray(0.8) + RGB{Float32}(1, 0, 0)
ERROR: MethodError: no method matching +(::Gray{Float64}, ::RGB{Float32})
The function `+` exists, but no method is defined for this combination of argument types.
Math on colors is deliberately undefined in ColorTypes, but see the ColorVectorSpace package.

...snip...

julia> which(+, Tuple{Gray{Float32}, RGB{Float32}})
ERROR: Calling invoke(f, t, args...) would throw:
MethodError: no method matching invoke +(::Gray{Float32}, ::RGB{Float32})
The function `+` exists, but no method is defined for this combination of argument types.
Math on colors is deliberately undefined in ColorTypes, but see the ColorVectorSpace package.

...snip...
kimikage commented 2 months ago

@apaz-cli Wouldn't it be better to revisit the PRs in other packages as well?