Files
Nim/tests/vm/twrong_concat.nim
ringabout 3dbf2ac946 remove echo statements in tests (part 1) (#20178)
* remove echo statements

* Update tests/vm/triangle_array.nim

* Update tests/vm/tyaytypedesc.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2022-08-23 19:28:51 +02:00

23 lines
511 B
Nim

# bug #3804
#import sequtils
type AnObj = ref object
field: string
#proc aBug(objs: seq[AnObj]) {.compileTime.} =
# discard objs.mapIt(it.field & " bug")
proc sameBug(objs: seq[AnObj]) {.compileTime.} =
var strSeq = newSeq[string](objs.len)
strSeq[0] = objs[0].field & " bug"
static:
var objs: seq[AnObj] = @[]
objs.add(AnObj(field: "hello"))
sameBug(objs)
# sameBug(objs)
echo objs[0].field
doAssert(objs[0].field == "hello") # fails, because (objs[0].field == "hello bug") - mutated!