diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-11-02 12:01:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-02 12:01:36 +0800 |
commit | 841d9d59755f805245d862456d53e4fd8a426813 (patch) | |
tree | 0d109b2254ac9e4de7a89a596da27ecf7c0d4f8f /tests/tuples | |
parent | 58f79e7c3e1bfc227efaaf20f34593cb3fb3ddeb (diff) | |
download | Nim-841d9d59755f805245d862456d53e4fd8a426813.tar.gz |
closes #16331; add testcase (#20730)
Diffstat (limited to 'tests/tuples')
-rw-r--r-- | tests/tuples/ttuples_issues.nim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/tuples/ttuples_issues.nim b/tests/tuples/ttuples_issues.nim index 0cc505d28..70defdfce 100644 --- a/tests/tuples/ttuples_issues.nim +++ b/tests/tuples/ttuples_issues.nim @@ -107,6 +107,18 @@ template main() = return (x,y) doAssert bar() == (10, (11,)) + block: # bug #16331 + type T1 = tuple[a, b: int] + + proc p(b: bool): T1 = + var x: T1 = (10, 20) + x = if b: (x.b, x.a) else: (-x.b, -x.a) + x + + doAssert p(false) == (-20, -10) + doAssert p(true) == (20, 10) + + proc mainProc() = # other tests should be in `main` block: |