From 92cc787f559a1d4bc2dec7a47a408de0aaf5c0a8 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 4be18766a30e6d..cd55b371de5a37 100644 --- a/base/multidimensional.jl +++ b/base/multidimensional.jl @@ -1119,7 +1119,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 654e95dec67d56..04fda36728e626 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