fixes #20422; emit nimPrepareStrMutationV2 for toOpenArray to keep the abstraction of mutable strings which have immutable string literals
This commit is contained in:
parent
612abda4f4
commit
50baf21eac
3 changed files with 19 additions and 2 deletions
|
|
@ -6,6 +6,8 @@ Nim
|
|||
'''
|
||||
matrix: "--gc:arc -d:useMalloc; --gc:arc"
|
||||
"""
|
||||
{.experimental: "views".}
|
||||
|
||||
block: # bug 18627
|
||||
proc setPosition(params: openArray[string]) =
|
||||
for i in params.toOpenArray(0, params.len - 1):
|
||||
|
|
@ -38,3 +40,13 @@ block: # bug #20954
|
|||
var v: seq[int]
|
||||
|
||||
echo len(toOpenArray(v, 20, 30))
|
||||
|
||||
# bug #20422
|
||||
|
||||
proc f(a: var string) =
|
||||
var v = a.toOpenArray(1, 3)
|
||||
v[0] = 'a'
|
||||
|
||||
var a = "Hello"
|
||||
f(a)
|
||||
doAssert a == "Hallo"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue