diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2021-02-01 06:31:04 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-01 13:31:04 +0100 |
commit | de4f2604c2087cafb14b964280fdc0fd5fa847b5 (patch) | |
tree | 56b0076a92f9cecdafb7a933b315025c69b25b5e /tests/js | |
parent | a2855b66ae554e1d23760484c6f4e16387a1ee07 (diff) | |
download | Nim-de4f2604c2087cafb14b964280fdc0fd5fa847b5.tar.gz |
fix #16822 (#16884)
* see whether it breaks * fix #16884 * correct * fix #14574
Diffstat (limited to 'tests/js')
-rw-r--r-- | tests/js/t16822.nim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/js/t16822.nim b/tests/js/t16822.nim new file mode 100644 index 000000000..687d60be9 --- /dev/null +++ b/tests/js/t16822.nim @@ -0,0 +1,29 @@ +block: # bug #16822 + var scores: seq[(set[char], int)] = @{{'/'} : 10} + + var x1: set[char] + for item in items(scores): + x1 = item[0] + + doAssert x1 == {'/'} + + var x2: set[char] + for (chars, value) in items(scores): + x2 = chars + + doAssert x2 == {'/'} + +block: # bug #14574 + proc fn(): auto = + let a = @[("foo", (12, 13))] + for (k,v) in a: + return (k,v) + doAssert fn() == ("foo", (12, 13)) + +block: # bug #14574 + iterator fn[T](a:T): lent T = yield a + let a = (10, (11,)) + proc bar(): auto = + for (x,y) in fn(a): + return (x,y) + doAssert bar() == (10, (11,)) \ No newline at end of file |