'[]' can now be used for iterators (#18814)
This commit is contained in:
parent
cc5422ae50
commit
90bfd34250
2 changed files with 15 additions and 1 deletions
14
tests/iter/tarrayiter.nim
Normal file
14
tests/iter/tarrayiter.nim
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue