From 1fa28584c93ec3a2b554f1fcc167e23b152c6f6e Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Thu, 17 Sep 2015 15:12:38 -0400 Subject: [PATCH] improve type-inference/codegen for setindex! closes #10954 --- base/array.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/array.jl b/base/array.jl index 26949644727a1..733eb00d5a25c 100644 --- a/base/array.jl +++ b/base/array.jl @@ -310,10 +310,10 @@ function getindex{T<:Real}(A::Array, I::Range{T}) end ## Indexing: setindex! ## -setindex!{T}(A::Array{T}, x, i1::Real) = arrayset(A, convert(T,x), to_index(i1)) -setindex!{T}(A::Array{T}, x, i1::Real, i2::Real, I::Real...) = arrayset(A, convert(T,x), to_index(i1), to_index(i2), to_indexes(I...)...) +setindex!{T}(A::Array{T}, x, i1::Real) = arrayset(A, convert(T,x)::T, to_index(i1)) +setindex!{T}(A::Array{T}, x, i1::Real, i2::Real, I::Real...) = arrayset(A, convert(T,x)::T, to_index(i1), to_index(i2), to_indexes(I...)...) -unsafe_setindex!{T}(A::Array{T}, x, i1::Real, I::Real...) = @inbounds return arrayset(A, convert(T,x), to_index(i1), to_indexes(I...)...) +unsafe_setindex!{T}(A::Array{T}, x, i1::Real, I::Real...) = @inbounds return arrayset(A, convert(T,x)::T, to_index(i1), to_indexes(I...)...) # These are redundant with the abstract fallbacks but needed for bootstrap function setindex!(A::Array, x, I::AbstractVector{Int})