tconceptconstraint.nim 265 B

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