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

Weird method overwritten warning on 0.5 #87

Closed
JaredCrean2 opened this issue Aug 7, 2016 · 3 comments
Closed

Weird method overwritten warning on 0.5 #87

JaredCrean2 opened this issue Aug 7, 2016 · 3 comments

Comments

@JaredCrean2
Copy link
Contributor

I get a weird warning when using julia 0.5 (on the 0.5update branch of PETSc.jl)

WARNING: Method definition (::Type{PETSc.Mat})(Type{#T<:Any}) in module PETSc at /home/jared/.julia/v0.5/PETSc/src/mat.jl:58 overwritten at /home/jared/.julia/v0.5/PETSc/src/mat.jl:75.

I don't know quite what is going on, because line 75 is not defining a new method, it is calling the one on line 57.

cc @stevengj

@stevengj
Copy link
Contributor

Not sure...

@JaredCrean2
Copy link
Contributor Author

I narrowed it down to this example:

module C

  global const PETSC_DECIDE = -1
  typealias PetscInt Int64
  MATMPIAIJ = "matmpiaij"
  MatType = Symbol


end  # end module C

module MPI
  typealias Comm Cint
  COMM_WORLD = Cint(42)
end

module PETSc

using MPI
using C

function Mat{T}(::Type{T}, mtype::C.MatType=C.MATSEQAIJ; comm::MPI.Comm=MPI.COMM_WORLD)

  println("I found the other half of the problem")
end


function Mat{T}(::Type{T}, m::Integer=C.PETSC_DECIDE, n::Integer=C.PETSC_DECIDE;
                mlocal::Integer=C.PETSC_DECIDE, nlocal::Integer=C.PETSC_DECIDE,
                bs=1, nz::Integer=0, nnz::AbstractVector=PetscInt[],
                onz::Integer=0, onnz::AbstractVector=PetscInt[],
                comm::MPI.Comm=MPI.COMM_WORLD,
                mtype::Symbol=C.MATMPIAIJ)


  println("I finally found the problem")

  return nothing
end

end  # end module PETSc

using PETSc

producing output:

WARNING: Method definition Mat(Type{#T<:Any}) in module PETSc at /home/jared/.julia/v0.4/PETSc_current/src/tmp.jl:24 overwritten at /home/jared/.julia/v0.4/PETSc_current/src/tmp.jl:36.
WARNING: Method definition #Mat(Array{Any, 1}, PETSc.#Mat, Type{#T<:Any}) in module PETSc overwritten.

For the invocation Mat(Float64) the methods are actually ambiguous, explaining the first warning. Not providing default arguments for m and n in the second function fixes both (although I'm not really sure what the second one is complaining about). That will make calling the function with local sizes a bit more verbose, but I guess its unavoidable.

ref JuliaLang/julia#18273

@simonbyrne
Copy link
Member

code replaced in #99.

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

3 participants