'[]' can now be used for iterators (#18814)

This commit is contained in:
Jason Beetham 2021-09-06 07:30:49 -06:00 • committed by GitHub
commit 90bfd34250
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

14
tests/iter/tarrayiter.nim Normal file
View file

@ -0,0 +1,14 @@
block:
iterator `[]`(a: int, r: int): int =
for q in 0 .. r:
yield a
for val in 10[2]: discard
type Custom = distinct string
iterator `[]`(a: Custom, r: int): char =
for q in 0 .. r:
yield a.string[q]
for val in Custom("test")[2]: discard