Base.convert(::Type{Bar}, x::Int64) = Bar(x)
You were creating a new function called convert instead of adding a method to Base.convert. You either need to fully qualify the function name or do import Base: convert first.
Base.convert(::Type{Bar}, x::Int64) = Bar(x)
You were creating a new function called convert instead of adding a method to Base.convert. You either need to fully qualify the function name or do import Base: convert first.