tconceptconstraint.nim 259 B

123456789101112131415161718192021
  1. discard """
  2. errormsg: "cannot instantiate B"
  3. nimout: '''
  4. got: <typedesc[string]>
  5. but expected: <T: A>
  6. '''
  7. """
  8. type
  9. A = concept c
  10. advance(c)
  11. B[T: A] = object
  12. child: ref B[T]
  13. proc advance(x: int): int = x + 1
  14. var a: B[int]
  15. var b: B[string]