JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.65k stars 5.48k forks source link

Prefixing method with module name breaks code on 0.4.0 #9739

Closed joa-quim closed 9 years ago

joa-quim commented 9 years ago

Example:

0.3.4

julia> methods(cdCreateCanvas)
#1 method for generic function "cdCreateCanvas":
cdCreateCanvas(context::Ptr{cdContext},data::Ptr{None}) at C:\programs\Gits\IUP.jl\src\libcd.jl:269

0.4.0

julia> methods(cdCreateCanvas)
#1 method for generic function "cdCreateCanvas":
cdCreateCanvas(context::Ptr{IUP_CD.cdContext},data::Ptr{Union()}) at C:\programs\Gits\IUP.jl\src\libcd.jl:269

which later breaks the code (that works in 0.3.4) with

ERROR: `cdCreateCanvas` has no method matching cdCreateCanvas(::Ptr{IUP_CD.cdContext}, ::Ptr{Void})
Closest candidates are:
  cdCreateCanvas(::Ptr{IUP_CD.cdContext}, ::Ptr{Union()})
ivarne commented 9 years ago

Usually issues such as this is much easier to fix if we get a (minimal) reproducible example that can be pasted into a REPL session. You seem to be referencing IUP.jl, and as it requires binary dependencies, it is kind of a hassle to install just to debug this issue.

ivarne commented 9 years ago

Sometimes issues like this can be caused by loading the same module twice, eg with reload. Can you try the examples again in a new session?

joa-quim commented 9 years ago

Yes, it happens with IUP and that's why I didn't try to find a small set of commands that reproduce the problem. However, I do recall that there was a post or an issue that referenced this issue not long time ago. I just wasn't able to find it again. And no, it's not a double module loading thing. It happens right on the first call.

Keno commented 9 years ago

This isn't a bug. Void, which used to be Union() is now the type of nothing, so the second argument is the problem.

tkelman commented 9 years ago

Looks like Compat.jl might need some code to help packages deal with the Void change?

Keno commented 9 years ago

Using Ptr{Void} will work on both versions, as long as it's done everywhere.

joa-quim commented 9 years ago

Sorry, a bit too concentrated info to me. You mean changing Ptr{None} to Ptr{Void} in https://github.com/joa-quim/IUP.jl/blob/master/src/libcd.jl#L269 ?

If I do so, I don't get the previous error but instead simply (after loading an image)

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: UNKNOWN at 0x32f1160 --

In case someone wants to try (needs to install IUP), It occurs with (im_view is an example in the examples dir)

using im_view_;
im_view()
Keno commented 9 years ago

Yes, that's what I mean. Does it also segfault on 0.3?

joa-quim commented 9 years ago

No, 0.3 runs fine

Keno commented 9 years ago

Ok, I suspect than that doing the change is not the problem, but that there is some other bug causing the segfault. Are you able to get a backtrace.

joa-quim commented 9 years ago

Sorry, no. That's the only error message I get (it's a Win build btw).

Keno commented 9 years ago

Ok, I can take a look tomorrow and see if I can reproduce.

JeffBezanson commented 9 years ago

IUP issue opened: https://github.com/joa-quim/IUP.jl/issues/1