summary refs log tree commit diff stats
path: root/tests/ccgbugs
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-08-04 23:34:58 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-08-04 23:34:58 +0200
commitbaeec118088fa3c40e12271f9ee89a2d701db818 (patch)
tree1d6091fd3507e58db3e16d7c37ba9e00f627ca4b /tests/ccgbugs
parent7ea318a05369a3b0847f7137a173df57b0ad0596 (diff)
downloadNim-baeec118088fa3c40e12271f9ee89a2d701db818.tar.gz
fixes #4354
Diffstat (limited to 'tests/ccgbugs')
-rw-r--r--tests/ccgbugs/tinefficient_const_table.nim27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ccgbugs/tinefficient_const_table.nim b/tests/ccgbugs/tinefficient_const_table.nim
new file mode 100644
index 000000000..149b8bcff
--- /dev/null
+++ b/tests/ccgbugs/tinefficient_const_table.nim
@@ -0,0 +1,27 @@
+discard """
+  output: '''a
+long
+list
+of
+words'''
+  cmd: r"nim c --hints:on $options -d:release $file"
+  ccodecheck: "! @'genericSeqAssign'"
+"""
+
+
+# bug #4354
+import tables
+import sets
+import strutils
+
+#const FRUITS = ["banana", "apple", "grapes"]
+#let FRUITS = ["banana", "apple", "grapes"].toSet
+const FRUITS = {"banana":0, "apple":0, "grapes":0}.toTable
+
+proc main() =
+    let L = "a long list of words".split()
+    for word in L:
+        if word notin FRUITS:
+            echo(word)
+
+main()