summary refs log tree commit diff stats
path: root/tests/tuples
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2019-02-08 12:24:03 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-02-08 12:24:03 +0100
commitaa6e40abe6aa30b8fcabe63e3fc906d8fe62fa3b (patch)
tree287c26da67ff216d8518b9e79c7752d4070a276c /tests/tuples
parent8bc7c50c86102864016c7d1b3441949a74dea012 (diff)
downloadNim-aa6e40abe6aa30b8fcabe63e3fc906d8fe62fa3b.tar.gz
Fix wrong result in tuple assignment (#9340)
Fixes #9177
Diffstat (limited to 'tests/tuples')
-rw-r--r--tests/tuples/t9177.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/tuples/t9177.nim b/tests/tuples/t9177.nim
new file mode 100644
index 000000000..e6dd0cb1d
--- /dev/null
+++ b/tests/tuples/t9177.nim
@@ -0,0 +1,15 @@
+discard """
+  action: run
+"""
+
+block:
+  var x = (a: 5, b: 1)
+  x = (3 * x.a + 2 * x.b, x.a + x.b)
+  doAssert x.a == 17
+  doAssert x.b == 6
+block:
+  # Transformation of a tuple constructor with named arguments
+  var x = (a: 5, b: 1)
+  x = (a: 3 * x.a + 2 * x.b, b: x.a + x.b)
+  doAssert x.a == 17
+  doAssert x.b == 6