Nim/tests/compile/ttypeclasses.nim
Zahary Karadjov 9c8bc3a244 the is operator now works with type classes and type variables
bugfixes:
the DLL tests were failing on Mac OS X, due to an incorrect DynlibFormat
2012-10-03 01:59:49 +03:00

34 lines
450 B
Nim

type
TFoo[T] = object
val: T
T1 = expr
T2 = expr
proc takesExpr(x, y) =
echo x, y
proc same(x, y: T1) =
echo x, y
proc takesFoo(x, y: TFoo) =
echo x.val, y.val
proc takes2Types(x,y: T1, z: T2) =
echo x, y, z
takesExpr(1, 2)
takesExpr(1, "xxx")
takesExpr[bool, int](true, 0)
same(1, 2)
same("test", "test")
var f: TFoo[int]
f.val = 10
takesFoo(f, f)
takes2Types(1, 1, "string")
takes2Types[string, int]("test", "test", 1)