tarraycons_ptr_generic2.nim 420 B

123456789101112131415161718
  1. discard """
  2. errormsg: "type mismatch: got <ptr Hard[system.string]> but expected 'Book[system.string]'"
  3. file: "tarraycons_ptr_generic2.nim"
  4. line: 17
  5. """
  6. type
  7. Book[T] = ref object of RootObj
  8. cover: T
  9. Hard[T] = ref object of Book[T]
  10. Soft[T] = ref object of Book[T]
  11. var bn = Book[string](cover: "none")
  12. var hs = Hard[string](cover: "skin")
  13. var bp = Soft[string](cover: "paper")
  14. let z = [bn, hs.addr, bp]