Does auto conversion for type constructor not work for parameter types on purpose?
immutable A
x::Float64
y::Int
end
A(1, 2) # Works
immutable B{T}
x::Float64
y::Vector{T}
end
B(1, [2]) # Error
Does auto conversion for type constructor not work for parameter types on purpose?
immutable A
x::Float64
y::Int
end
A(1, 2) # Works
immutable B{T}
x::Float64
y::Vector{T}
end
B(1, [2]) # Error
Note that this works:
julia> B{Int}(1, [2])
B{Int64}(1.0,[2])
This outer constructor is missing:
julia> B{T}(x,y::Vector{T}) = B{T}(x,y)
B
julia> B(1, [2])
B{Int64}(1.0,[2])
Related Constructor with partially specified type parameters fails to fallback to convert method · Issue #18203 · JuliaLang/julia · GitHub, https://github.com/JuliaLang/julia/issues/17186