From 53d43e96716539d96e6a1e5f3926a3fe3a11e2dd Mon Sep 17 00:00:00 2001 From: metagn Date: Thu, 24 Aug 2023 07:11:48 +0300 Subject: round out tuple unpacking assignment, support underscores (#22537) * round out tuple unpacking assignment, support underscores fixes #18710 * fix test messages * use discard instead of continue Co-authored-by: Andreas Rumpf --------- Co-authored-by: Andreas Rumpf --- tests/tuples/ttuples_various.nim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/tuples') diff --git a/tests/tuples/ttuples_various.nim b/tests/tuples/ttuples_various.nim index 97bc70bd2..e392731d2 100644 --- a/tests/tuples/ttuples_various.nim +++ b/tests/tuples/ttuples_various.nim @@ -197,3 +197,15 @@ block: # bug #22054 var v = A(field: (a: 1314)) doAssert get(v)[0] == 1314 + +block: # tuple unpacking assignment with underscore + var + a = 1 + b = 2 + doAssert (a, b) == (1, 2) + (a, _) = (3, 4) + doAssert (a, b) == (3, 2) + (_, a) = (5, 6) + doAssert (a, b) == (6, 2) + (b, _) = (7, 8) + doAssert (a, b) == (6, 7) -- cgit 1.4.1-2-gfad0