@@ -914,19 +914,21 @@ end
914
914
# copy from an some iterable object into an AbstractArray
915
915
function copyto! (dest:: AbstractArray , dstart:: Integer , src, sstart:: Integer )
916
916
if (sstart < 1 )
917
- throw (ArgumentError (string (" source start offset (" ,sstart," ) is < 1" )))
917
+ throw (ArgumentError (LazyString (" source start offset (" ,sstart," ) is < 1" )))
918
918
end
919
919
y = iterate (src)
920
920
for j = 1 : (sstart- 1 )
921
921
if y === nothing
922
- throw (ArgumentError (string (" source has fewer elements than required, " ,
923
- " expected at least " ,sstart," , got " ,j- 1 )))
922
+ throw (ArgumentError (LazyString (
923
+ " source has fewer elements than required, " ,
924
+ " expected at least " , sstart," , got " , j- 1 )))
924
925
end
925
926
y = iterate (src, y[2 ])
926
927
end
927
928
if y === nothing
928
- throw (ArgumentError (string (" source has fewer elements than required, " ,
929
- " expected at least " ,sstart," , got " ,sstart- 1 )))
929
+ throw (ArgumentError (LazyString (
930
+ " source has fewer elements than required, " ,
931
+ " expected at least " ,sstart," got " , sstart- 1 )))
930
932
end
931
933
i = Int (dstart)
932
934
while y != = nothing
@@ -940,19 +942,22 @@ end
940
942
941
943
# this method must be separate from the above since src might not have a length
942
944
function copyto! (dest:: AbstractArray , dstart:: Integer , src, sstart:: Integer , n:: Integer )
943
- n < 0 && throw (ArgumentError (string (" tried to copy n=" , n, " elements, but n should be nonnegative" )))
945
+ n < 0 && throw (ArgumentError (LazyString (" tried to copy n=" ,n,
946
+ " , elements, but n should be nonnegative" )))
944
947
n == 0 && return dest
945
948
dmax = dstart + n - 1
946
949
inds = LinearIndices (dest)
947
950
if (dstart ∉ inds || dmax ∉ inds) | (sstart < 1 )
948
- sstart < 1 && throw (ArgumentError (string (" source start offset (" ,sstart," ) is < 1" )))
951
+ sstart < 1 && throw (ArgumentError (LazyString (" source start offset (" ,
952
+ sstart," ) is < 1" )))
949
953
throw (BoundsError (dest, dstart: dmax))
950
954
end
951
955
y = iterate (src)
952
956
for j = 1 : (sstart- 1 )
953
957
if y === nothing
954
- throw (ArgumentError (string (" source has fewer elements than required, " ,
955
- " expected at least " ,sstart," , got " ,j- 1 )))
958
+ throw (ArgumentError (LazyString (
959
+ " source has fewer elements than required, " ,
960
+ " expected at least " ,sstart," , got " ,j- 1 )))
956
961
end
957
962
y = iterate (src, y[2 ])
958
963
end
@@ -1064,7 +1069,8 @@ function copyto!(dest::AbstractArray, dstart::Integer,
1064
1069
src:: AbstractArray , sstart:: Integer ,
1065
1070
n:: Integer )
1066
1071
n == 0 && return dest
1067
- n < 0 && throw (ArgumentError (string (" tried to copy n=" , n, " elements, but n should be nonnegative" )))
1072
+ n < 0 && throw (ArgumentError (LazyString (" tried to copy n=" ,
1073
+ n," elements, but n should be nonnegative" )))
1068
1074
destinds, srcinds = LinearIndices (dest), LinearIndices (src)
1069
1075
(checkbounds (Bool, destinds, dstart) && checkbounds (Bool, destinds, dstart+ n- 1 )) || throw (BoundsError (dest, dstart: dstart+ n- 1 ))
1070
1076
(checkbounds (Bool, srcinds, sstart) && checkbounds (Bool, srcinds, sstart+ n- 1 )) || throw (BoundsError (src, sstart: sstart+ n- 1 ))
@@ -1082,12 +1088,12 @@ end
1082
1088
function copyto! (B:: AbstractVecOrMat{R} , ir_dest:: AbstractRange{Int} , jr_dest:: AbstractRange{Int} ,
1083
1089
A:: AbstractVecOrMat{S} , ir_src:: AbstractRange{Int} , jr_src:: AbstractRange{Int} ) where {R,S}
1084
1090
if length (ir_dest) != length (ir_src)
1085
- throw (ArgumentError (string (" source and destination must have same size (got " ,
1086
- length (ir_src)," and " ,length (ir_dest)," )" )))
1091
+ throw (ArgumentError (LazyString (" source and destination must have same size (got " ,
1092
+ length (ir_src)," and " ,length (ir_dest)," )" )))
1087
1093
end
1088
1094
if length (jr_dest) != length (jr_src)
1089
- throw (ArgumentError (string (" source and destination must have same size (got " ,
1090
- length (jr_src)," and " ,length (jr_dest)," )" )))
1095
+ throw (ArgumentError (LazyString (" source and destination must have same size (got " ,
1096
+ length (jr_src)," and " ,length (jr_dest)," )" )))
1091
1097
end
1092
1098
@boundscheck checkbounds (B, ir_dest, jr_dest)
1093
1099
@boundscheck checkbounds (A, ir_src, jr_src)
0 commit comments