Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent missing method error #8618

Closed
timholy opened this issue Oct 8, 2014 · 2 comments
Closed

Inconsistent missing method error #8618

timholy opened this issue Oct 8, 2014 · 2 comments

Comments

@timholy
Copy link
Member

timholy commented Oct 8, 2014

Here's a situation in which @which reports an available method, but actually trying to use the method results in a MethodError. I'm probably doing something wrong, but for the life of me I can't figure out what. This happens on both master and 0.3.

julia> using Images, TestImages, Color

julia> img = testimage("lighthouse")
RGB Image with:
  data: 768x512 Array{RGB{UfixedBase{Uint8,8}},2}
  properties:
    IMcs: sRGB
    spatialorder:  x y
    pixelspacing:  1 1

julia> @which convert(Image{RGB}, img)
convert{Cdest<:Union(AbstractAlphaColorValue{C<:ColorValue{T},T<:Real},ColorValue{T}),Csrc<:Union(AbstractAlphaColorValue{C<:ColorValue{T},T<:Real},ColorValue{T})}(::Type{Image{Cdest<:Union(AbstractAlphaColorValue{C<:ColorValue{T},T<:Real},ColorValue{T}),N,A<:AbstractArray{T,N}}},img::AbstractImageDirect{Csrc<:Union(AbstractAlphaColorValue{C<:ColorValue{T},T<:Real},ColorValue{T}),N}) at /home/tim/.julia/v0.3/Images/src/core.jl:226

julia> convert(Image{RGB}, img)
ERROR: `convert` has no method matching convert(::Type{Image{RGB{T<:Union(FixedPoint,FloatingPoint)},N,A<:AbstractArray{T,N}}}, ::Image{RGB{UfixedBase{Uint8,8}},2,Array{RGB{UfixedBase{Uint8,8}},2}})
 in convert at base.jl:13

# OK, directly test that definition on Images/src/core.jl:226
julia> copy(img, Images._convert(Array{RGB}, data(img)))
RGB Image with:
  data: 768x512 Array{RGB{UfixedBase{Uint8,8}},2}
  properties:
    IMcs: sRGB
    spatialorder:  x y
    pixelspacing:  1 1

# Can we replicate with some function besides convert?
julia> arg1{C<:Images.ColorTypes.ColorType}(::Type{Image{C}}) = "yes"
arg1 (generic function with 1 method)

julia> arg2{C<:Images.ColorTypes.ColorType}(::AbstractImageDirect{C}) = "yes"
arg2 (generic function with 1 method)

julia> arg12{C<:Images.ColorTypes.ColorType, D<:Images.ColorTypes.ColorType}(::Type{Image{C}}, ::AbstractImageDirect{D}) = "yes"
arg12 (generic function with 1 method)

julia> arg1(Image{RGB})
"yes"

julia> arg2(img)
"yes"

julia> arg12(Image{RGB}, img)
"yes"
@simonster
Copy link
Member

I'm not sure if it's the same issue, but this looks vaguely similar to #8128.

@timholy
Copy link
Member Author

timholy commented Oct 8, 2014

I bet you're right. I'll close this one and bump that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants