tparam_binding.nim 605 B

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