blob: c6dbf768a125f000306e7eb1aae1d581f79f5f92 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
discard """
matrix: "--mm:arc; --mm:orc"
"""
import std/macros
import std/streams
# bug #22237
proc iterlines_closure2(f: File | Stream): iterator (): string =
result = iterator(): string =
for line in f.lines:
if line.len == 0:
break
yield line
proc test() =
let f = newStringStream("""
1
2
3
4
5
6
7
8
""")
while not f.atEnd():
let iterator_inst = iterlines_closure2(f)
for item in iterator_inst(): # Fails with "SIGSEGV: Illegal storage access. (Attempt to read from nil?)"
discard
test()
# bug #21160
import sequtils
iterator allMoves(fls: seq[int]): seq[int] =
yield fls
proc neighbors(flrs: seq[int]): iterator: seq[int] =
return iterator(): seq[int] =
for flrs2 in allMoves(flrs):
yield flrs2
for flrs3 in allMoves(flrs2):
yield flrs3
let f = @[1]
for _ in neighbors(f):
discard
for _ in neighbors(f):
discard
|