diff options
author | Simon Hafner <hafnersimon@gmail.com> | 2015-05-08 06:40:34 +0500 |
---|---|---|
committer | Simon Hafner <hafnersimon@gmail.com> | 2015-05-08 06:40:34 +0500 |
commit | f5cca89610905f35b50259cfe81e6d1d4153d39c (patch) | |
tree | 3c49f45590875e4eab78ae976d6ac254030e62af /tests/tuples/tuple_with_seq.nim | |
parent | 2474c1bb111b38ddef64659c893722b357a27384 (diff) | |
parent | c384f05e49e0716cc99042491f65bcc7d415d4c3 (diff) | |
download | Nim-f5cca89610905f35b50259cfe81e6d1d4153d39c.tar.gz |
merged devel into epc
Diffstat (limited to 'tests/tuples/tuple_with_seq.nim')
-rw-r--r-- | tests/tuples/tuple_with_seq.nim | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/tuples/tuple_with_seq.nim b/tests/tuples/tuple_with_seq.nim new file mode 100644 index 000000000..39edb500f --- /dev/null +++ b/tests/tuples/tuple_with_seq.nim @@ -0,0 +1,46 @@ +discard """ + output: '''it's nil +@[1, 2, 3]''' +""" + +template foo(s: string = nil) = + if isNil(s): + 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) |