Fix wrong result in tuple assignment (#9340)

Fixes #9177
This commit is contained in:
LemonBoy
2019-02-08 12:24:03 +01:00
committed by Andreas Rumpf
parent 8bc7c50c86
commit aa6e40abe6
2 changed files with 49 additions and 0 deletions

15
tests/tuples/t9177.nim Normal file
View File

@@ -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