Revert "Revert "test cases for the new features""
This reverts commit e1b668c868.
This commit is contained in:
parent
50403afb5c
commit
f127bc387a
4 changed files with 78 additions and 4 deletions
|
|
@ -5,6 +5,8 @@ type
|
|||
T1 = expr
|
||||
T2 = expr
|
||||
|
||||
Numeric = int|float
|
||||
|
||||
proc takesExpr(x, y) =
|
||||
echo x, y
|
||||
|
||||
|
|
@ -32,3 +34,22 @@ takesFoo(f, f)
|
|||
takes2Types(1, 1, "string")
|
||||
takes2Types[string, int]("test", "test", 1)
|
||||
|
||||
proc takesSeq(x: seq) =
|
||||
echo "seq"
|
||||
|
||||
takesSeq(@[1, 2, 3])
|
||||
takesSeq(@["x", "y", "z"])
|
||||
|
||||
proc takesSeqOfFoos(x: seq[TFoo]) =
|
||||
echo "foo seq"
|
||||
|
||||
var sf = newSeq[TFoo[int]](3)
|
||||
|
||||
takesSeq(sf)
|
||||
takesSeqOfFoos(sf)
|
||||
|
||||
proc takesFooOfNumeric(x: TFoo[Numeric]) =
|
||||
echo "foo of numeric"
|
||||
|
||||
takesFooOfNumeric(sf[0])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue