tparam_binding.nim 573 B

1234567891011121314151617181920212223242526272829
  1. discard """
  2. errormsg: "got <ref Matrix[2, 2, system.float], ref Matrix[2, 1, system.float]>"
  3. line: 27
  4. """
  5. type
  6. Matrix[M,N: static[int]; T: SomeFloat] = distinct array[0..(M*N - 1), T]
  7. let a = new Matrix[2,2,float]
  8. let b = new Matrix[2,1,float]
  9. proc foo[M,N: static[int],T](a: ref Matrix[M, N, T], b: ref Matrix[M, N, T])=
  10. discard
  11. foo(a, a)
  12. proc bar[M,N: static[int],T](a: ref Matrix[M, M, T], b: ref Matrix[M, N, T])=
  13. discard
  14. bar(a, b)
  15. bar(a, a)
  16. proc baz[M,N: static[int],T](a: ref Matrix[N, N, T], b: ref Matrix[M, N, T])=
  17. discard
  18. baz(a, a)
  19. baz(a, b)