From f64eee3a1ebf1cda39160551d0070eada6ed34c9 Mon Sep 17 00:00:00 2001 From: Parashurama Date: Thu, 10 Aug 2017 21:01:13 +0200 Subject: [PATCH] add testcase for mitems returning tuple on VM. --- tests/vm/tmitems.nim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/vm/tmitems.nim b/tests/vm/tmitems.nim index a77c3fb23e..a0e64d6aa2 100644 --- a/tests/vm/tmitems.nim +++ b/tests/vm/tmitems.nim @@ -29,3 +29,17 @@ macro m: typed = result.add newCall(bindsym"echo", i) m() + +# bug 4741 & 5013 +proc test() = + var s = [("baz", 42), ("bath", 42)] + for i in s.mitems: + i[1] = 3 + doAssert(s == [("baz", 3), ("bath", 3)]) + +static: + test() + var s = [("baz", 42), ("bath", 42)] + for i in s.mitems: + i[1] = 3 + doAssert(s == [("baz", 3), ("bath", 3)])