diff --git a/src/ConcreteRArray.jl b/src/ConcreteRArray.jl index a03df4a6e5..75f7e8381c 100644 --- a/src/ConcreteRArray.jl +++ b/src/ConcreteRArray.jl @@ -441,3 +441,10 @@ function Base.fill!(a::ConcreteIFRTArray{T,N}, val) where {T,N} fn(a, val, idxs...) return a end + +function Base.fill!(x::Union{AnyConcreteIFRTArray,AnyConcretePJRTArray}, val) + idxs = ntuple(Returns(Colon()), ndims(x)) + fn = compile(mysetindex!, (x, val, idxs...)) + fn(x, val, idxs...) + return x +end diff --git a/test/indexing.jl b/test/indexing.jl index 384f25cf4e..54b2ece567 100644 --- a/test/indexing.jl +++ b/test/indexing.jl @@ -345,3 +345,11 @@ end @test @jit(fn(x_ra, idx)) ≈ fn(x, idx) end + +@testset "ConcreteRArray view fill!" begin + x = Reactant.to_rarray(rand(2, 3)) + x_view = view(x, 1:2, 1:2) + + fill!(x_view, 0.0) + @test all(Array(x)[1:2, 1:2] .== 0) +end