blob: 00b07dd2cb8048d10b9588fa60a044f2bf692738 (
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
|
discard """
output: '''it's nil
@[1, 2, 3]'''
"""
template foo(s: string = "") =
if s.len == 0:
echo "it's nil"
else:
echo s
foo
# bug #2632
proc takeTup(x: tuple[s: string;x: seq[int]]) =
discard
takeTup(("foo", @[]))
#proc foobar(): () =
proc f(xs: seq[int]) =
discard
proc g(t: tuple[n:int, xs:seq[int]]) =
discard
when isMainModule:
f(@[]) # OK
g((1,@[1])) # OK
g((0,@[])) # NG
# bug #2630
type T = tuple[a: seq[int], b: int]
var t: T = (@[1,2,3], 7)
proc test(s: seq[int]): T =
echo s
(s, 7)
t = test(t.a)
|