M lib/scopes/Array.sc +2 -2
@@ 183,10 183,10 @@ typedef+ Array
assigned slot of array `self`. When the `array` is of `GrowingArray`
type, this operation will transparently resize the array's storage.
inline emplace-append-many (self size args...)
- let dest = (append-slots self size)
+ let dest = (& (append-slots self size))
for idx in (range size)
let value = (((typeof self) . ElementType) args...)
- assign value (self._items @ idx)
+ assign value (dest @ idx)
dest
""""Insert `value` at `index` into the array `self` and return a reference
M lib/scopes/String.sc +2 -2
@@ 284,10 284,10 @@ typedef+ StringBase
assigned slot of string `self`. When the string is of `GrowingString`
type, this operation will transparently resize the string's storage.
inline emplace-append-many (self size args...)
- let dest = (append-slots self size)
+ let dest = (& (append-slots self size))
for idx in (range size)
let value = (((typeof self) . ElementType) args...)
- assign value (self._items @ idx)
+ assign value (dest @ idx)
dest
""""Insert `value` at `index` into the string `self` and return a reference
M testing/test_array.sc +1 -2
@@ 133,5 133,4 @@ do
One.test-refcount-balanced;
-
-
+;
M testing/test_mutarray.sc +12 -0
@@ 231,3 231,15 @@ fn test-remove ()
test-remove;
One.test-refcount-balanced;
+
+do
+ local a : (Array i32)
+ for i in (range 3)
+ 'append a 10
+ 'emplace-append-many a 2 1
+ for i in (range 3)
+ test ((a @ i) == 10)
+ for i in (range 3 5)
+ test ((a @ i) == 1)
+
+;
M testing/test_string.sc +6 -0
@@ 95,6 95,12 @@ do
test (q == "inittiniinit")
;
+do
+ local s : String "abcd"
+ 'emplace-append-many s 4 101:i8
+ test (s == "abcdeeee")
+ ;
+
# testing proper globalization
local s = (String "test")
run-stage;