From 42f7a991944fe14a93830c58875d987a5047f5c1 Mon Sep 17 00:00:00 2001 From: N5N3 <2642243996@qq.com> Date: Tue, 17 May 2022 18:54:03 +0800 Subject: [PATCH] Typo fix. (#45333) (cherry picked from commit eed2dba73d5c781055c23120d357a17c875e685b) --- base/multidimensional.jl | 2 +- test/copy.jl | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/base/multidimensional.jl b/base/multidimensional.jl index 02c9b04927f5c..1c63addc77f03 100644 --- a/base/multidimensional.jl +++ b/base/multidimensional.jl @@ -1082,7 +1082,7 @@ function copyto!(dest::AbstractArray{T1,N}, Rdest::CartesianIndices{N}, if @generated quote @nloops $N i (n->CRsrc.indices[n]) begin - @inbounds @nref($N,dest,n->Rdest.indices[n][i_n+ΔI[n]]) = @nref($N,src,n->Rsrc.indices[n][i_n]) + @inbounds @nref($N,dest,n->Rdest.indices[n][i_n+ΔI[n]]) = @nref($N,src′,n->Rsrc.indices[n][i_n]) end end else diff --git a/test/copy.jl b/test/copy.jl index eba575836e12f..991f6db1c56b6 100644 --- a/test/copy.jl +++ b/test/copy.jl @@ -67,6 +67,10 @@ end @test all(iszero, B) end end + let A = [reshape(1:6, 3, 2);;] + copyto!(A, CartesianIndices((2:3,2)), A, CartesianIndices((2,2))) + @test A[2:3,:] == [1 4;2 5] + end end @testset "shallow and deep copying" begin