@@ -740,19 +740,21 @@ end
740
740
# copy from an some iterable object into an AbstractArray
741
741
function copyto! (dest:: AbstractArray , dstart:: Integer , src, sstart:: Integer )
742
742
if (sstart < 1 )
743
- throw (ArgumentError (string (" source start offset (" ,sstart," ) is < 1" )))
743
+ throw (ArgumentError (LazyString (" source start offset (" ,sstart," ) is < 1" )))
744
744
end
745
745
y = iterate (src)
746
746
for j = 1 : (sstart- 1 )
747
747
if y === nothing
748
- throw (ArgumentError (string (" source has fewer elements than required, " ,
749
- " expected at least " ,sstart," , got " ,j- 1 )))
748
+ throw (ArgumentError (LazyString (
749
+ " source has fewer elements than required, " ,
750
+ " expected at least " , sstart," , got " , j- 1 )))
750
751
end
751
752
y = iterate (src, y[2 ])
752
753
end
753
754
if y === nothing
754
- throw (ArgumentError (string (" source has fewer elements than required, " ,
755
- " expected at least " ,sstart," , got " ,sstart- 1 )))
755
+ throw (ArgumentError (LazyString (
756
+ " source has fewer elements than required, " ,
757
+ " expected at least " ,sstart," got " , sstart- 1 )))
756
758
end
757
759
i = Int (dstart)
758
760
while y != = nothing
@@ -766,19 +768,22 @@ end
766
768
767
769
# this method must be separate from the above since src might not have a length
768
770
function copyto! (dest:: AbstractArray , dstart:: Integer , src, sstart:: Integer , n:: Integer )
769
- n < 0 && throw (ArgumentError (string (" tried to copy n=" , n, " elements, but n should be nonnegative" )))
771
+ n < 0 && throw (ArgumentError (LazyString (" tried to copy n=" ,n,
772
+ " , elements, but n should be nonnegative" )))
770
773
n == 0 && return dest
771
774
dmax = dstart + n - 1
772
775
inds = LinearIndices (dest)
773
776
if (dstart ∉ inds || dmax ∉ inds) | (sstart < 1 )
774
- sstart < 1 && throw (ArgumentError (string (" source start offset (" ,sstart," ) is < 1" )))
777
+ sstart < 1 && throw (ArgumentError (LazyString (" source start offset (" ,
778
+ sstart," ) is < 1" )))
775
779
throw (BoundsError (dest, dstart: dmax))
776
780
end
777
781
y = iterate (src)
778
782
for j = 1 : (sstart- 1 )
779
783
if y === nothing
780
- throw (ArgumentError (string (" source has fewer elements than required, " ,
781
- " expected at least " ,sstart," , got " ,j- 1 )))
784
+ throw (ArgumentError (LazyString (
785
+ " source has fewer elements than required, " ,
786
+ " expected at least " ,sstart," , got " ,j- 1 )))
782
787
end
783
788
y = iterate (src, y[2 ])
784
789
end
@@ -834,7 +839,8 @@ function copyto!(dest::AbstractArray, dstart::Integer,
834
839
src:: AbstractArray , sstart:: Integer ,
835
840
n:: Integer )
836
841
n == 0 && return dest
837
- n < 0 && throw (ArgumentError (string (" tried to copy n=" , n, " elements, but n should be nonnegative" )))
842
+ n < 0 && throw (ArgumentError (LazyString (" tried to copy n=" ,
843
+ n," elements, but n should be nonnegative" )))
838
844
destinds, srcinds = LinearIndices (dest), LinearIndices (src)
839
845
(checkbounds (Bool, destinds, dstart) && checkbounds (Bool, destinds, dstart+ n- 1 )) || throw (BoundsError (dest, dstart: dstart+ n- 1 ))
840
846
(checkbounds (Bool, srcinds, sstart) && checkbounds (Bool, srcinds, sstart+ n- 1 )) || throw (BoundsError (src, sstart: sstart+ n- 1 ))
@@ -852,12 +858,12 @@ end
852
858
function copyto! (B:: AbstractVecOrMat{R} , ir_dest:: AbstractRange{Int} , jr_dest:: AbstractRange{Int} ,
853
859
A:: AbstractVecOrMat{S} , ir_src:: AbstractRange{Int} , jr_src:: AbstractRange{Int} ) where {R,S}
854
860
if length (ir_dest) != length (ir_src)
855
- throw (ArgumentError (string (" source and destination must have same size (got " ,
856
- length (ir_src)," and " ,length (ir_dest)," )" )))
861
+ throw (ArgumentError (LazyString (" source and destination must have same size (got " ,
862
+ length (ir_src)," and " ,length (ir_dest)," )" )))
857
863
end
858
864
if length (jr_dest) != length (jr_src)
859
- throw (ArgumentError (string (" source and destination must have same size (got " ,
860
- length (jr_src)," and " ,length (jr_dest)," )" )))
865
+ throw (ArgumentError (LazyString (" source and destination must have same size (got " ,
866
+ length (jr_src)," and " ,length (jr_dest)," )" )))
861
867
end
862
868
@boundscheck checkbounds (B, ir_dest, jr_dest)
863
869
@boundscheck checkbounds (A, ir_src, jr_src)
0 commit comments