diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2021-06-10 16:49:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-10 16:49:17 +0200 |
commit | 2ea7287217ffe3ad6c3790ff1233845de2aedcf4 (patch) | |
tree | 272e77e540c687a7abb9957bb1624118fcc87f9e /tests/views | |
parent | 3481ff6172a2e11c990cc67a7fd74a2f0a2445d2 (diff) | |
download | Nim-2ea7287217ffe3ad6c3790ff1233845de2aedcf4.tar.gz |
view types: spec changes (#18226)
* view types: spec changes * Update doc/manual_experimental.rst Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * Update doc/manual_experimental.rst Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
Diffstat (limited to 'tests/views')
-rw-r--r-- | tests/views/tdont_mutate.nim | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/views/tdont_mutate.nim b/tests/views/tdont_mutate.nim index d243c7c7a..43acaaf71 100644 --- a/tests/views/tdont_mutate.nim +++ b/tests/views/tdont_mutate.nim @@ -9,8 +9,9 @@ import tables const Whitespace = {' ', '\t', '\n', '\r'} -proc split*(s: string, seps: set[char] = Whitespace, - maxsplit: int = -1): Table[int, openArray[char]] = +proc split*(s: string, seps: set[char] = Whitespace, maxsplit: int = -1): Table[int, openArray[char]] #[tt.Error + 'result' borrows from the immutable location 's' and attempts to mutate it + ]# = var last = 0 var splits = maxsplit result = initTable[int, openArray[char]]() @@ -22,9 +23,7 @@ proc split*(s: string, seps: set[char] = Whitespace, if splits == 0: last = len(s) result[first] = toOpenArray(s, first, last-1) - result[first][0] = 'c' #[tt.Error - attempt to mutate a borrowed location from an immutable view - ]# + result[first][0] = 'c' if splits == 0: break dec(splits) |