# Convert method interferes with custom array colon broadcasting

**URL:** <https://discourse.julialang.org/t/convert-method-interferes-with-custom-array-colon-broadcasting/31468>\
**Category:** General Usage\
**Created:** [November 25, 2019, 2:10am UTC](https://discourse.julialang.org/t/convert-method-interferes-with-custom-array-colon-broadcasting/31468 "2019-11-25T02:10:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Post date:** [November 25, 2019, 2:10am UTC](https://discourse.julialang.org/t/convert-method-interferes-with-custom-array-colon-broadcasting/31468/1 "2019-11-25T02:10:53Z")

</div>

I have defined a custom Vector type which appears to work as required.

```julia
struct MyVector{T} <: AbstractVector{T}
    data::Vector{T}
end

Base.size(A::MyVector) = size(A.data)
Base.IndexStyle(::Type{T}) where {T<:MyVector} = IndexStyle(fieldtype(T, :data))

@inline Base.getindex(A::MyVector, i::Int) = A.data[i]
@inline Base.setindex!(A::MyVector, x, i::Int) = A.data[i] = x

A = MyVector(collect(1:5))
A[:] .= 8
@assert A == fill(8, length(A))

```

But when I define the following `convert` method, it seems to break colon broadcasting.

```julia
Base.convert(::Type{MyVector{T}}, v::AbstractVector{T}) where {T} = MyVector(convert(Vector{T}, v))

A = MyVector(collect(1:5))
A[:] .= 8
@assert A == fill(8, length(A))
A

```

```julia
Julia-1.3.0-rc5> @assert A == fill(8, length(A))
ERROR: AssertionError: A == fill(8, length(A))
Stacktrace:
 [1] top-level scope at REPL[12]:1

Julia-1.3.0-rc5> A
5-element MyVector{Int64}:
 1
 2
 3
 4
 5

```

Can someone explain what happening here?
