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
This commit is contained in:
Bung 2022-10-02 05:19:07 +08:00 • committed by GitHub
commit 567c3f055d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

12
tests/errmsgs/t19224.nim Normal file
View file

@ -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