twrong_generic_object.nim 420 B

12345678910111213141516171819202122
  1. discard """
  2. errormsg: "'Node' is not a concrete type"
  3. line: 11
  4. """
  5. # bug #2509
  6. type
  7. GenericNodeObj[T] = ref object
  8. obj: T
  9. Node* = ref object
  10. children*: seq[Node]
  11. parent*: Node
  12. nodeObj*: GenericNodeObj # [int]
  13. proc newNode*(nodeObj: GenericNodeObj): Node =
  14. result = Node(nodeObj: nodeObj)
  15. newSeq(result.children, 10)
  16. var genericObj = GenericNodeObj[int]()
  17. var myNode = newNode(genericObj)