t23547.nim 602 B

123456789101112131415161718192021222324
  1. # https://github.com/nim-lang/Nim/issues/23547
  2. type
  3. A[T] = object
  4. x: T
  5. proc mulCheckSparse[F](dummy: var A[F], xmulchecksparse: static A[F]) =
  6. static:
  7. echo "mulCheckSparse: ", typeof(dummy), ", ", typeof(xmulchecksparse) # when generic params not specified: A[system.int], A
  8. template sumImpl(xsumimpl: typed) =
  9. static:
  10. echo "sumImpl: ", typeof(xsumimpl) # A
  11. var a = A[int](x: 55)
  12. mulCheckSparse(a, xsumimpl) # fails here
  13. proc sum[T](xsum: static T) =
  14. static:
  15. echo "sum: ", typeof(xsum) # A[system.int]
  16. sumImpl(xsum)
  17. const constA = A[int](x : 100)
  18. sum[A[int]](constA)