-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
convert
: method isn't called even though atsign-which finds one
#8818
Comments
I just verified that this behavior is present in julia 0.3.0 as well as the latest julia 0.3.3-pre. I swear this worked at one point (you can even see it in the Images README), so I bet it's a bug triggered by a change in a package. I'm going to start going through older versions of Color, since that seems to have triggered other |
Here's a more minimal test case:
diff --git a/src/conversions.jl b/src/conversions.jl
index 8c0d2d7..ff0f2c9 100644
--- a/src/conversions.jl
+++ b/src/conversions.jl
@@ -688,6 +688,10 @@ convert{C,T}(::Type{AlphaColorValue{C,T}}, c::AlphaColorValue{C,T}) = c
function convert{C,T,D,U}(::Type{AlphaColorValue{C,T}}, c::AbstractAlphaColorValue{D,U})
AlphaColorValue{C,T}(convert(C, c.c), c.alpha)
end
+function convert{D,T}(AC::TypeConstructor, c::AbstractAlphaColorValue{D,T})
+ AlphaColorValue(convert(colortype(AC), c.c), c.alpha)
+end
+
convert{C,T}(::Type{AlphaColorValue{C,T}}, c::ColorValue) =
AlphaColorValue{C,T}(convert(C, c), one(T))
using Images, TestImages
img = testimage("mandrill")
A = convert(Array, img) Without that diff, it works fine. IIRC, the motivation for the |
I'll look at this. But, there should definitely not be definitions for |
That specific change doesn't work: tests fail on However, it's clearly not the only problem with |
Using released ./julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.3-pre+18 (2014-10-28 09:26 UTC)
_/ |\__'_|_|_|\__'_| | Commit bdd4597* (4 days old release-0.3)
|__/ | x86_64-apple-darwin13.4.0
julia> using Color
julia> convert(Vector{Symbol}, {"a","b"})
ERROR: `convert` has no method matching convert(::Type{Array{Symbol,1}}, ::Array{Any,1})
in convert at base.jl:13
julia> Executing the convert method before the import makes the call work even after the import. ./julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.3-pre+18 (2014-10-28 09:26 UTC)
_/ |\__'_|_|_|\__'_| | Commit bdd4597* (4 days old release-0.3)
|__/ | x86_64-apple-darwin13.4.0
julia> convert(Vector{Symbol}, {"a","b"})
2-element Array{Symbol,1}:
:a
:b
julia> using Color
julia> convert(Vector{Symbol}, {"a","b"})
2-element Array{Symbol,1}:
:a
:b
This bug effectively prevents many packages (eg GLM) from working in conjunction with Gadfly. Quite a few of the bugs in packages are linked to #8631 , but given @JeffBezanson 's comment there about 0.4 breakage, I'm uncertain if they are related. |
"convertalypse" is quite troublesome. I hope to be able to look at it myself starting Nov 6, but no promises about whether I'll make any progress. In the meantime, I'd definitely recommend experimenting with pinning Color at earlier versions. |
"convertalypse" indeed! Pinning ./julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.3-pre+18 (2014-10-28 09:26 UTC)
_/ |\__'_|_|_|\__'_| | Commit bdd4597* (4 days old release-0.3)
|__/ | x86_64-apple-darwin13.4.0
julia> using Color
julia> convert(Vector{Symbol}, {"a","b"})
2-element Array{Symbol,1}:
:a
:b Unfortunately, something else in ./julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.3-pre+18 (2014-10-28 09:26 UTC)
_/ |\__'_|_|_|\__'_| | Commit bdd4597* (4 days old release-0.3)
|__/ | x86_64-apple-darwin13.4.0
julia> using Gadfly
Warning: could not import Base.has into Gadfly
Warning: could not import StatsBase.bandwidth into Stat
Warning: could not import StatsBase.kde into Stat
julia> convert(Vector{Symbol}, {"a","b"})
ERROR: `convert` has no method matching convert(::Type{Array{Symbol,1}}, ::Array{Any,1})
in convert at base.jl:13 |
What if you pin to 0.3.6? |
I recompiled my julia install (as part of trying to git bisect) and now cannot replicate this issue after a The good news is, with |
I just completed a bisect for a similar problem over at #8631. I'm not certain the two are related, which is why there are two issues, but one can always hope... |
@timholy Another report that pinning to 0.3.6 fixes it. JuliaStats/MixedModels.jl#26 |
OK, now I know a lot more about this. First, this bug doesn't apply to master, so it's 0.3-specific. Second, the commit that triggered this is e3c5c11. Third, my attempts to fix this (e.g., make it more like the function in A simple test script: import Base.convert
convert(E::TypeConstructor, e) = error("oops")
immutable Container{T}
data::Array{T}
end
function convert(::Type{Array}, c::Container)
println("Here")
c.data
end
A = Container([5]) and then, at the REPL, do this: include("<name_of_test_script>")
convert(Array, A) (I wasn't able to trigger the bug if it's run from a script.) |
This should fix numerous related errors in other packages
|
should be fixed now |
This could be the same problem as #8631, but now I can trigger it even after pinning Color at 0.3.9 (so it clearly has nothing to do with new Dict syntax).
To debug, I modified these lines to generate some
println
statements so I know the call chain:Now:
So you can see it never calls the method found by
@which
(it never prints out"here 1"
).The text was updated successfully, but these errors were encountered: