Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #16822 #16884

Merged
merged 4 commits into from
Feb 1, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix #14574
ringabout committed Feb 1, 2021
commit 3ee2497a100330df56af5d5878593d236e2e7b83
34 changes: 25 additions & 9 deletions tests/js/t16822.nim
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
# bug #16822
var scores: seq[(set[char], int)] = @{{'/'} : 10}
block: # bug #16822
timotheecour marked this conversation as resolved.
Show resolved Hide resolved
var scores: seq[(set[char], int)] = @{{'/'} : 10}

var x: set[char]
for item in items(scores):
x = item[0]
var x1: set[char]
for item in items(scores):
x1 = item[0]

doAssert x == {'/'}
doAssert x1 == {'/'}

for (chars, value) in items(scores):
x = chars
var x2: set[char]
for (chars, value) in items(scores):
x2 = chars

doAssert x == {'/'}
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,))
3 changes: 1 addition & 2 deletions tests/stdlib/tjsonutils.nim
Original file line number Diff line number Diff line change
@@ -42,8 +42,7 @@ template fn() =

block:
testRoundtrip({"z": "Z", "y": "Y"}.toOrderedTable): """{"z":"Z","y":"Y"}"""
when not defined(js): # pending https://github.com/nim-lang/Nim/issues/14574
testRoundtrip({"z": (f1: 'f'), }.toTable): """{"z":{"f1":102}}"""
testRoundtrip({"z": (f1: 'f'), }.toTable): """{"z":{"f1":102}}"""

block:
testRoundtrip({"name": "John", "city": "Monaco"}.newStringTable): """{"mode":"modeCaseSensitive","table":{"city":"Monaco","name":"John"}}"""