t23755.nim 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. type
  2. BigInt[bits: static int] = object
  3. limbs: array[8, uint64]
  4. block:
  5. proc view[N](a: array[N, uint64]) =
  6. discard
  7. proc view[N](a: var array[N, uint64]) =
  8. discard
  9. var r: BigInt[64]
  10. r.limbs.view()
  11. type Limbs[N: static int] = array[N, uint64]
  12. block:
  13. proc view(a: Limbs) =
  14. discard
  15. proc view(a: var Limbs) =
  16. discard
  17. var r: BigInt[64]
  18. r.limbs.view()
  19. block:
  20. type IntArray[N: static[int]] = array[N, int]
  21. proc p[T](a: IntArray[T]): bool= true
  22. proc p(a: IntArray[5]): bool= false
  23. var s: IntArray[5]
  24. doAssert s.p == false
  25. block:
  26. type IntArray[N: static[int]] = array[N, int]
  27. proc `$`(a: IntArray): string =
  28. return "test"
  29. var s: IntArray[5] = [1,1,1,1,1]
  30. doAssert `$`(s) == "test"
  31. block:
  32. proc p[n:static[int]](a: array[n, char]):bool=true
  33. proc p[T, IDX](a: array[IDX, T]):bool=false
  34. var g: array[32, char]
  35. doAssert p(g)
  36. block: # issue #23823
  37. func p[N,T](a, b: array[N,T]) =
  38. discard
  39. func p[N: static int; T](x, y: array[N, T]) =
  40. discard
  41. var a: array[5, int]
  42. p(a,a)