summary refs log tree commit diff stats
path: root/tests/errmsgs
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2022-10-02 05:19:07 +0800
committerGitHub <noreply@github.com>2022-10-01 23:19:07 +0200
commit567c3f055ded0d81d15d6d5bc18377ca8c607c6d (patch)
tree7a83240e9f6b0d76174a5d0bf3ea54ec7fd586e3 /tests/errmsgs
parent0b1650576c6102ce85b4b2c0788b3a5b77154e43 (diff)
downloadNim-567c3f055ded0d81d15d6d5bc18377ca8c607c6d.tar.gz
Fix #19224 For loops over a hardcoded empty array crash the compiler (#20476)
* Fix #11684 For loops over a hardcoded empty array crash the compiler

* Update t19224.nim
Diffstat (limited to 'tests/errmsgs')
-rw-r--r--tests/errmsgs/t19224.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/errmsgs/t19224.nim b/tests/errmsgs/t19224.nim
new file mode 100644
index 000000000..7a9ecb2e7
--- /dev/null
+++ b/tests/errmsgs/t19224.nim
@@ -0,0 +1,12 @@
+discard """
+cmd: "nim check --hints:off $file"
+errormsg: ""
+nimout: '''
+t19224.nim(10, 10) Error: cannot infer element type of items([])
+t19224.nim(12, 10) Error: cannot infer element type of items(@[])
+'''
+"""
+
+for _ in []: discard
+
+for _ in @[]: discard