diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2020-11-18 08:14:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 00:14:14 +0000 |
commit | 0869d2a47777685d221ddde927f0175096c911b0 (patch) | |
tree | 52e66c54de33e8b93a328fb3626c23d5387efd85 /tests | |
parent | 632af8afad92594da050a5f7fd784ea111c3cc54 (diff) | |
download | Nim-0869d2a47777685d221ddde927f0175096c911b0.tar.gz |
fix #15972 (#15994)
* fix #15972 * add testcase * more
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stmt/tforloop_tuple_multiple_underscore.nim | 10 | ||||
-rw-r--r-- | tests/stmt/tforloop_tuple_underscore.nim | 16 | ||||
-rw-r--r-- | tests/stmt/tforloop_underscore.nim | 6 |
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/stmt/tforloop_tuple_multiple_underscore.nim b/tests/stmt/tforloop_tuple_multiple_underscore.nim new file mode 100644 index 000000000..2afdb0b77 --- /dev/null +++ b/tests/stmt/tforloop_tuple_multiple_underscore.nim @@ -0,0 +1,10 @@ +discard """ + errormsg: "undeclared identifier: '_'" +""" + +iterator iter(): (int, int, int) = + yield (1, 1, 2) + + +for (_, i, _) in iter(): + echo _ \ No newline at end of file diff --git a/tests/stmt/tforloop_tuple_underscore.nim b/tests/stmt/tforloop_tuple_underscore.nim new file mode 100644 index 000000000..8cbb0fc10 --- /dev/null +++ b/tests/stmt/tforloop_tuple_underscore.nim @@ -0,0 +1,16 @@ +discard """ + errormsg: "undeclared identifier: '_'" +""" + +iterator iter(): (int, int) = + yield (1, 2) + yield (3, 4) + yield (1, 2) + yield (3, 4) + yield (1, 2) + yield (3, 4) + + +for (_, i) in iter(): + echo _ + diff --git a/tests/stmt/tforloop_underscore.nim b/tests/stmt/tforloop_underscore.nim new file mode 100644 index 000000000..c5b49da77 --- /dev/null +++ b/tests/stmt/tforloop_underscore.nim @@ -0,0 +1,6 @@ +discard """ + errormsg: "undeclared identifier: '_'" +""" + +for _ in ["a"]: + echo _ |